1. 开启防火墙(服务端)
# systemctl start firewalld.service
2. 一条命令开启共享上网(服务端)
# firewall-cmd --add-masquerade
3. 客户端将默认网关指向—> 能上网的地址(客户端)
# vim /etc/sysconfig/network-scripts/ifcfg-eth1
IPADDR=172.16.1.7
GATEWAY=172.16.1.61
DNS1=223.5.5.5
PREFIX=24
4. 关闭eth0(客户端)
# ifdown eth0
5.重启网卡(eth1)(客户端)
# ifdown eth1 && ifup eth1
6. 测试(客户端)
# ping baidu.com
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=127 time=6.05 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=127 time=12.2 ms