![无法通过以太网(使用 pppoe)连接到互联网,但可以通过 wi-fi 连接](https://linux22.com/image/994235/%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%E4%BB%A5%E5%A4%AA%E7%BD%91%EF%BC%88%E4%BD%BF%E7%94%A8%20pppoe%EF%BC%89%E8%BF%9E%E6%8E%A5%E5%88%B0%E4%BA%92%E8%81%94%E7%BD%91%EF%BC%8C%E4%BD%86%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%20wi-fi%20%E8%BF%9E%E6%8E%A5.png)
我正在使用 Ubuntu 16.04,无法通过以太网连接到互联网。我可以通过无线网络连接。我还使用 Windows 10 双启动,并且我可以在 Windowsm 上使用 pppoe 连接通过以太网通过这两种方法进行连接。
$ ifconfig
enp4s0f1 Link encap:Ethernet HWaddr d0:17:c2:07:ef:39
inet6 addr: fe80::e67d:6fbb:5a45:c0f2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:475 errors:0 dropped:0 overruns:0 frame:0
TX packets:874 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58686 (58.6 KB) TX bytes:158070 (158.0 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:841 errors:0 dropped:0 overruns:0 frame:0
TX packets:841 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:91232 (91.2 KB) TX bytes:91232 (91.2 KB)
wlp3s0 Link encap:Ethernet HWaddr 74:c6:3b:11:3e:f7
inet addr:192.168.185.101 Bcast:192.168.185.255 Mask:255.255.255.0
inet6 addr: fe80::8d65:aaae:789a:fab8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:422545 errors:0 dropped:0 overruns:0 frame:0
TX packets:170091 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:627525820 (627.5 MB) TX bytes:17005893 (17.0 MB)
以下是我的/etc/网络/接口文件:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
运行结果系统配置:
`enp4s0f1 no wireless extensions.
lo no wireless extensions.
wlp3s0 IEEE 802.11bgn ESSID:"...."
Mode:Managed Frequency:2.462 GHz Access Point: 82:B9:A5:DB:36:8F
Bit Rate=65 Mb/s Tx-Power=16 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=63/70 Signal level=-47 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:3 Invalid misc:342 Missed beacon:0.
的结果lspci -nnk | grep -iEA3“(网络|无线|以太网)”
03:00.0 Network controller [0280]: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter [168c:0036] (rev 01)
Subsystem: AzureWave QCA9565 / AR9565 Wireless Network Adapter [1a3b:2130]
Kernel driver in use: ath9k
Kernel modules: ath9k
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device [10ec:5287] (rev 01)
--
04:00.1 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 12)
Subsystem: ASUSTeK Computer Inc. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [1043:200f]
Kernel driver in use: r8169
Kernel modules: r8169
的结果猫/etc/dhcp/dhclient.conf
# Configuration file for /sbin/dhclient.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
# man page for more information about the syntax of this file
# and a more comprehensive list of the parameters understood by
# dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
# not leave anything out (like the domain name, for example), then
# few changes must be made to this file, if any.
#
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
#require subnet-mask, domain-name-servers;
timeout 300;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/sbin/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;
#alias {
# interface "eth0";
# fixed-address 192.5.5.213;
# option subnet-mask 255.255.255.255;
#}
#lease {
# interface "eth0";
# fixed-address 192.33.137.200;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.33.137.255;
# option routers 192.33.137.250;
# option domain-name-servers 127.0.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
#}
我尝试了在互联网上找到的各种方法来解决这个问题,例如添加
auto enp4s0f1 iface enp4s0f1
、忽略 IPv6 等sudo service network-manager restart
。
我最近重新安装了 Ubuntu。
我已经测试了来自不同路由器的多条以太网电缆,但都不起作用。正如所说,它在 Windows 上运行良好。
编辑:sudo dhclient -v -r
以下是和的结果sudo dhclient -v
~$ sudo dhclient -v -r enp4s0f1
Killed old client process
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https:*no space for this link :D*
Listening on LPF/enp4s0f1/d0:17:c2:07:ef:39
Sending on LPF/enp4s0f1/d0:17:c2:07:ef:39
Sending on Socket/fallback
~$ sudo dhclient -v enp4s0f1
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp4s0f1/d0:17:c2:07:ef:39
Sending on LPF/enp4s0f1/d0:17:c2:07:ef:39
Sending on Socket/fallback
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 3 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 7 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 16 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 19 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 21 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 16 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 21 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 7 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 9 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 11 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 11 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 11 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 16 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 10 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 15 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 14 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 14 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 21 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 20 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 19 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 8 (xid=0x9dffd378)
DHCPDISCOVER on enp4s0f1 to 255.255.255.255 port 67 interval 12 (xid=0x9dffd378)
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
有关我的互联网状态的图像(来自网络管理器):https://i.stack.imgur.com/1A6sO.jpg
我是 Linux 新手,无法解决这个问题。如果可能的话,请提供详细答案。谢谢!
答案1
您的以太网端口使用的 r8169 驱动程序存在错误。您需要使用该r8168-dkms
驱动程序。
要安装它,请从 Unity dash 启动 Synaptic。单击 RELOAD 图标,然后单击 SEARCH 图标,输入r8168-dkms
,在结果窗格中,将此项目标记为要安装,单击 APPLY 图标。如果它想要/需要也安装dkms
,请批准它。
您可能还希望查看如何使用有线 PPPOE 连接上网?了解更多信息。
请告诉我们您的情况。干杯,Al
答案2
enp4s0f1(有线接口)没有 IP4 地址,而 wlp3s0(无线接口)有。也许这就是您遇到困难的根源。
请注意,此答案与版本/驱动程序无关。在 14.04 下使用 atl1c 驱动程序进行测试,在 16.04 下使用 r8169 驱动程序进行测试
首先确保网络管理器设置为接收 IP4 地址:打开网络连接选择您的以太网连接并单击编辑。根据需要进行更改,使其在 IPV4 设置选项卡上显示如下:方法是重要的部分(复选框也不会受到影响)
单击“保存”,然后“关闭” - 然后在终端中发出以下命令
sudo dhclient -v -r enp4s0f1
sudo dhclient -v enp4s0f1
作为替代方法,您可以将方法更改为手动并使用以下形式的静态 IP 地址192.168.185.x
(其中 x 是您网络上的地址,而不是由路由器 dhcp 池提供的地址)
资料来源:
http://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/
测试