手动设定IP、DNS只需要修改三个文件就可以了
1、/etc/sysconfig/network
$ vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
GATEWAY=192.168.1.1 //加上网关
2、/etc/sysconfig/network-scripts/ifcfg-eth0
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none //启动为手动
BROADCAST=192.168.1.255
HWADDR=00:16:D3:A2:F6:09
IPADDR=192.168.1.108 //设置的IP
NETMASK=255.255.255.0 //子网掩码
NETWORK=192.168.1.0
IPV6INIT=yes
IPV6_AUTOCONF=yes
ONBOOT=yes
TYPE=Ethernet //网络类型
3、/etc/resolv.conf
$ vi /etc/resolv.conf
nameserver 116.228.111.118 //加上主DNS
nameserver 180.168.255.18 //加上次DNS
网友评论