% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={realtek-dropping-packets-on-linux-ubuntu-and-fedora},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{realtek-dropping-packets-on-linux-ubuntu-and-fedora}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{realtek-dropping-packets-on-linux-ubuntu-and-fedora}{%
\section{realtek-dropping-packets-on-linux-ubuntu-and-fedora}\label{realtek-dropping-packets-on-linux-ubuntu-and-fedora}}

\hypertarget{realtek-nic-driver-r8169-dropping-packets-on-linux-ubuntu-and-fedora}{%
\section{Realtek NIC driver r8169 dropping packets on linux ubuntu and
fedora}\label{realtek-nic-driver-r8169-dropping-packets-on-linux-ubuntu-and-fedora}}

Many motherboards nowadays have integrated gigabit ethernet that use the
Realtek NIC chipset.

The Realtek r8168B network card does not work out of the box in Redhat,
Centos, Fedora, or Ubuntu: instead of loading the r8168 driver, modprobe
loads the r8169 driver, which is broken as can be seen with ifconfig
which shows large amounts of dropped packets.

One solution found by Barry Mavin is to remove the r8169 driver and
install the latest r8168 driver.

\hypertarget{steps-to-install-realtek-r8168-driver}{%
\subsection{Steps to install Realtek r8168
driver}\label{steps-to-install-realtek-r8168-driver}}

\begin{itemize}
\item
  Download the R8168B linux driver:

  .. code-block:: bash

  wget /attachment/r8168-8.023.00.tar.bz2 tar vjxf
  r8168-8.023.00.tar.bz2
\item
  Check whether the built-in driver, r8169.ko (or r8169.o for kernel
  2.4.x), is installed:

  .. code-block:: bash

  lsmod \textbar{} grep r8169
\item
  r8169 seems installed if the lsmod command returns output, so remove
  r8169 with:

  .. code-block:: bash

  sudo rmmod r8169
\item
  install the Realtec r8168b nic driver:

  .. code-block:: bash

  cd r8168-8.023.00 sudo ./autorun.sh
\item
  prevent the r8169 driver from loading again:

  .. code-block:: bash

  echo ``blacklist r8169'' \textgreater\textgreater{}
  /etc/modprobe.d/blacklist.conf
\item
  you may now verify that r8168b has been installed and loaded by
  running:

  .. code-block:: bash

  lsmod \textbar{} grep r8168
\end{itemize}

\textbf{The dropped packets problem should appear fixed!}

Some people notice r8169 driver returning after reboots. To prevent this
you might need to clean the cache using the following command:

.. code-block:: bash

update-initramfs -u

\textbf{You should donate to foxhop.net}
\texttt{here\ \textless{}https://www.paypal.com/cgi-bin/webscr?cmd=\_s-xclick\&hosted\_button\_id=7HQMTG3JFPBNN\textgreater{}}\_

\hypertarget{scottman1987-sep-05-2011-1223-pm}{%
\subsection{scottman1987 --- Sep 05, 2011 12:23
pm}\label{scottman1987-sep-05-2011-1223-pm}}

Thanks - Exactly what I needed!

\hypertarget{scottman1987-sep-07-2011-1115-am}{%
\subsection{scottman1987 --- Sep 07, 2011 11:15
am}\label{scottman1987-sep-07-2011-1115-am}}

Sorry - I spoke too soon. This worked the first time that I tried it.
However, the next day when I booted up the machine again, r8169 was
again loaded. I double checked the blacklist line in blacklist.conf, and
verified that it was correctly inserted into the file. I found the
location of r8169.ko and removed it from the file system. No luck - each
time ubuntu boots, r8169 is right back there, like a bad penny.

Here is the pertinent portion of the blacklist.conf file: \# don't let
the realtek r8169 driver load blacklist r8169

Output of the lsmod command (portion): hid 91020 1 usbhid r8169 48022 0
xhci\_hcd 77643 0

Not to mention\ldots{} It seems that running the autorun.sh command
before attempting to use the network will cause the system to hang hard,
so that I have to manually reset it.

Hers is the folder contents for the kennel drivers
scottman@CWK04:/lib/modules/2.6.38-11-generic/kernel/drivers/net\$ ls r*
r8168.ko rrunner.ko

Any thoughts? Am I missing something? Where is the system getting the
r8169 driver from?

\hypertarget{foxhop-sep-07-2011-0549-pm}{%
\subsection{foxhop --- Sep 07, 2011 05:49
pm}\label{foxhop-sep-07-2011-0549-pm}}

I have not experienced the problem you discribed.

\textbf{Update:} I must reinstall the driver each time ubuntu updates
the kernel.

\hypertarget{scottman1987-sep-09-2011-1157-am}{%
\subsection{scottman1987 --- Sep 09, 2011 11:57
am}\label{scottman1987-sep-09-2011-1157-am}}

I'm running 64-bit ubuntu (release 11.04). Would this possibly have
anything to do with the problems I am having?

\hypertarget{foxhop-sep-09-2011-0617-pm}{%
\subsection{foxhop --- Sep 09, 2011 06:17
pm}\label{foxhop-sep-09-2011-0617-pm}}

I'm running the same operating system as you. (Ubuntu 11.04)

It sounds like the ``Blacklist'' isn't working. Maybe do some research
about that.

\hypertarget{tonyyoungblood-sep-11-2011-0806-pm}{%
\subsection{tonyyoungblood --- Sep 11, 2011 08:06
pm}\label{tonyyoungblood-sep-11-2011-0806-pm}}

I am experiencing the exact same problem as Scottman1987 on Mythbuntu
11.04 64 bit. Even after blacklisting, r8169 reloads upon startup and
causes poor or no network connection. I also experience system lockups
while running the above instructions.

\hypertarget{tonyyoungblood-sep-11-2011-0812-pm}{%
\subsection{tonyyoungblood --- Sep 11, 2011 08:12
pm}\label{tonyyoungblood-sep-11-2011-0812-pm}}

I found a fix.

You have to update driver cache after blacklisting.

Code:

update-initramfs -u

From http://ubuntuforums.org/showthread.php?t=1767781

\hypertarget{foxhop-sep-12-2011-0137-pm}{%
\subsection{foxhop --- Sep 12, 2011 01:37
pm}\label{foxhop-sep-12-2011-0137-pm}}

@scottman1987

Could you please attempt to try tonyyoungblood's drive cache work
around?

.. code-block:: bash

update-initramfs -u

\hypertarget{scottman1987-sep-13-2011-0402-pm}{%
\subsection{scottman1987 --- Sep 13, 2011 04:02
pm}\label{scottman1987-sep-13-2011-0402-pm}}

Yes - I tried tonyyoungblood's drive cache workaround, and it appears to
have solved my issue.

I had to run the autorun.sh file first (which I always had to do,
because of the fact that it was not retaining the driver), and after
that command was successful, I ran the update-initramfs -u command
(specifically sudo update-initramfs -u), restarted the machine, opened a
terminal session, ran lsmod, and got the r8168 driver in the list
instead of r8169. From what I can tell with initial testing of large
downloads and going to Internet web sites, it is functioning well.

\hypertarget{scottman1987-sep-13-2011-0403-pm}{%
\subsection{scottman1987 --- Sep 13, 2011 04:03
pm}\label{scottman1987-sep-13-2011-0403-pm}}

And, I should also say, thatnk you very much!

\hypertarget{foxhop-sep-14-2011-0332-pm}{%
\subsection{foxhop --- Sep 14, 2011 03:32
pm}\label{foxhop-sep-14-2011-0332-pm}}

Welcome, glad I could help!

I should really build functionality to allow users to edit their
comments\ldots{}

\hypertarget{foxhop-oct-15-2011-0633-am}{%
\subsection{foxhop --- Oct 15, 2011 06:33
am}\label{foxhop-oct-15-2011-0633-am}}

This driver supports linux 3.0 however we need to make a change to the
src/Makefile

.. code-block:: Makefile

\# comment out original line \#KEXT := \$(shell echo \$(KVER) \textbar{}
sed -ne `s/\^{}2.{[}567{]}..\emph{/k/p')o \# replace with this line KEXT
:= \$(shell echo \$(KVER) \textbar{} sed -ne
's/\footnote{23}.{[}0123456789{]}..}/k/p')o

Adjust the sed regex to include linux version 3.x

This correction was found in the code.google.com realtek issue tracker

\hypertarget{dreamkatana-nov-27-2011-1235-pm}{%
\subsection{dreamkatana --- Nov 27, 2011 12:35
pm}\label{dreamkatana-nov-27-2011-1235-pm}}

Thank's everybody, that worked for me. It really helped me, IF you need
a paypal donation just ask me.

\hypertarget{foxhop-nov-27-2011-0312-pm}{%
\subsection{foxhop --- Nov 27, 2011 03:12
pm}\label{foxhop-nov-27-2011-0312-pm}}

No problem @dreamkatana,

I sent you an email with my contact information. Thanks for the kind
comment!

\hypertarget{petervg-dec-11-2011-1028-pm}{%
\subsection{petervg --- Dec 11, 2011 10:28
pm}\label{petervg-dec-11-2011-1028-pm}}

Thanks for detailed directions dude. Was experiencing same problem with
Ubuntu 11.10 on a Dell Vostro which uses the Realtek network card

FYI for others, use the following command to find out what network card
your machine is using:

sudo lshw -class network

\hypertarget{max-jan-16-2012-0656-pm}{%
\subsection{max --- Jan 16, 2012 06:56
pm}\label{max-jan-16-2012-0656-pm}}

I have a system with both this:

.. code-block:: bash

\begin{verbatim}
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
\end{verbatim}

and this:

.. code-block:: bash

\begin{verbatim}
06:01.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
\end{verbatim}

\ldots{} so I couldn't blacklist the r8169 driver without disabling the
second LAN port. However, I found that I could specify which driver to
load for which device by editing
/etc/udev/rules.d/70-persistent-net.rules like so (MAC addresses
redacted):

.. code-block:: bash

\begin{verbatim}
# PCI device 0x10ec:0x8168 (r8168)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="r8168", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10ec:0x8169 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="r8169", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
\end{verbatim}

This seems to load both the r8168 driver and the r1869 driver and use
the correct one for each, with no need for blacklisting.

(I also needed to edit the driver Makefile for linux 3.0 as per comment
above.)

\hypertarget{mnek84-mar-25-2012-1146-am}{%
\subsection{mnek84 --- Mar 25, 2012 11:46
am}\label{mnek84-mar-25-2012-1146-am}}

Thank you! this post save my life!!!

\hypertarget{lagasuarus-apr-28-2013-0450-pm}{%
\subsection{lagasuarus --- Apr 28, 2013 04:50
pm}\label{lagasuarus-apr-28-2013-0450-pm}}

please tell me what I am doing wrong

i do steps 1 and 4

and these are my outputs

--2013-04-28 17:48:21-- /attachment/r8168-8.023.00.tar.bz2 Resolving
www.foxhop.net (www.foxhop.net)\ldots{} 76.231.160.38 Connecting to
www.foxhop.net (www.foxhop.net)\textbar76.231.160.38\textbar:80\ldots{}
connected. HTTP request sent, awaiting response\ldots{} 200 OK Length:
59857 (58K) {[}application/x-tar{]} Saving to:
`r8168-8.023.00.tar.bz2.3'

r8168-8.023.00/ r8168-8.023.00/Makefile r8168-8.023.00/src/
r8168-8.023.00/src/Makefile r8168-8.023.00/src/r8168\_asf.h
r8168-8.023.00/src/rtl\_eeprom.c r8168-8.023.00/src/r8168.h
r8168-8.023.00/src/r8168\_n.c r8168-8.023.00/src/r8168\_asf.c
r8168-8.023.00/src/rtl\_eeprom.h r8168-8.023.00/src/rtltool.h
r8168-8.023.00/src/rtltool.c r8168-8.023.00/src/Makefile\_linux24x
r8168-8.023.00/README r8168-8.023.00/autorun.sh

Check old driver and unload it. Build the module and install
/home/adam/r8168-8.023.00/src/r8168\_n.c: In function
`rtl8168\_rx\_vlan\_skb':
/home/adam/r8168-8.023.00/src/r8168\_n.c:1702:3: error: implicit
declaration of function `vlan\_hwaccel\_receive\_skb'
{[}-Werror=implicit-function-declaration{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c: At top level:
/home/adam/r8168-8.023.00/src/r8168\_n.c:2076:2: error: unknown field
`get\_rx\_csum' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2076:2: warning: initialization
from incompatible pointer type {[}enabled by default{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:2076:2: warning: (near
initialization for `rtl8168\_ethtool\_ops.nway\_reset') {[}enabled by
default{]} /home/adam/r8168-8.023.00/src/r8168\_n.c:2077:2: error:
unknown field `set\_rx\_csum' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2077:2: warning: initialization
from incompatible pointer type {[}enabled by default{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:2077:2: warning: (near
initialization for `rtl8168\_ethtool\_ops.get\_link') {[}enabled by
default{]} /home/adam/r8168-8.023.00/src/r8168\_n.c:2078:2: error:
unknown field `get\_tx\_csum' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2078:2: warning: initialization
from incompatible pointer type {[}enabled by default{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:2078:2: warning: (near
initialization for `rtl8168\_ethtool\_ops.get\_eeprom\_len') {[}enabled
by default{]} /home/adam/r8168-8.023.00/src/r8168\_n.c:2079:2: error:
unknown field `set\_tx\_csum' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2079:2: warning: initialization
from incompatible pointer type {[}enabled by default{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:2079:2: warning: (near
initialization for `rtl8168\_ethtool\_ops.get\_eeprom') {[}enabled by
default{]} /home/adam/r8168-8.023.00/src/r8168\_n.c:2080:2: error:
unknown field `get\_sg' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2080:2: warning: initialization
from incompatible pointer type {[}enabled by default{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:2080:2: warning: (near
initialization for `rtl8168\_ethtool\_ops.set\_eeprom') {[}enabled by
default{]} /home/adam/r8168-8.023.00/src/r8168\_n.c:2081:2: error:
unknown field `set\_sg' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2081:2: warning: initialization
from incompatible pointer type {[}enabled by default{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:2081:2: warning: (near
initialization for `rtl8168\_ethtool\_ops.get\_coalesce') {[}enabled by
default{]} /home/adam/r8168-8.023.00/src/r8168\_n.c:2083:2: error:
unknown field `get\_tso' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2083:14: error:
`ethtool\_op\_get\_tso' undeclared here (not in a function)
/home/adam/r8168-8.023.00/src/r8168\_n.c:2084:2: error: unknown field
`set\_tso' specified in initializer
/home/adam/r8168-8.023.00/src/r8168\_n.c:2084:14: error:
`ethtool\_op\_set\_tso' undeclared here (not in a function)
/home/adam/r8168-8.023.00/src/r8168\_n.c: In function
`rtl8168\_netpoll': /home/adam/r8168-8.023.00/src/r8168\_n.c:9610:2:
error: implicit declaration of function `disable\_irq'
{[}-Werror=implicit-function-declaration{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:9616:2: error: implicit
declaration of function `enable\_irq'
{[}-Werror=implicit-function-declaration{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c: In function
`rtl8168\_init\_one': /home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2:
error: `struct net\_device' has no member named `open'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `hard\_start\_xmit'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `get\_stats'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `stop'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `tx\_timeout'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `set\_multicast\_list'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `change\_mtu'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `set\_mac\_address'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `do\_ioctl'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `poll\_controller'
/home/adam/r8168-8.023.00/src/r8168\_n.c:10858:2: error: `struct
net\_device' has no member named `vlan\_rx\_register'
/home/adam/r8168-8.023.00/src/r8168\_n.c: In function `rtl8168\_open':
/home/adam/r8168-8.023.00/src/r8168\_n.c:11020:2: error: implicit
declaration of function `request\_irq'
{[}-Werror=implicit-function-declaration{]}
/home/adam/r8168-8.023.00/src/r8168\_n.c:11020:91: error: `IRQF\_SHARED'
undeclared (first use in this function)
/home/adam/r8168-8.023.00/src/r8168\_n.c:11020:91: note: each undeclared
identifier is reported only once for each function it appears in
/home/adam/r8168-8.023.00/src/r8168\_n.c: In function
`rtl8168\_xmit\_frags':
/home/adam/r8168-8.023.00/src/r8168\_n.c:12284:3: error: incompatible
type for argument 1 of `lowmem\_page\_address' In file included from
/usr/src/linux-headers-3.5.0-17-generic/arch/x86/include/asm/pci.h:4:0,
from include/linux/pci.h:1342, from
/home/adam/r8168-8.023.00/src/r8168\_n.c:41: include/linux/mm.h:739:30:
note: expected 'const struct page \emph{' but argument is of type
`struct ' /home/adam/r8168-8.023.00/src/r8168\_n.c: In function
`rtl8168\_close': /home/adam/r8168-8.023.00/src/r8168\_n.c:12934:3:
error: implicit declaration of function `free\_irq'
{[}-Werror=implicit-function-declaration{]} cc1: some warnings being
treated as errors make{[}3{]}: }**
{[}/home/adam/r8168-8.023.00/src/r8168\_n.o{]} Error 1 make{[}2{]}: ***
{[}\emph{module}/home/adam/r8168-8.023.00/src{]} Error 2 make{[}1{]}:
*** {[}modules{]} Error 2 make: *** {[}modules{]} Error 2

\hypertarget{foxhop-may-02-2013-0550-pm}{%
\subsection{foxhop --- May 02, 2013 05:50
pm}\label{foxhop-may-02-2013-0550-pm}}

@lagasuarus I don't believe I need this work around any more for Ubuntu
12.10+ What operation system are you running?

\end{document}
