我刚开始使用 Linux Mint 连接以太网,WiFi 工作正常。但我遇到了很多错误。经过两天的搜索,我无法连接。
$ uname -a
Linux 'username' 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
使用“方法”自动 DHCP,以下是输出ifconfig
$ ifconfig
enp3s0 Link encap:Ethernet HWaddr 54:ee:75:79:b7:1f
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:1760 errors:0 dropped:8 overruns:0 frame:0
TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:147427 (147.4 KB) TX bytes:17994 (17.9 KB)
Interrupt:43 Base address:0xd000
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:4120 errors:0 dropped:0 overruns:0 frame:0
TX packets:4120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:341414 (341.4 KB) TX bytes:341414 (341.4 KB)
wlp2s0 Link encap:Ethernet HWaddr 78:0c:b8:d6:62:da
inet addr:192.168.43.121 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::e842:14d2:88e2:1321/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16271 errors:0 dropped:0 overruns:0 frame:0
TX packets:13247 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19535354 (19.5 MB) TX bytes:1753988 (1.7 MB)
同样这样, Wire 永远不会显示Connected
,而是显示Connecting...
。
然后我将其更改为手动,详细信息如附图所示:
然后我执行pppoeconf
命令,它执行时没有错误。
这是输出ifconfig
enp3s0 Link encap:Ethernet HWaddr 54:ee:75:79:b7:1f
inet addr:192.168.43.121 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::56ee:75ff:fe79:b71f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1863 errors:0 dropped:9 overruns:0 frame:0
TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:157640 (157.6 KB) TX bytes:25158 (25.1 KB)
Interrupt:43 Base address:0xd000
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:4485 errors:0 dropped:0 overruns:0 frame:0
TX packets:4485 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:370644 (370.6 KB) TX bytes:370644 (370.6 KB)
wlp2s0 Link encap:Ethernet HWaddr 78:0c:b8:d6:62:da
inet addr:192.168.43.121 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::e842:14d2:88e2:1321/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:91264 errors:0 dropped:0 overruns:0 frame:0
TX packets:61200 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:126022999 (126.0 MB) TX bytes:7032850 (7.0 MB)
$ netstat -rn
$ natstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.43.0 0.0.0.0 255.255.255.0 U 0 0 0 enp3s0
$路线
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.43.0 * 255.255.255.0 U 100 0 0 enp3s0
$ cat /etc/网络/接口
$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto dsl-provider
iface dsl-provider inet ppp
pre-up /bin/ip link set enp3s0 up # line maintained by pppoeconf
provider dsl-provider
auto enp3s0
iface enp3s0 inet static
address 192.168.43.121
netmask 255.255.255.0
network 192.168.43.0
bradcast 192.168.43.255
gateway 192.168.43.1
$猫/etc/resolv.conf
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
$ping 127.0.1.1
$ ping 127.0.1.1
PING 127.0.1.1 (127.0.1.1) 56(84) bytes of data.
64 bytes from 127.0.1.1: icmp_seq=1 ttl=64 time=0.071 ms
64 bytes from 127.0.1.1: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 127.0.1.1: icmp_seq=3 ttl=64 time=0.062 ms
64 bytes from 127.0.1.1: icmp_seq=4 ttl=64 time=0.062 ms
64 bytes from 127.0.1.1: icmp_seq=5 ttl=64 time=0.029 ms
^C
--- 127.0.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4083ms
rtt min/avg/max/mdev = 0.029/0.057/0.071/0.014 ms
$ ping google.com
$ ping google.com
ping: unknown host google.com
$平192.168.43.1
$ ping 192.168.43.1
PING 192.168.43.1 (192.168.43.1) 56(84) bytes of data.
From 192.168.43.121 icmp_seq=1 Destination Host Unreachable
From 192.168.43.121 icmp_seq=2 Destination Host Unreachable
From 192.168.43.121 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.43.1 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4100ms
pipe 4
我什至尝试使用 google.com 的 IP 地址进行 ping 操作
$ ping 172.217.10.110
connect: Network is unreachable
更新:
这个有用吗?在其中一个答案建议后,我尝试了
$ sudo ip r a default via 192.168.43.1
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.43.1 0.0.0.0 UG 0 0 0 enp3s0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp3s0
192.168.43.0 0.0.0.0 255.255.255.0 U 0 0 0 enp3s0
我用名称 ping google.com:
$ ping google.com
ping: unknown host google.com
与 IP 地址:
$ ping 172.217.10.110
PING 172.217.10.110 (172.217.10.110) 56(84) bytes of data.
From 192.168.43.121 icmp_seq=1 Destination Host Unreachable
From 192.168.43.121 icmp_seq=2 Destination Host Unreachable
From 192.168.43.121 icmp_seq=3 Destination Host Unreachable
^C
--- 172.217.10.110 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4078ms
pipe 4
请让我知道如何解决这个问题。
答案1
您没有默认网关:
ip r a default via 192.168.43.1
也没有解析器,因为 - 我猜你在 127.0.1.1 上没有运行 DNS 服务:
echo nameserver 8.8.8.8 >> /etc/resolv.conf
答案2
转到顶部的有线设置,其中有 wifi 符号,您将被重定向到网络设置,单击以太网的设置符号,然后删除配置文件,然后创建新的配置文件并编辑 ipv4 设置,将以下内容添加到 dns 8.8。 8.8, 8.8.4.4 '确保设置为 dhcp(自动)
这对我有用
答案3
我遇到过这个问题,但当我检查可用的网络接口时,我意识到我的以太网接口没有获得 ipv4 地址。即使我使用 为有线以太网连接分配了静态 IP 地址nm-connection-editor
,nm-tui
也没有激活以太网连接,而是引发了IP configuration could not be reserved (no available address, timeout, etc.)
错误。无论如何,我通过 观察了网络接口watch -n 1 ip addr show eno1
,然后在摆弄以太网电缆的另一端(即路由器)后,发现其网络 LAN 的 DHCP 端口服务在我的电缆所连接的端口之一停止。取消选中相应端口的复选框后,接口将获得 ipv4 地址,从而获得网络连接。至少在本地,然后是全球。