先找到配置文件:
[root@localhost bin]# cd /etc/sysconfig/network-scripts [root@localhost network-scripts]# ls ifcfg-eno16777736 ifdown-ppp ifup-ib ifup-Team ifcfg-lo ifdown-routes ifup-ippp ifup-TeamPort ifdown ifdown-sit ifup-ipv6 ifup-tunnel ifdown-bnep ifdown-Team ifup-isdn ifup-wireless ifdown-eth ifdown-TeamPort ifup-plip init.ipv6-global ifdown-ib ifdown-tunnel ifup-plusb network-functions ifdown-ippp ifup ifup-post network-functions-ipv6 ifdown-ipv6 ifup-aliases ifup-ppp ifdown-isdn ifup-bnep ifup-routes ifdown-post ifup-eth ifup-sit [root@localhost network-scripts]# gedit ifcfg-eno16777736
开始配置是:
TYPE="Ethernet" BOOTPROTO="dhcp" DEFROUTE="yes" PEERDNS="yes" PEERROUTES="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_FAILURE_FATAL="no" NAME="eno16777736" UUID="157c8fb5-23b3-414c-8519-25bef9b20a54" DEVICE="eno16777736" ONBOOT="yes"
修改成:
TYPE="Ethernet" BOOTPROTO="static" NM_CONTROLLED=no #表示该接口将通过该配置文件进行设置,而不是通过网络管理器进行管理 DEFROUTE="yes" PEERDNS="yes" PEERROUTES="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_FAILURE_FATAL="no" NAME="eno16777736" UUID="157c8fb5-23b3-414c-8519-25bef9b20a54" DEVICE="eno16777736" ONBOOT="yes" #系统将在启动时开启该接口。 IPADDR=192.168.1.122 #静态IP GATEWAY=192.168.1.1 #默认网关 NETMASK=255.255.255.0 #子网掩码 #DNS1=192.168.7.1 #DNS 配置
重启网络服务:
service network restart
http://www.cnblogs.com/Leo_wl/p/5484136.html
原文:http://www.cnblogs.com/hongdada/p/6666932.html