http://www.kaifajie.cn/os2/6223.html
1,修改静态网络配置
Java代码
[root@davidserver ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:99:5A:3C"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="1cb095a6-b832-4dc1-92e1-1a1a7a58abc8"
IPADDR="8.0.0.10"
BROADCAST="8.0.0.255"
NETMASK="255.255.255.0"
NETWORK="8.0.0.0"
GATEWAY="8.0.0.1"
IPV6INIT="no"
IPV6_AUTOCONF="no"
[root@davidserver ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:99:5A:3C"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="1cb095a6-b832-4dc1-92e1-1a1a7a58abc8"
IPADDR="8.0.0.10"
BROADCAST="8.0.0.255"
NETMASK="255.255.255.0"
NETWORK="8.0.0.0"
GATEWAY="8.0.0.1"
IPV6INIT="no"
IPV6_AUTOCONF="no"
2,修改DNS服务
Java代码
[root@davidserver ~]# vim/etc/resolv.conf
nameserver 8.0.0.1
[root@davidserver ~]# vim/etc/resolv.conf
nameserver 8.0.0.1
3,重启网卡
Java代码
[root@davidserver ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@davidserver ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
输出以上信息,代表成功了
or
Java代码
[root@davidserver ~]# ifdown eth0; ifup eth0
///////////////////////////
vim /etc/sysconfig/network-scripts/ifcfg-eth0