Linux NAT server forwarding [ubuntu]

CS/Network 2013. 12. 9. 20:52

원문 :

http://www.linuxrookie.com/?p=160

http://www.howtoforge.com/nat_iptables


private interface : eth1

public   interface : eth0


1. Open the forward option

# echo 1 > /proc/sys/net/ipv4/ip_forward

or

# vim /etc/sysctl.conf  change net.ipv4.ip_forward = 0,let 0 to 1


2. Config NAT rules

# iptables –t nat –A POSTROUTING –s 192.168.100.0/24 –o eth0 –j MASQUERADE

# iptables –A FORWARD –i eth1 –j ACCEPT


3. Permanently update iptables

# apt-get install iptables-persistent

# iptables-save > /etc/iptables/rules.v4



: