虚拟机centos系统,停机装第二块网卡,需要更改的配置

虚拟机centos系统,停机装第二块网卡,需要更改的配置。

 

问题描述: 虚拟机centos系统,停机装第二块网卡,发现  /etc/sysconfig/network-scripts/ifcfg-eth1 不存在。但 ifconfig 能够看到  eth1  中的  HWaddr  值。

[root@11gnode1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:06:C9:21
inet addr:10.100.25.8 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::20c:29ff:fe06:c921/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:48 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5343 (5.2 KiB) TX bytes:5265 (5.1 KiB)

eth1 Link encap:Ethernet HWaddr 00:0C:29:06:C9:2B
inet addr:11.101.26.129 Bcast:11.101.26.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe06:c92b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1772 (1.7 KiB) TX bytes:2366 (2.3 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 b) TX bytes:240 (240.0 b)

 

 

[root@11gnode1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
[root@11gnode1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
cat: /etc/sysconfig/network-scripts/ifcfg-eth1: No such file or directory

 

解决办法: 经过实践,虚拟机centos系统,停机装第二块网卡,需要人工手动创建 eth1 文件。

1. 创建 eth1 文件,并根据  ifconfig 结果中的  HWADDR 值编辑文件。

[root@11gnode1 ~]# touch /etc/sysconfig/network-scripts/ifcfg-eth1
[root@11gnode1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

2. 查看验证。
[root@11gnode1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth1
BOOTPROTO=static
BROADCAST=11.255.255.255
HWADDR=00:0C:29:06:C9:2B
IPADDR=11.101.26.8
NETMASK=255.0.0.0
NETWORK=11.0.0.0
ONBOOT=yes

[root@11gnode1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:06:C9:21
inet addr:10.100.25.8 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::20c:29ff:fe06:c921/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:466 errors:0 dropped:0 overruns:0 frame:0
TX packets:263 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:38918 (38.0 KiB) TX bytes:39087 (38.1 KiB)

eth1 Link encap:Ethernet HWaddr 00:0C:29:06:C9:2B
inet addr:11.101.26.8 Bcast:11.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::20c:29ff:fe06:c92b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:118 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13188 (12.8 KiB) TX bytes:11382 (11.1 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)

posted on 2017-02-20 22:47  张冲andy  阅读(1138)  评论(0编辑  收藏  举报

导航