I am here
OK.. we know than we do not to worry about any hardware drivers in Linux as Linux Kernel takes care of all that. But what if we want to install a different driver. What if Kernel does not install the right driver. Recently I had to face this problem. The network card installed on my system is RTL8111/8168B PCI Express Gigabit Ethernet controller (ReaLtek Product) and the default driver Kernel installed was r8169 while the correct driver is r8168.
So here we go about the thing now…
(The below changes have been done in openSUSE11.1, Kernel 2.6.27)
Now, first how to know what network driver you have and what is the correct driver? I can provide you with this script which can help you: collectNWData.sh; Run this script and the output will be something like this (You will have to run this script as “super user” and answer few questions):
collectNWData.sh V0.6.1.15 (Rev: 1.165, Build: 2009/09/02 18:39:22)
--- Which type of your network connection should be tested?
--- (1) Wired connection
--- What's the type of networktopology?
--- (1) DSL modem <---> LinuxClient
--- On which host is the script executed?
--- (1) LinuxClient
!!! CND0120E: Network card eth0 has no IP address
!!! CND0300E: No dhcp server found on interface eth0
!!! CND0230W: IPV6 enabled
!!! CND0310W: Classic network configuration with ifup was detected. Configuration with knetworkmanager is much easier
--- Go to http://www.linux-tips-and-tricks.de/CND#English to get more detailed instructions about the error/warning messages and how to fix the problems
--- If you still don't have success then post the contents of file collectNWData.txt in the net (see http://www.linux-tips-and-tricks.de/CND_UPL#English for links) and then the nopaste link on your favorite Linux forum.
==================================================================================================================
==================================================================================================================
…
…
34: PCI 900.0: 0200 Ethernet controller
Model: "Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller"
Vendor: pci 0x10ec "Realtek Semiconductor Co., Ltd."
Device: pci 0x8168 "RTL8111/8168B PCI Express Gigabit Ethernet controller"
SubVendor: pci 0x103c "Hewlett-Packard Company"
SubDevice: pci 0x3061
Driver: "r8169"
Driver Modules: "r8169"
Device File: eth0
Link detected: no
Driver Status: r8169 is active
Driver Activation Cmd: "modprobe r8169"
This is just a filtered output of the above script. Here we can see that the module installed is r8169 which should be r8168.
So first download the driver from your vendor site.
Now that we know what we have and what we need we will proceed further (We will have to proceed all the steps from konsole or similar tool) :
First stop the network and remove the wrong module:
#000000;
padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; font-weight: normal; text-align: left;">
#stop the network
$ rcnetwork stop
#remove r8169 driver
$ rmmod r8169
Go to the directory where you have downloaded the driver. I had downloaded it my home directory and the downloaded file was an archive file so here are the steps:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;">$ cd
$ tar xjf r8168-8.014.00.tar.bz2
$ cd 8168-8.014.00
After that I compiled the code. (This may fail if kernel headers and other standard features of a build environment are not installed)
Code:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;">$ make clean
$ make modules
$ make install
Add the old driver to blacklist and rename the old driver module to make sure modprobe knows not to use r8169, and that depmod doesn’t find the r8169 module:..
Code:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;">$ echo "blacklist r8169n" >> /etc/modprobe.d/blacklist
$ mv /lib/modules/uname -r/kernel/drivers/net/r8169.ko /lib/modules/uname -r
/kernel/drivers/net/r8169.ko.old
Make suse aware of the changes:
Code:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;">$ depmod
$ insmod src/r8168.ko
$ ifconfig -a
Notice the output of “ifconfig -a” and saw how NIC was called (probably eth0 or eth1). Mine was eth0
Then I edited the networks file to add my NIC configuration. Added the below lines of code to my /etc/networks
Code:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;"> # The Ethernet card
auto eth0
iface eth0 inet dhcp
Notice the output of “ifconfig -a” and saw how NIC was called (probably eth0 or eth1). Mine was eth0
Then I edited the networks file to add my NIC configuration. Added the below lines of code to my /etc/networks
Code:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;"> # The Ethernet card
auto eth0
iface eth0 inet dhcp
Then restarted the card:
Code:
#000000; padding: 0.15cm; margin-left: 0.5cm; margin-right: 0.5cm; text-align: left;">$ ifdown eth0
$ ifup eth0
$ rcnetwork start
This should start you networking 🙂