1. Turn on the kernel IP forwarding vi/etc/sysctl.conf
Net.ipv4.ip_forward = 1
Execution Sysctrl-p Effective
2, if the host is not enabled firewall, then the following settings iptables
[[email protected] ~]
# iptables -f
[[email protected] ~]
# iptables -p input accept
[[email protected] ~]
# IPTABLES -P FORWARD ACCEPT 
[[email protected] ~]
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Or
iptables -t nat -A POSTROUTING -s ip -o eth0 -j MASQUERADE
[[email protected] ~]
# /etc/init.d/iptables save
[[email protected] ~]
# /etc/init.d/iptables restart
description:
  
IPTABLES -F 
#清除原有的filter有中的规则
  
IPTABLES -T NAT -F 
#清除原有的nat表中的规则
  
IPTABLES -P FORWARD ACCEPT 
#缺省允许IP转发
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
Linux shared Internet Settings