一、centos6.x
[root@template ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.52
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
DNS1=192.168.1.1
DNS2=114.114.114.114
#刪除uuid 和 mac adder
[root@template ~]# >/etc/udev/rules.d/70-persistent-net.rules
#更改主機名稱
[root@template ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=web01
root@template ~]# hostname web01