Http://www.pxue.com/Html/1261.html
Need to enable IP forwarding
Vi/etc/sysctl.conf
Net.ipv4.ip_forward = 1
If the host does not have a firewall enabled, the following iptables statement can set up NAT intranet share Internet:
Code:
Iptables-t nat-a postrouting-s 192.168.122.0/24-o eth0-j Masquerade
-S indicates the source network, that is, the intranet address;-O is the interface connecting the Internet
If a firewall is enabled on the host, add the following two sentences:
Code:
Iptables-a forward-s 192.168.122.0/24-o eth0-j ACCEPT
Iptables-a forward-d 192.168.122.0/24-m State--state established,related-i eth0-j ACCEPT
respectively, the packet received from the intranet and exported to eth0 is forwarded; from the eth0, the destination address is the intranet, and the connection status is set up and the associated packet accepts the forwarding.
Use:
Code:
Service Iptables Restart
Restart the Iptables service and set the intranet computer gateway to the CentOS IP address
CentOS Setup Iptables to enable intranet access via NAT