我想按照一些建议通过关闭然后打开来刷新网络接口以获取 DNS 更新。我使用以下方式列出了设备中的接口:ifconfig -a
。我有 3 个接口,我关心的是有线接口。输出为(用 xx 省略硬件地址):
x@x-device:~$ ifconfig
enp0s31f6 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:172.17.72.13 Bcast:172.17.79.255 Mask:255.255.240.0
inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:61239 errors:0 dropped:0 overruns:0 frame:0
TX packets:55609 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26493098 (26.4 MB) TX bytes:7035908 (7.0 MB)
Interrupt:16 Memory:ef200000-ef220000
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:1558 errors:0 dropped:0 overruns:0 frame:0
TX packets:1558 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:138063 (138.0 KB) TX bytes:138063 (138.0 KB)
wlp2s0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
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)
然后我运行命令:
sudo ifdown enp0s31f6 && sudo ifup enp0s31f6
但输出:
Unknown interface enp0s31f6
问题是什么?
答案1
你可以试试:
ip link set up dev enp0s31f6
然后运行 dhcp-client 或手动设置 IP
man ip