#修改网卡配置文件
$ cd /etc/sysconfig/network-scripts/
$ vi ifcfg-eth0
#修改网卡对应的名称
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
#修改对应的IP
IPADDR=192.168.1.20
NETMASK=255.255.255.0
如图所示,删除 红色标记部分,并按上边配置修改
5、修改 系统网卡配置
$ vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single# line, and change only the value of the NAME= key.# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8a:00:b9", ATTR{type}
=="1", KERNEL=="eth*", NAME="eth0"#保存退出
如图所示,删除 红色标记部分,并将 ×××标记部分改为eth0,保存退出
6、最后修改 主机名和IP的映射关系
#修改主机名
$ vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mini2
#修改IP的映射关系
$ vi /etc/hosts
192.168.1.20 mini2
#重新启动
$ reboot