步骤
1.
移除默认NAT,并添加新的NAT
2.
# cd /etc/sysconfig/network-scripts/
3.
# vim ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=192.168.145.10
NETMASK=255.255.255.0
GATEWAY=192.168.145.2
DNS1=202.106.0.20
4.重启网络服务
# /etc/init.d/network restart
5.查看静态ip是否设置成功
# ifconfig
6.测试是否能上网
# curl www.baidu.com