来源:http://forum.ubuntu.org.cn/viewtopic.php?f=116&t=463646
1、执行如下命令
uname -a
sudo lspci -knn
sudo lshw -C network
ifconfig
ping 192.168.1.1 -c 4
tail /var/log/syslog -n 20
2、查看状态:
gofox@gofox-To-be-filled-by-O-E-M:~$ uname -a
Linux gofox-To-be-filled-by-O-E-M 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
gofox@gofox-To-be-filled-by-O-E-M:~$ lspci
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (external gfx0 port B) (rev 02)
00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port B)
00:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port D)
00:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port H)
00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 42)
00:14.1 IDE interface: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 IDE Controller (rev 40)
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge (rev 40)
00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor HyperTransport Configuration
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Address Map
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Miscellaneous Control
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Link Control
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Pitcairn PRO [Radeon HD 7850]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
02:00.0 USB controller: Etron Technology, Inc. EJ168 USB 3.0 Host Controller (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
gofox@gofox-To-be-filled-by-O-E-M:~$ sudo lshw -C network
[sudo] password for gofox:
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:03:00.0
logical name: eth0
version: 06
serial: 94:de:80:2a:f5:58
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 ip=192.168.1.100 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:73 ioport:d000(size=256) memory:d0004000-d0004fff memory:d0000000-d0003fff
gofox@gofox-To-be-filled-by-O-E-M:~$ ifconfig
eth0 Link encap:以太网 硬件地址 94:de:80:2a:f5:58
inet 地址:192.168.1.100 广播:192.168.1.255 掩码:255.255.255.0
inet6 地址: fe80::96de:80ff:fe2a:f558/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:31 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:35 错误:0 丢弃:611 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:4309 (4.3 KB) 发送字节:5059 (5.0 KB)
lo Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 跃点数:1
接收数据包:1054 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1054 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:0
接收字节:84166 (84.1 KB) 发送字节:84166 (84.1 KB)
gofox@gofox-To-be-filled-by-O-E-M:~$ ping 192.168.1.1 -c 4
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.100 icmp_seq=1 Destination Host Unreachable
From 192.168.1.100 icmp_seq=2 Destination Host Unreachable
From 192.168.1.100 icmp_seq=3 Destination Host Unreachable
From 192.168.1.100 icmp_seq=4 Destination Host Unreachable
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3000ms
pipe 3
gofox@gofox-To-be-filled-by-O-E-M:~$ tail /var/log/syslog -n 20
Sep 3 11:15:27 gofox-To-be-filled-by-O-E-M kernel: [ 43.926344] ---[ end trace f68773f9b988bca3 ]---
Sep 3 11:15:27 gofox-To-be-filled-by-O-E-M kernel: [ 43.932415] r8169 0000:03:00.0 eth0: link up
Sep 3 11:15:30 gofox-To-be-filled-by-O-E-M ntpdate[2071]: Can't find host ntp.ubuntu.com: Name or service not known (-2)
Sep 3 11:15:30 gofox-To-be-filled-by-O-E-M ntpdate[2071]: no servers can be used, exiting
Sep 3 11:15:41 gofox-To-be-filled-by-O-E-M whoopsie[1006]: offline
Sep 3 11:16:09 gofox-To-be-filled-by-O-E-M kernel: [ 85.984761] r8169 0000:03:00.0 eth0: link up
Sep 3 11:17:01 gofox-To-be-filled-by-O-E-M CRON[2447]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Sep 3 11:17:27 gofox-To-be-filled-by-O-E-M kernel: [ 164.012906] r8169 0000:03:00.0 eth0: link up
Sep 3 11:17:51 gofox-To-be-filled-by-O-E-M kernel: [ 188.029088] r8169 0000:03:00.0 eth0: link up
Sep 3 11:18:15 gofox-To-be-filled-by-O-E-M kernel: [ 212.045170] r8169 0000:03:00.0 eth0: link up
Sep 3 11:18:51 gofox-To-be-filled-by-O-E-M kernel: [ 248.069269] r8169 0000:03:00.0 eth0: link up
Sep 3 11:19:15 gofox-To-be-filled-by-O-E-M kernel: [ 272.085347] r8169 0000:03:00.0 eth0: link up
Sep 3 11:19:51 gofox-To-be-filled-by-O-E-M kernel: [ 308.109475] r8169 0000:03:00.0 eth0: link up
Sep 3 11:19:56 gofox-To-be-filled-by-O-E-M anacron[909]: Job `cron.daily' started
Sep 3 11:19:56 gofox-To-be-filled-by-O-E-M anacron[2602]: Updated timestamp for job `cron.daily' to 2014-09-03
Sep 3 11:20:15 gofox-To-be-filled-by-O-E-M kernel: [ 332.125563] r8169 0000:03:00.0 eth0: link up
Sep 3 11:20:51 gofox-To-be-filled-by-O-E-M kernel: [ 368.149702] r8169 0000:03:00.0 eth0: link up
Sep 3 11:22:03 gofox-To-be-filled-by-O-E-M kernel: [ 440.201919] r8169 0000:03:00.0 eth0: link up
Sep 3 11:23:03 gofox-To-be-filled-by-O-E-M kernel: [ 500.238182] r8169 0000:03:00.0 eth0: link up
Sep 3 11:23:39 gofox-To-be-filled-by-O-E-M kernel: [ 536.262303] r8169 0000:03:00.0 eth0: link up
gofox@gofox-To-be-filled-by-O-E-M:~$
3、查看网络连接是否正常
sudo ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 8月 28 20:05 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
sudo cat /etc/resolv.conf
nameserver 127.0.1.1
运行结果
。。。
gofox@gofox-To-be-filled-by-O-E-M:~$ lspci
。。。
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
02:00.0 USB controller: Etron Technology, Inc. EJ168 USB 3.0 Host Controller (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
gofox@gofox-To-be-filled-by-O-E-M:~$ sudo lshw -C network
[sudo] password for gofox:
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:03:00.0
logical name: eth0
version: 06
serial: 94:de:80:2a:f5:58
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 ip=192.168.1.100 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:73 ioport:d000(size=256) memory:d0004000-d0004fff memory:d0000000-d0003fff
gofox@gofox-To-be-filled-by-O-E-M:~$ ifconfig
eth0 Link encap:以太网 硬件地址 94:de:80:2a:f5:58
inet 地址:192.168.1.100 广播:192.168.1.255 掩码:255.255.255.0
inet6 地址: fe80::96de:80ff:fe2a:f558/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:31 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:35 错误:0 丢弃:611 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:4309 (4.3 KB) 发送字节:5059 (5.0 KB)
。。。
gofox@gofox-To-be-filled-by-O-E-M:~$ tail /var/log/syslog -n 20
Sep 3 11:15:27 gofox-To-be-filled-by-O-E-M kernel: [ 43.926344] ---[ end trace f68773f9b988bca3 ]---
Sep 3 11:15:27 gofox-To-be-filled-by-O-E-M kernel: [ 43.932415] r8169 0000:03:00.0 eth0: link up
Sep 3 11:15:30 gofox-To-be-filled-by-O-E-M ntpdate[2071]: Can't find host ntp.ubuntu.com: Name or service not known (-2)
Sep 3 11:15:30 gofox-To-be-filled-by-O-E-M ntpdate[2071]: no servers can be used, exiting
Sep 3 11:15:41 gofox-To-be-filled-by-O-E-M whoopsie[1006]: offline
Sep 3 11:16:09 gofox-To-be-filled-by-O-E-M kernel: [ 85.984761] r8169 0000:03:00.0 eth0: link up
Sep 3 11:17:01 gofox-To-be-filled-by-O-E-M CRON[2447]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Sep 3 11:17:27 gofox-To-be-filled-by-O-E-M kernel: [ 164.012906] r8169 0000:03:00.0 eth0: link up
Sep 3 11:17:51 gofox-To-be-filled-by-O-E-M kernel: [ 188.029088] r8169 0000:03:00.0 eth0: link up
Sep 3 11:18:15 gofox-To-be-filled-by-O-E-M kernel: [ 212.045170] r8169 0000:03:00.0 eth0: link up
Sep 3 11:18:51 gofox-To-be-filled-by-O-E-M kernel: [ 248.069269] r8169 0000:03:00.0 eth0: link up
Sep 3 11:19:15 gofox-To-be-filled-by-O-E-M kernel: [ 272.085347] r8169 0000:03:00.0 eth0: link up
Sep 3 11:19:51 gofox-To-be-filled-by-O-E-M kernel: [ 308.109475] r8169 0000:03:00.0 eth0: link up
Sep 3 11:19:56 gofox-To-be-filled-by-O-E-M anacron[909]: Job `cron.daily' started
Sep 3 11:19:56 gofox-To-be-filled-by-O-E-M anacron[2602]: Updated timestamp for job `cron.daily' to 2014-09-03
Sep 3 11:20:15 gofox-To-be-filled-by-O-E-M kernel: [ 332.125563] r8169 0000:03:00.0 eth0: link up
Sep 3 11:20:51 gofox-To-be-filled-by-O-E-M kernel: [ 368.149702] r8169 0000:03:00.0 eth0: link up
Sep 3 11:22:03 gofox-To-be-filled-by-O-E-M kernel: [ 440.201919] r8169 0000:03:00.0 eth0: link up
Sep 3 11:23:03 gofox-To-be-filled-by-O-E-M kernel: [ 500.238182] r8169 0000:03:00.0 eth0: link up
Sep 3 11:23:39 gofox-To-be-filled-by-O-E-M kernel: [ 536.262303] r8169 0000:03:00.0 eth0: link up
gofox@gofox-To-be-filled-by-O-E-M:~$
4、分析问题
不出所料,应该是你的网卡使用了错误的驱动,见红色字体的内容:
你的网卡是“RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller”,不应使用r8169这个内核驱动模块来驱动,否则就出现象你现在这样拿到了dhcp的ip地址,但网卡却一直处于不断“r8169 0000:03:00.0 eth0: link up”的状态。这样是无法使用有线网络的。
正确的驱动要到realtek的网站下载,自己安装。
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2
选择上面这个链接中unix条目下那个“LINUX driver for kernel 3.x and 2.6.x and 2.4.x”、版本为“8.038”的文件下载。下载好文件,解压到你的家目录中,然后在家目录中执行以下命令:
代码:
cd r8168-8.038.00
sudo ./autorun.sh
sudo ./autorun.sh
驱动安装完成,重启系统。你的有线网络就应该正常了。