Linux/CentOS设置ip地址及DNS

1.设置静态ip地址:

nano /etc/sysconfig/network-scripts/ifcfg-eth0(可能会有多个网卡eth0,eth1,eth2)

DEVICE=eth0
BOOTPROTO=static
HWADDR=00:F1:F3:01:15:4A
ONBOOT=yes
DHCP_HOSTNAME=ehangpc
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.0.123
GATEWAY=192.168.0.1

2.设置DNS:

nano /etc/resolv.conf

nameserver 202.96.126.165
nameserver 202.96.134.133

3.重启网络服务使配置生效:

service network restart

猜你喜欢

转载自mars-lm.iteye.com/blog/1158627