How to install a new network adapter

Created on 2011-10-31 by David Gómez

Switzernet

 

 

The goal of this HOW TO is to describe the steps that we should follow in order to install and configure a new network adapter in our server. In most cases, network adapter is automatically installed but sometimes it isn’t recognized by the operating system. This document describes how to proceed in such cases.

 

First of all, we need to see if the network adapter it’s alright. We can check it by typing the command:

 

[root@212-147-8-106 ~]# lspci | grep Ethernet

 

We get an output like that:

 

 

As we can see in the above figure, we can notice that one of the network adapters is not properly installed because the Linux kernel doesn’t recognize it.

 

In this situation, we have two options:

 

  1. Compile the Linux kernel again (with new parameters)
  2. Get the network adapter’s driver and install it

 

Because the first option it’s complicated and it will take us a lot of time, we choose the second one that it’s easier and faster.

 

As in this case Intel is the manufacture, we search on internet its website in order to download the proper drivers. They have a “Download Center” in the url:

 

http://downloadcenter.intel.com/

 

Following the link, we should search our driver in the site. For this purpose we need to know the Linux kernel version that is running in our server:

 

[root@212-147-8-106 ~]# uname -r

 

We get the output:

 

 

Or

 

[root@212-147-8-106 ~]# rpm -q --qf "Kernel arch type is: %{ARCH}\nKernel name is: %{VERSION}\n" kernel

 

 

 

Now, we are able to find the driver on the manufacture’s website. We should search with the proper keywords:

 

network adapter 2.6.x linux

 

 

After click on “search” button, we get all the matches that we have available.

 

 

At this point we should know which kind of network adapter we have. In our case, we have a “1 Gigabit PCI-E network adapter”. We look for these features between all the matches and select the latest release (see the above figure).

 

Once we have been selected the driver that we want, we get the following screen:

 

 

Finally, we must check the operating system and the kernel version to be sure that we are downloading the right driver. After checking them, we can click on “Download” button.

 

Now we have the network adapter driver package. We need to compile it and install it, so we need extra-packages (compiler and kernel libraries).

 

We are going to use the open-source command-line package-management utility (YUM) in order to get all the packages that we need and that we don’t have installed. Obviously, in the new server we don’t have Internet connection, so we should install a second old network adapter that probably will be automatically detected.

 

We know which kernel version we have (kernel-2.6.18-164.0.0.0.1.el5.x86_64.rpm) and we know that we need a compiler, so we should check which is the compiler version related at our kernel and if we have installed it.

 

[root@212-147-8-106 ~]# cat /proc/version

 

 

 

[root@212-147-8-106 ~]# rpm -qa | more | grep gcc

 

 

Just in the case that we don’t have installed the compiler, we should install it.

 

 

With an Internet connection established, we run the command:

 

[root@212-147-8-106 ~]# yum deplist gcc

 

That show us what are the packets (also the version) that we need to have installed in order to install the gcc compiler.

 

[root@212-147-8-106 ~]# rpm -qa | more | grep packet_name

 

The line above let us know if a packet is installed and its version.

 

In order to download all the packets that we need related with the compiler we should run the following command:

 

[root@212-147-8-106 ~]# yum install gcc --downloadonly

 

All the packets and updates that we need will be downloaded to the following path:

 

/var/cache/yum

 

Or we can download a specific packet with the command:

 

[root@212-147-8-106 ~]# yum install name_of_the_packet --downloadonly

 

Example:

 

[root@212-147-8-106 ~]# yum install gcc-4.1.2-46.el5.x86_64.rpm --downloadonly

 

Once we have downloaded all the files that we need, we copy them in a USB key:

 

[root@212-147-8-106 ~]# mkdir /mnt/usb

[root@212-147-8-106 ~]# mount -t vfat /dev/sda1 /mnt/usb

[root@212-147-8-106 ~]# cp /var/cache/yum/* /mnt/usb

[root@212-147-8-106 ~]# umount /mnt/usb

 

To know in which name USB pendrive is detected:

 

[root@212-147-8-106 ~]# fdisk -ls

 

Generally it should appear in /dev/sda1 or /dev/sdb1, but it depends on which port of the station you have connected the pendrive.

 

With all the files downloaded, we burn a CD that will allow us to install the network adapter driver in the new server.

 

In our case, we are going to install the following packets:

 

 

Next step is to insert the CD into the server, compile the driver and install it:

 

[root@212-147-8-106 ~]# mkdir /mnt/cdrom

[root@212-147-8-106 ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom

[root@212-147-8-106 ~]# mkdir /tmp/install_intel_driver/

[root@212-147-8-106 ~]# cp -r /mnt/cdrom/* /tmp/install_intel_driver/

[root@212-147-8-106 ~]# cd /tmp/install_intel_driver/

[root@212-147-8-106 ~]# rpm -ivh libgomp-4.4.0-6.el5.x86_64.rpm

[root@212-147-8-106 ~]# rpm -ivh gcc-4.1.2-46.el5.x86_64.rpm

[root@212-147-8-106 ~]# rpm -ivh kernel-devel-2.6.18-164.0.0.0.1.el5.x86_64.rpm

[root@212-147-8-106 ~]# tar zxf e1000e-1.6.2.tar.gz

[root@212-147-8-106 ~]# cd e1000e-1.6.2/src/

[root@212-147-8-106 ~]# make install

[root@212-147-8-106 ~]# modprobe e1000e

 

Now, the driver should be installed. In order to check that everything it’s Ok we type these commands:

 

[root@212-147-8-106 ~]# ifconfig eth0 212.147.8.xxx/24

[root@212-147-8-106 ~]# ifconfig

 

Where: 212.147.8.xxx is the server’s IP address.

 

The output should be like this:

 

 

The driver is installed and our network adapter is recognized.

 

Finally, we need to create the proper configuration files in order to keep the network adapter configuration after the restart of the server.

 

[root@212-147-8-106 ~]#  cd /etc/sysconfig/network-scripts/

[root@212-147-8-106 ~]#  nano ifcfg-eth0

 

+--------------------------

DEVICE=eth0

BOOTPROTO=static

BROADCAST=212.147.8.111

IPADDR=212.147.8.xxx

HWADDR=xx:xx:xx:xx:xx:xx

NETMASK=255.255.255.240

NETWORK=212.147.8.96

ONBOOT=yes

TYPE=Ethernet

+--------------------------

 

[root@212-147-8-106 ~]#  nano route-eth0

+--------------------------

0.0.0.0/0 via 212.147.8.98

+--------------------------

 

[root@212-147-8-106 ~]#  nano /etc/resolv.conf

+--------------------------

nameserver 212.147.8.98

+--------------------------

 

In the above configuration, the field IPADDR must be completed with the IP address that our network adapter should have, while the field HWADDR must be completed with our network device’s MAC address (see the picture below):

 

 

Now, we restart our network adapter and test it:

 

[root@212-147-8-106 ~]# service network restart

 

 

[root@212-147-8-106 ~]# ping 212.147.1.98

[root@212-147-8-106 ~]# ping 8.8.8.8 #google dns

[root@212-147-8-106 ~]# ping www.google.com

[root@212-147-8-106 ~]# service sshd start

 

We have our network adapter ready. The last step is to get back the cdrom.

 

[root@212-147-8-106 ~]# eject cdrom

 

 

* * *