解决 Ubuntu 11.10 在 RTL8111/8168B 网卡下速度慢的问题

装了 Ubuntu 11.10 后,一直发现网速不对劲,别人对服务器上传 10MB/s,我只有几百k,一直以为是FileZilla的问题,换了多个客户端还是如此。

伤心!

今天想起来google了下,终于!找到了问题:

见 http://askubuntu.com/questions/66989/ubuntu-11-10-network-speed

其中有个人说:

Look under connection information for the connection you use to access the net. If the driver is r8169 and you have a Realtek RTL8111 network chip on your motherboard then follow this post to get the correct driver installed. Ubuntu 11.10 uses kernel version 3.x so take the necessary steps noted for this kernel version (I didn't modify the makefile, just copied the files as instructed instead).

To find out what network chip you have try running lspci to list devices on your PCI bus. The culprit was

05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06) 

Before doing this my internet connection was inconsistent, slow and would drop a lot of packets (as shown by running ifoncig). Now its running fast with no dropped packets.

Point taken about my post being "forum like" in the comment, I have amended this answer to reflect that.

然后点进去那个 this post,终于找到了解决办法:

http://forums.linuxmint.com/viewtopic.php?f=49&t=80757

具体来说

Here are the instructions to replace the driver in a nutshell

      - Download the file from the oficial realtek site
      - Open a terminal
      - Change directories to where the downloaded file is
      - Extract it
      - Change directories to the extracted directory
      - Execute autorun.sh
    - If you are using kernel 3.x: Copy the r8168.ko file to the right place and load the module

Here are the detailed instructions:
- Download the file from the official site
http://www.realtek.com.tw/Downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2
The rest of the steps depend on the filename and location of the downloaded file. Please adapt as required:
For example, if you download the file to your Downloads folder and the file is called r8168-8.025.00.tar.gz, the steps are the following

CODE: SELECT ALL
cd ~/Downloads
tar vjxf r8168-8.025.00.tar.gz
cd r8168-8.025.00
sudo ./autorun.sh

If you are using kernel 2.x then you should be OK.
This script unloads and renames the r8169 driver so it does not cause any more trouble. There is no need to blacklist it but you can blacklist it if you want.

CODE: SELECT ALL
echo "blacklist r8169" >> /etc/modprobe.d/blacklist.conf

If you are using kernel 3.0 you'll notice that the /src/Makefile has a bug that causes it to install the r8168.o file instead of the r8168.ko file
The solution is simple:
After the autorun.sh finishes, just do the following:CODE: SELECT ALL

sudo cp src/r8168.ko   /lib/modules/3.0.0-1-amd64/kernel/drivers/net/
sudo depmod
sudo modprobe r8168

And that's that.

In case you are curious about what the bug is:
Line 36 of the src/Make file is 

CODE: SELECT ALL
KEXT      := $(shell echo $(KVER) | sed -ne 's/^2\.[567]\..*/k/p')o

Which sets the KEXT to "ko" for kernels 2.5, 2.6 and 2.7. It sets KEXT to "o" for anything else. This was OK at the time as kernel 3.0 is quite recent.

The fix is to also include kernel 3.0 in that instruction

CODE: SELECT ALL
KEXT      := $(shell echo $(KVER) | sed -ne 's/^2\.[567]\..*/k/p;s/^3\.0\..*/k/p')o

I hope this helps

原文地址:https://www.cnblogs.com/xlhblog/p/2228908.html