以太网卡连不上网

最大的社区版本,Ubuntu的发源地
回复
yangdawei.hit
帖子: 245
注册时间: 2015-01-02 15:32
系统: Debian

以太网卡连不上网

#1

帖子 yangdawei.hit » 2015-09-20 6:58

系统:Debian
桌面:Xfce4

现象:无线上网正常,换成有线网时始终连不上。状态栏中的网络图标一直显示正在连接。
检查:

代码: 全选

ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:9e:01:89:a2:24  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:840 errors:0 dropped:805 overruns:0 frame:0
          TX packets:234 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:53752 (52.4 KiB)  TX bytes:51305 (50.1 KiB)

代码: 全选

lspci | grep -i Ethernet
09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)
请教如何修复以太网卡连下上网。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 以太网卡连不上网

#2

帖子 poloshiao » 2015-09-20 7:04

把下面指令 複製 貼進終端機 執行
0. uname -r
1. sudo lspci -knn
2. sudo lshw -numeric -class network
3. sudo ifconfig -a
4. sudo route -nv
5. sudo dhclient -v
6. sudo cat /etc/network/interfaces
把結果直接 選取/複製/貼上來
yangdawei.hit
帖子: 245
注册时间: 2015-01-02 15:32
系统: Debian

Re: 以太网卡连不上网

#3

帖子 yangdawei.hit » 2015-09-20 7:20

0. uname -r
3.16.0-4-amd64
sudo lspci -knn
00:00.0 Host bridge [0600]: Intel Corporation 3rd Gen Core processor DRAM Controller [8086:0154] (rev 09)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: ivb_uncore
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port [8086:0151] (rev 09)
Kernel driver in use: pcieport
00:02.0 VGA compatible controller [0300]: Intel Corporation 3rd Gen Core processor Graphics Controller [8086:0166] (rev 09)
Subsystem: Lenovo Device [17aa:500d]
Kernel driver in use: i915
00:14.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller [8086:1e31] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: xhci_hcd
00:16.0 Communication controller [0780]: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 [8086:1e3a] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: mei_me
00:1a.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 [8086:1e2d] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: ehci-pci
00:1b.0 Audio device [0403]: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller [8086:1e20] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: snd_hda_intel
00:1c.0 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 [8086:1e10] (rev c4)
Kernel driver in use: pcieport
00:1c.1 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 [8086:1e12] (rev c4)
Kernel driver in use: pcieport
00:1c.2 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 3 [8086:1e14] (rev c4)
Kernel driver in use: pcieport
00:1c.3 PCI bridge [0604]: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 4 [8086:1e16] (rev c4)
Kernel driver in use: pcieport
00:1d.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 [8086:1e26] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: ehci-pci
00:1f.0 ISA bridge [0601]: Intel Corporation UM77 Express Chipset LPC Controller [8086:1e58] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: lpc_ich
00:1f.2 IDE interface [0101]: Intel Corporation 7 Series Chipset Family 4-port SATA Controller [IDE mode] [8086:1e01] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: ata_piix
00:1f.3 SMBus [0c05]: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller [8086:1e22] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
00:1f.5 IDE interface [0101]: Intel Corporation 7 Series Chipset Family 2-port SATA Controller [IDE mode] [8086:1e09] (rev 04)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: ata_piix
01:00.0 3D controller [0302]: NVIDIA Corporation GF117M [GeForce 610M/710M/820M / GT 620M/625M/630M/720M] [10de:1140] (rev a1)
Subsystem: Lenovo GeForce GT 620M [17aa:500d]
Kernel driver in use: nouveau
03:00.0 Network controller [0280]: Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter [14e4:4727] (rev 01)
Subsystem: Broadcom Corporation Device [14e4:0608]
Kernel driver in use: bcma-pci-bridge
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader [10ec:5209] (rev 01)
Subsystem: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader [10ec:5209]
Kernel driver in use: rtsx_pci
04:00.1 SD Host controller [0805]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader [10ec:5209] (rev 01)
Subsystem: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader [10ec:5209]
Kernel driver in use: sdhci-pci
09:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 07)
Subsystem: Lenovo Device [17aa:500c]
Kernel driver in use: r8169
sudo lshw -numeric -class network
*-network
description: Network controller
product: BCM4313 802.11bgn Wireless Network Adapter [14E4:4727]
vendor: Broadcom Corporation [14E4]
physical id: 0
bus info: pci@0000:03:00.0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: driver=bcma-pci-bridge latency=0
resources: irq:17 memory:f4700000-f4703fff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10EC:8168]
vendor: Realtek Semiconductor Co., Ltd. [10EC]
physical id: 0
bus info: pci@0000:09:00.0
logical name: eth0
version: 07
serial: 08:9e:01:89:a2:24
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:42 ioport:3000(size=256) memory:f3c04000-f3c04fff memory:f3c00000-f3c03fff
*-network
description: Wireless interface
physical id: 1
logical name: wlan0
serial: 2c:d0:5a:b2:10:ca
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=brcmsmac driverversion=3.16.0-4-amd64 firmware=610.812 ip=192.168.3.2 link=yes multicast=yes wireless=IEEE 802.11bgn
sudo ifconfig -a
eth0 Link encap:Ethernet HWaddr 08:9e:01:89:a2:24
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1241 errors:0 dropped:1206 overruns:0 frame:0
TX packets:254 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:79416 (77.5 KiB) TX bytes:59145 (57.7 KiB)

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:1541 errors:0 dropped:0 overruns:0 frame:0
TX packets:1541 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:229213 (223.8 KiB) TX bytes:229213 (223.8 KiB)

wlan0 Link encap:Ethernet HWaddr 2c:d0:5a:b2:10:ca
inet addr:192.168.3.2 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::2ed0:5aff:feb2:10ca/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:114522 errors:0 dropped:1 overruns:0 frame:0
TX packets:95214 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:121030689 (115.4 MiB) TX bytes:13389236 (12.7 MiB)
sudo route -nv
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 303 0 0 wlan0
0.0.0.0 192.168.3.1 0.0.0.0 UG 1024 0 0 wlan0
169.254.54.174 127.0.0.1 255.255.255.255 UGH 202 0 0 lo
192.168.3.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.3.2 127.0.0.1 255.255.255.255 UGH 303 0 0 lo
sudo dhclient -v
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/2c:d0:5a:b2:10:ca
Sending on LPF/wlan0/2c:d0:5a:b2:10:ca
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.3.1
DHCPACK from 192.168.3.1
RTNETLINK answers: File exists
bound to 192.168.3.2 -- renewal in 34506 seconds.
sudo cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 以太网卡连不上网

#4

帖子 poloshiao » 2015-09-20 8:19

sudo lshw -numeric -class network
product: BCM4313 802.11bgn Wireless Network Adapter [14E4:4727]
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10EC:8168]
description: Wireless interface
1. network-manager 預設 同一個時間只能有一條 route 有效
意思是 同一時間 有線/無線 網卡 只能有一個成功連上網路 其它待機中
1-1. 要測試有線網卡 先把無線網卡關閉 以免無線網卡干擾
product: BCM4313 802.11bgn Wireless Network Adapter [14E4:4727]
physical id: 0
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10EC:8168]
physical id: 0
2. 有線/無線網卡 都是 physical id: 0
明顯錯誤
可能原因 不合適驅動模組
product: BCM4313 802.11bgn Wireless Network Adapter [14E4:4727]
configuration: driver=bcma-pci-bridge latency=0
description: Wireless interface
configuration: broadcast=yes driver=brcmsmac
3. 如果只有一個 無線網卡 BCM4313
明顯是 兩個 驅動模組 bcma-pci-bridge brcmsmac 競爭 造成的錯誤
3-1. 參閱
search.php?keywords=BCM4313+bcma-pci-br ... C%E5%B0%8B
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10EC:8168]
configuration: autonegotiation=on broadcast=yes driver=r8169
4. 驅動 r8169 不是 RTL8111/8168/8411 合適驅動模組
4-1. 參閱
search.php?keywords=RTL8111+8168+8411+r ... C%E5%B0%8B

5. 建議
先把 無線網卡 關閉 安裝有線網卡合適驅動模組
再把 有線網卡 關閉 安裝無線網卡合適驅動模組
都測試好了 再考慮是否同時都打開 (不用的關閉)
yangdawei.hit
帖子: 245
注册时间: 2015-01-02 15:32
系统: Debian

Re: 以太网卡连不上网

#5

帖子 yangdawei.hit » 2015-09-20 9:54

尝试安装以太网卡驱动失败,详情如下。

1. 下载r8168-8.040.00http://www.realtek.com.tw/downloads/dow ... ERTL8118AS

2. 按README要求运行:

代码: 全选

sudo ./autorun.sh
报错如下:

代码: 全选

Check old driver and unload it.
Build the module and install
make[2]: *** No rule to make target 'clean'.  Stop.
make[1]: *** [clean] Error 2
make: *** [clean] Error 2
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 以太网卡连不上网

#6

帖子 poloshiao » 2015-09-20 10:24

Check old driver and unload it.
1. lsmod | grep r8169
看看 是否還在
1-1. 補充 如果還在 要先將 r8169 模組 卸載 或 列入 載入黑名單
重新開機 再執行
sudo ./autorun.sh
以免 r8169 干擾
yangdawei.hit
帖子: 245
注册时间: 2015-01-02 15:32
系统: Debian

Re: 以太网卡连不上网

#7

帖子 yangdawei.hit » 2015-09-20 12:23

在READMD中给出了安装要求:

代码: 全选

      
        - Kernel source tree (supported Linux kernel 2.6.x and 2.4.x)
        - For linux kernel 2.4.x, this driver supports 2.4.20 and latter.
        - Compiler/binutils for kernel compilation
检查已安装binutils。删除了/lib/modules/3.16.0-4-amd64,再次编译提示如下错误:

代码: 全选

find: `/lib/modules/3.16.0-4-amd64/kernel/drivers/net': No such file or directory

Check old driver and unload it.
Build the module and install
find: `/lib/modules/3.16.0-4-amd64/kernel/drivers/net': No such file or directory
make[2]: *** /lib/modules/3.16.0-4-amd64/build: No such file or directory.  Stop.
make[1]: *** [clean] Error 2
make: *** [clean] Error 2

头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 以太网卡连不上网

#8

帖子 vickycq » 2015-09-20 13:01

yangdawei.hit 写了:尝试安装以太网卡驱动失败,详情如下。

。。。
2. 按README要求运行:

代码: 全选

sudo ./autorun.sh
报错如下:

代码: 全选

Check old driver and unload it.
Build the module and install
make[2]: *** No rule to make target 'clean'.  Stop.
make[1]: *** [clean] Error 2
make: *** [clean] Error 2
r8168,不要编译安装,管理麻烦。直接到软件源安装 r8168-dkms
注意,Jessie中不知何故没有 r8168-dkms,可下载 sid 的包安装,没有一点问题:http://ftp.cn.debian.org/debian/pool/no ... -1_all.deb
上次由 vickycq 在 2015-09-20 14:02,总共编辑 1 次。
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 以太网卡连不上网

#9

帖子 poloshiao » 2015-09-20 13:58

r8168,不要编译安装,管理麻烦。直接到软件源安装 r8168-dkms
0. https://packages.debian.org/sid/all/r8168-dkms/filelist
/usr/src/r8168-8.040.00/Makefile
/usr/src/r8168-8.040.00/dkms.conf
/usr/src/r8168-8.040.00/r8168.h
/usr/src/r8168-8.040.00/r8168_asf.c
/usr/src/r8168-8.040.00/r8168_asf.h
/usr/src/r8168-8.040.00/r8168_dash.h
/usr/src/r8168-8.040.00/r8168_n.c
/usr/src/r8168-8.040.00/r8168_realwow.h
/usr/src/r8168-8.040.00/rtl_eeprom.c
/usr/src/r8168-8.040.00/rtl_eeprom.h
/usr/src/r8168-8.040.00/rtltool.c
/usr/src/r8168-8.040.00/rtltool.h
Debian 上的 r8168-dkms 是源碼 ?
dkms source for the r8168 network driver
不是二元碼 意思是 還是要編譯 ?
find: `/lib/modules/3.16.0-4-amd64/kernel/drivers/net': No such file or directory
1. 把下面指令 複製 貼進終端機 執行
1-1. sudo ls -al /lib/modules | grep 3.16.0-4-amd64
1-2. sudo ls -al /lib/modules/3.16.0-4-amd64 | grep kernel
1-3. sudo ls -al /lib/modules/3.16.0-4-amd64/kernel | grep drivers
1-4. sudo ls -al /lib/modules/3.16.0-4-amd64/kernel/drivers | grep net
1-5. sudo ls -al /lib/modules/3.16.0-4-amd64/kernel/drivers/net
把結果直接 選取/複製 貼上來
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 以太网卡连不上网

#10

帖子 vickycq » 2015-09-20 14:01

1.
先把无线网卡断开,再解决有线:
网线拔出,打开终端,输入

代码: 全选

sudo journalctl -f
滚动监视系统日志。
插入网线,令其连接,观察新产生的日志输出。这样才能定位问题出在哪一层:驱动问题?NM 问题?dhclient 问题?......
状态栏中的网络图标一直显示正在连接
看此时日志卡在哪里?
可以把插入网线后 新产生的日志输出 全发上来。

2.
r8169 驱动有时会产生诡异的问题。可安装 r8168

代码: 全选

wget http://ftp.cn.debian.org/debian/pool/non-free/r/r8168/r8168-dkms_8.040.00-1_all.deb
dpkg -i r8168-dkms_8.040.00-1_all.deb
注意,Jessie中不知何故没有 r8168-dkms,可下载 sid 的包安装,依赖干净,没有一点问题:http://ftp.cn.debian.org/debian/pool/no ... -1_all.deb
dkms 的好处是较为智能,内核升级无痛重编译。手动编译安装的就得自己费心。
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 以太网卡连不上网

#11

帖子 poloshiao » 2015-09-20 14:29

代码: 全选

wget http://ftp.cn.debian.org/debian/pool/non-free/r/r8168/r8168-dkms_8.040.00-1_all.deb
1. 下載後
sudo dpkg -c ~/temp/r8168-dkms_8.040.00-1_all.deb | grep src
-rw-r--r-- root/root 163 2015-06-23 18:57 ./usr/src/r8168-8.040.00/dkms.conf
-rw-r--r-- root/root 2810 2015-04-30 22:17 ./usr/src/r8168-8.040.00/Makefile
-rw-r--r-- root/root 10619 2015-04-30 22:17 ./usr/src/r8168-8.040.00/rtltool.c
-rw-r--r-- root/root 7890 2015-04-30 22:19 ./usr/src/r8168-8.040.00/rtl_eeprom.c
... 以下省略

2. http://www.pathname.com/fhs/pub/fhs-2.3.html
/usr/src : Source code (optional)
yangdawei.hit
帖子: 245
注册时间: 2015-01-02 15:32
系统: Debian

Re: 以太网卡连不上网

#12

帖子 yangdawei.hit » 2015-09-21 8:07

感谢poloxiao和vickycq的持续关注和帮助。看来确实是以太网卡的驱动没装对,参考http://dwaves.de/2013/12/31/debian-inst ... ck-e350m1/安装上了驱动。网卡需要的固件是rtl8168e-3.fw。现在以太卡和无线卡都装上了。谢谢!

通过和二位的请教,发现很多概念都很模糊。还要慢慢学习。
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 以太网卡连不上网

#13

帖子 vickycq » 2015-09-21 8:37

poloshiao 写了: Debian 上的 r8168-dkms 是源碼 ?
dkms source for the r8168 network driver
@poloshiao, 安装后可自动编译, depmod, mkinitcpio, blacklist r8169, insmod ... 每次升级内核均会自动重复以上步骤,保证无痛衔接。可谓是内核模块驱动的傻瓜一站式管理方案

不过目前 debian 中只有 sid 套件库有此包,迟迟不能进入 testing/stable,或许是有 release-critical bug. 不过我没有遇到,工作十分稳定。此包依赖简单 <dkms (>= 2.1.0.0)> ,完全可用于从 jessie 到 sid 各版本。

https://en.wikipedia.org/wiki/Dynamic_K ... le_Support
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 以太网卡连不上网

#14

帖子 poloshiao » 2015-09-21 10:10

安装后可自动编译, depmod, mkinitcpio, blacklist r8169, insmod ... 每次升级内核均会自动重复以上步骤,保证无痛衔接。可谓是内核模块驱动的傻瓜一站式管理方案
1. 謝謝提醒
我的 RTL8111/8168/8411 主板 報銷了
所以 現在無法實作驗證

2. 有許多無線網卡 還需要額外安裝合適版本的 firmware 才能正常運作
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 以太网卡连不上网

#15

帖子 vickycq » 2015-09-21 10:34

poloshiao 写了: 0. 謝謝提醒
我的 RTL8111/8168/8411 主板 報銷了
所以 現在無法實作驗證

2. 有許多無線網卡 還需要額外安裝合適版本的 firmware 才能正常運作
2.
谢谢提醒
网卡的二进制固件在debian中为独立打包,且默认不安装。如 firmware-ipw2200, firmware-ralink, firmware-realtek 等。楼主的情况需要安装 firmware-realtek 以发挥最大效果。
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
回复