ifconfig eth0 eth0: error fetching interface information: Device not found

左手的ㄟ右手 2022-09-19 10:39 390阅读 0赞

露珠在BT5虚拟机中使用ifconfig后发现只有lo网卡,其他网卡都没有显示。

如下:

root@bt:~# ifconfig

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:54 errors:0 dropped:0 overruns:0 frame:0
TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12741 (12.7 KB) TX bytes:12741 (12.7 KB)

这时用ifconfig -a命令查看有多少网卡。这下就看到了eth3

root@bt:~# ifconfig -a
eth3 Link encap:Ethernet HWaddr 00:0c:29:ac:3c:2a
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:19 Base address:0x2000

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:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:16565 (16.5 KB) TX bytes:16565 (16.5 KB)

然后直接给eth3设置ip和子网掩码。

root@bt:~# ifconfig eth3 10.10.10.128 netmask 255.255.255.0

设置成功,再看一下网卡:

root@bt:~# ifconfig -a
eth3 Link encap:Ethernet HWaddr 00:0c:29:ac:3c:2a //有了,哈哈!
inet addr:10.10.10.128 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feac:3c2a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:238 (238.0 B)
Interrupt:19 Base address:0x2000

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:85 errors:0 dropped:0 overruns:0 frame:0
TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22421 (22.4 KB) TX bytes:22421 (22.4 KB)

ping一下……

root@bt:~# ping 10.10.10.130
PING 10.10.10.130 (10.10.10.130) 56(84) bytes of data.
64 bytes from 10.10.10.130: icmp_seq=1 ttl=128 time=0.583 ms
64 bytes from 10.10.10.130: icmp_seq=2 ttl=128 time=0.278 ms
64 bytes from 10.10.10.130: icmp_seq=3 ttl=128 time=0.662 ms
^C
-— 10.10.10.130 ping statistics —-
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.278/0.507/0.662/0.167 ms

root@bt:~#

问题解决!

发表评论

表情:
评论列表 (有 0 条评论,390人围观)

还没有评论,来说两句吧...

相关阅读