From IT Mission Linux Tips, Hacks, Tutorials, Howtos - Itmission.org

Main: IPMasqueradingToAllowMachinesWithPrivateToAccessTheInternet

IP Masquerading Internet Connection Sharing

IP Masquerading is to allow machines with private to access the Internet through the machine doing the masquerading.

  iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE


  Address:   192.168.0.1           11000000.10101000.00000000 .00000001
  Netmask:   255.255.255.0 = 24    11111111.11111111.11111111 .00000000
  Wildcard:  0.0.0.255             00000000.00000000.00000000 .11111111

  Network:   192.168.0.0/24        11000000.10101000.00000000 .00000000 (Class C)
  Broadcast: 192.168.0.255         11000000.10101000.00000000 .11111111
  HostMin:   192.168.0.1           11000000.10101000.00000000 .00000001
  HostMax:   192.168.0.254         11000000.10101000.00000000 .11111110

http://www.ietf.org/rfc/rfc1918.txt

  iptables -A FORWARD -s 192.168.0.0/24  -o eth0 -j ACCEPT
  iptables -A FORWARD -d 192.168.0.0/24  -m state --state ESTABLISHED,RELATED -i eth0 -j ACCEPT
Retrieved from http://www.itmission.org/Main/IPMasqueradingToAllowMachinesWithPrivateToAccessTheInternet
Page last modified on April 14, 2007, at 06:58 AM