步驟1、配置/etc/sysconfig/network-scripts/ifcfg-eth0 里的文件。it動力的CentOS下的ifcfg-eth0的配置詳情:
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:FD:FF:2A"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=192.168.1.31
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BOOTPROTO=static
前面三行是系統睚帶的,后面就是手動添加的。
這樣設置扣,記得重啟網卡:
[root@localhost ~]# /etc/init.d/network stop
[root@localhost ~]# /etc/init.d/network start
行了,現在就可以PING得通網關了,如果還得上網,不必須設置DNS。設置DNS就詳見步驟2
步驟2、修改dns
[root@localhost ~]# vi /etc/resolv.conf
在里面添加二個dns:
nameserver 202.96.134.133
nameserver 8.8.8.8
ok,大攻告成,即可上網了!!!!