2024 桐庐半程马拉松
00:00:00
时间
0.00
距离(公里)
--:--
配速
--
步频
--
心率 (bpm)
--
配速
步频
|
share-image
ESC

Ubuntu新增网卡无法获取IP

Ubuntu server 新添加一个虚拟网卡,发现默认不显示 IP

root@ubuntu:/etc/udev/rules.d# ifconfig -a
ens33 Link encap:Ethernet HWaddr 00:0c:29:de:e9:be
inet addr:192.168.1.144 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fede:e9be/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2688 errors:0 dropped:0 overruns:0 frame:0
TX packets:2463 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 TXqueuelen:1000
RX bytes:273797 (273.7 KB) TX bytes:256048 (256.0 KB)

ens38 Link encap:Ethernet HWaddr 00:0c:29:de:e9:c8
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)

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:2207 errors:0 dropped:0 overruns:0 frame:0
TX packets:2207 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 TXqueuelen:1
RX bytes:197918 (197.9 KB) TX bytes:197918 (197.9 KB)

解决办法

编辑

root@ubuntu:/etc/udev/rules.d# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet dhcp
auto ens38
iface ens38 inet dhcp

重启网卡

fwj@ubuntu:~$ ifconfig
ens33 Link encap:Ethernet HWaddr 00:0c:29:de:e9:be
inet addr:192.168.1.144 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fede:e9be/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:74 errors:0 dropped:0 overruns:0 frame:0
TX packets:90 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8685 (8.6 KB) TX bytes:10695 (10.6 KB)

ens38 Link encap:Ethernet HWaddr 00:0c:29:de:e9:c8
inet addr:172.10.100.131 Bcast:172.10.100.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fede:e9c8/64 Scope:Link
inet6 addr: fd15:4ba5:5a2b:1008:20c:29ff:fede:e9c8/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1354 (1.3 KB) TX bytes:1452 (1.4 KB)

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:222 errors:0 dropped:0 overruns:0 frame:0
TX packets:222 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:22102 (22.1 KB) TX bytes:22102 (22.1 KB)
文章作者:阿文
文章链接: https://www.awen.me/post/1995361525.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿文的博客
本文于 2017-07-08 发布,已超过半年(3127天),请注意甄别内容是否已过期。