我尝试通过以太网线共享我的互联网连接。但没有成功。
但现在我无法通过以太网上网。
我执行了这个命令:
sudo ifconfig enp2s0f1 169.254.82.80
ifconfig 的结果是这样的:
enp2s0f1 Link encap:Ethernet HWaddr 2c:56:dc:80:9a:3e
inet addr:169.254.64.195 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::2e56:dcff:fe80:9a3e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:126 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:8640 (8.6 KB)
enp2s0f1:avahi Link encap:Ethernet HWaddr 2c:56:dc:80:9a:3e
inet addr:169.254.8.45 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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:5145 errors:0 dropped:0 overruns:0 frame:0
TX packets:5145 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:644032 (644.0 KB) TX bytes:644032 (644.0 KB)
wlp3s0 Link encap:Ethernet HWaddr 80:a5:89:50:f5:0d
inet addr:100.64.194.17 Bcast:100.64.223.255 Mask:255.255.224.0
inet6 addr: 2001:67c:1220:c190:cc59:999:f43f:c2d5/64 Scope:Global
inet6 addr: fe80::82a5:89ff:fe50:f50d/64 Scope:Link
inet6 addr: 2001:67c:1220:c190:82a5:89ff:fe50:f50d/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1280 Metric:1
RX packets:58488 errors:0 dropped:0 overruns:0 frame:0
TX packets:15426 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19185577 (19.1 MB) TX bytes:2154035 (2.1 MB)
我该怎么做以及如何解决这个问题?
答案1
169.254.82.80 是 Windows 在无法获取其他 IP 时分配的不可路由 IP。它几乎毫无用处。而您将这个无用的 IP 169.254.82.80 分配给了您的 enp2s0f1 接口。此分配不是持久的,因此重启后一切将恢复如初。或者(假设您通过无线连接到互联网)只需关闭并打开接口sudo ifdown enp2s0f1 && sudo ifup enp2s0f1