ip地址配置文件 vi /etc/sysconfig/network-scripts/ifcfg-eth0

内容

DEVICE="eth0"

BOOTPROTO="static"

HWADDR="00:0C:29:96:08:F0"

IPADDR=192.168.1.151

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

NM_CONTROLLED="yes"

ONBOOT="yes"

TYPE="Ethernet"

UUID="b2479135-8f5d-4633-b898-6155c4ef2650"

重启服务器 /etc/init.d/network restart



dns配置文件 vi /etc/resolv.conf


# Generated by NetworkManager



# No nameservers found; try putting DNS servers into your

# ifcfg files in /etc/sysconfig/network-scripts like so:

#

# DNS1=xxx.xxx.xxx.xxx

# DNS2=xxx.xxx.xxx.xxx

# DOMAIN=lab.foo.com bar.foo.com

nameserver 8.8.8.8


直接生效