ifconfig down 后重新启动网络适配器

ifconfig down 后重新启动网络适配器

当我尝试恢复我的网络适配器ifconfig up后,ifconfig down我的互联网无法恢复。我必须重新连接到路由器才能重新启动它。为什么会发生这种情况?

$ cat /etc/network/interfaces

interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

$ ifconfig -a

enp19s0   Link encap:Ethernet  HWaddr a4:ba:db:d0:39:b8  
          UP 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:5185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5185 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:473578 (473.5 KB)  TX bytes:473578 (473.5 KB)

wlp18s0   Link encap:Ethernet  HWaddr c4:46:19:95:3b:0b  
          inet addr:192.168.5.4  Bcast:192.168.5.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:60325 errors:0 dropped:0 overruns:0 frame:39880
          TX packets:34063 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:72845485 (72.8 MB)  TX bytes:2924887 (2.9 MB)
          Interrupt:17 

$ netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.5.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp18s0

答案1

您需要选择如何管理连接,可以手动使用 ifup ifdown 等... 或通过网络管理器管理,如 @XtrmJosh 所暗示的。如果您希望自己管理并通过 DHCP 获取 IP,请将以下内容添加到您的/etc/network/interfaces文件中

auto enp19s0
iface enp19s0 inet dhcp

相关内容