虚拟机Linux无法识别网卡

时间:2022-12-24 13:41:50

解决办法一:


[root@rac1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:0C:8A:B4  
  。。。。。。。。。。。。。。。

          inet6 addr: fe80::20c:29ff:fe0c:8ab4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:182 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12402 (12.1 KiB)  TX bytes:2935 (2.8 KiB)
          Interrupt:185 Base address:0x1480

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:16436  Metric:1
          RX packets:3960 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3960 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5208396 (4.9 MiB)  TX bytes:5208396 (4.9 MiB)

[root@rac1 ~]# cd /etc/sysconfig/network-scripts/
[root@rac1 network-scripts]# ls
ifcfg-eth0      ifdown-isdn   ifup-ib     ifup-plusb     init.ipv6-global
ifcfg-lo        ifdown-post   ifup-ippp   ifup-post      network-functions
ifdown          ifdown-ppp    ifup-ipsec  ifup-ppp       network-functions-ipv6
ifdown-aliases  ifdown-sit    ifup-ipv6   ifup-routes
ifdown-ippp     ifdown-sl     ifup-ipx    ifup-sit
ifdown-ipsec    ifup          ifup-isdn   ifup-sl
ifdown-ipv6     ifup-aliases  ifup-plip   ifup-wireless
[root@rac1 network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[root@rac1 network-scripts]# vi ifcfg-eth1

DEVICE=eth1
BOOTPROTO=none
HWADDR=00:0c:29:0c:8a:be
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.2.101
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=192.168.2.1
~
~
~
~
~
~
~
~
~
~
~
~
"ifcfg-eth1" 11L, 175C written                               
[root@rac1 network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:0C:8A:B4  
         。。。。。。。。。。。。。。。。。。。。

          inet6 addr: fe80::20c:29ff:fe0c:8ab4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:81252 (79.3 KiB)  TX bytes:28105 (27.4 KiB)
          Interrupt:185 Base address:0x1480

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:16436  Metric:1
          RX packets:7057 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7057 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9647576 (9.2 MiB)  TX bytes:9647576 (9.2 MiB)

[root@rac1 network-scripts]# service network restart
Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Setting network parameters:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0: 
[  OK  ]
Bringing up interface eth1: 
通过上面的办法,eth1添加上了,但有了新的问题,eht0ping不通了。

方法二:

通过system-config-network命令,然后在图形界面新建网卡的方法:

 

虚拟机Linux无法识别网卡

 

虚拟机Linux无法识别网卡

虚拟机Linux无法识别网卡


同样能够添加到网卡,也能成功启动,但是在eth1启动后,eth0将无法访问。

 

最后用在和eth0同一网段的机器访问该虚拟机,发现访问正常,至此,可以判断上述两种添加方法都可用,造成无法访问的原因是某些网络方面的限制。