/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:94:67:DE
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.52
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=192.168.1.227
/etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.100.1
NETMASK=255.255.255.0
HWADDR=00:0C:29:94:67:E8
TYPE=Ethernet
echo "1"> /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -j SNAT --to 192.168.1.52
/etc/resolv.conf
search localdomain
nameserver 192.168.1.1
测试结果
192.168.100.3能正常访问外网
转载于:https://blog.51cto.com/568a568b/626523