From IT Mission Linux Tips, Hacks, Tutorials, Howtos -

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 -o eth0 -j MASQUERADE

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

  Network:        11000000.10101000.00000000 .00000000 (Class C)
  Broadcast:         11000000.10101000.00000000 .11111111
  HostMin:           11000000.10101000.00000000 .00000001
  HostMax:         11000000.10101000.00000000 .11111110

  iptables -A FORWARD -s  -o eth0 -j ACCEPT
  iptables -A FORWARD -d  -m state --state ESTABLISHED,RELATED -i eth0 -j ACCEPT
Retrieved from
Page last modified on April 14, 2007, at 06:58 AM