虛擬機器centos系統,停機裝第二塊網路卡,需要更改的配置

張衝andy發表於2017-02-20

虛擬機器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)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2133998/,如需轉載,請註明出處,否則將追究法律責任。

相關文章