&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; Implementation: Linux host to do the route for the subnet to achieve shared access. 2 IP, one public network IP (22.33.44.55), an internal and external gateway (192.168.0.254).
First turn on routing forwarding, and to ensure that the power-on reboot takes effect. The following actions:
1: Modify/etc/sycctl.conf, turn on routing forwarding.
[Root@kook ~]# vi/etc/sysctl.conf
Net.ipv4.ip_forward = 1
2: Immediate effect
[Root@kook ~]# Sysctl-p
Net.ipv4.ip_forward = 1
Net.ipv4.conf.default.rp_filter = 1
Net.ipv4.conf.default.accept_source_route = 0
KERNEL.SYSRQ = 0
Kernel.core_uses_pid = 1
Net.ipv4.tcp_syncookies = 1
KERNEL.MSGMNB = 65536
Kernel.msgmax = 65536
Kernel.shmmax = 4294967295
Kernel.shmall = 268435456
Adding iptables Nat also ensures that the boot route takes effect.
1: Add iptable NAT
[Root@kook ~]# iptables-t nat-a postrouting-s 192.168.10.0/24-o eth0-j Masquerade
2: Modify the default iptables, to ensure that the reboot is still in effect.
[Root@kook ~]# iptables-save >/etc/sysconfig/iptables
3: Let iptables boot
[Root@kook ~]# chkconfig iptables on
[Root@kook ~]# chkconfig--list iptables
Iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Test on the subnet to see if you can surf the web. Complete。