问题:
为虚拟机添加新网卡后,/etc/sysconfig/network-scripts/下无配置文件ifcfg-eth1
#ip addr //显示存在eth1
#ip addr
eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:17:29:66 brd ff:ff:ff:ff:ff:ff
inet 192.168.192.135/24 brd 192.168.192.255 scope global dynamic eth1
valid_lft 1482sec preferred_lft 1482sec
inet6 fe80::20c:29ff:fe17:2966/64 scope link
valid_lft forever preferred_lft forever
解决:
#cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
#vim /etc/sysconfig/network-scripts/ifcfg-eth1
HWADDR=00:0C:29:17:29:66 #修改为eth1的mac地址
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=no
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth1 #修改为eth1
#UUID=93285a79-5ad6-4d55-ae5a-b417ce7f4d31 #注释掉
ONBOOT=yes
#service network restart