Yolinux.com Tutorial

Linux Networking: Add a Network Interface Card (NIC)

A tutorial on the systems configuration of a Linus system required for an additional Ethernet Network Interface Card. This is typically done for redundancy (in case one fails), high availability and failover or for routing and network subdivision, isolation or gateway (see Linux networking gateway tutorial)

Tutorial Table of Contents:

Related YoLinux Tutorials:

°Linux Networking

°Linux Network Gateway

°Internet Security

°Microsoft Network Integration

°YoLinux Tutorials Index




Free Information Technology Magazines and Document Downloads
TradePub link image


Ethernet Network Card Installation:

Typically an Ethernet network interface is built-in to most modern motherboards. Some computer systems, especially server systems, are equipped with two network interfaces built-in to the motherboard. Additional interfaces can be installed in extra PCI expansion slots.

Ethernet NIC PCI card
Typical Ethernet NIC PCI card

Try the command lspci -vv to see if the hardware is detected properly, and which kernel module (if any) is being assigned:

01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5764M Gigabit Ethernet PCIe (rev 10)
    Subsystem: Hewlett-Packard Company Device 1309
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 52
    Region 0: Memory at f7000000 (64-bit, non-prefetchable) [size=64K]
    Capabilities: <access denied>
    Kernel driver in use: tg3
    Kernel modules: tg3


...
...

37:09.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5782 Gigabit Ethernet (rev 03)
    Subsystem: Hewlett-Packard Company Device 000c
    Physical Slot: 5
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
    Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 32 (16000ns min), Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 21
    Region 0: Memory at f8000000 (64-bit, non-prefetchable) [size=64K]
    [virtual] Expansion ROM at f7100000 [disabled] [size=64K]
    Capabilities: <access denied>
    Kernel driver in use: tg3
    Kernel modules: tg3

or more specifically lspci -vv | grep Ethernet

01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5764M Gigabit Ethernet PCIe (rev 10)
37:09.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5782 Gigabit Ethernet (rev 03)


Linux configuration for a new card:

The network configuration tools and network configuration files are different for Ubuntu/Debian vs Red Hat/Fedora based systems.

The following commands will start, stop or restart networking:
  • sudo /etc/init.d/networking start
  • sudo /etc/init.d/networking stop
  • sudo /etc/init.d/networking restart


Ubuntu network configuration:

Ubuntu GUI network configuration tool: /usr/bin/gnome-nettool (apt-get install gnome-nettool)

Ubuntu network configuration GUI tool gnome-nettool

One can also configure Ubuntu systems by adding entries to the configuration file:
/etc/network/interfaces

Dynamic IP:
...
...

auto eth1
iface eth1 inet dhcp
Static IP:
...
...

auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
Address and netmask are required. The system can calculate defaults for the other values.

DNS configuration will be required in /etc/resolv.conf. For this and other networking configurations see the YoLinux Networking tutorial.


Red Hat / Fedora network configuration:

The most simple method of configuring Red Hat based distributions is by using the console based GUI tool:
system-config-network


Both static and dynamic configurations can be set. If configuring for DHCP, go to that line and pres the space bar. An asterisk "*" will appear to show that this option has been selected.


After device configuration, the new device will show up in the list.

Test interfaces: /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 64:31:50:24:41:A1
          inet addr:242.27.32.60  Bcast:242.27.32.255  Mask:255.255.255.0
          inet6 addr: fb80::6631:50ff:fb44:46a1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:845 errors:0 dropped:0 overruns:0 frame:0
          TX packets:191 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:158077 (154.3 KiB)  TX bytes:15619 (15.2 KiB)
          Interrupt:17

eth1      Link encap:Ethernet  HWaddr 00:10:17:24:BF:77
          inet addr:192.168.1.5  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:21

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:330704 errors:0 dropped:0 overruns:0 frame:0
          TX packets:330704 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:917208006 (874.7 MiB)  TX bytes:917208006 (874.7 MiB)

The addition and configuration of the new Ethernet device will generate the new file:
/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
BOOTPROTO=static
NETMASK=255.255.255.0
TYPE=Ethernet
HWADDR=00:10:17:24:bf:77
IPADDR=192.168.1.5
See /usr/share/doc/initscripts-*/sysconfig.txt for the explanation of all options.

The command ifup eth1 and ifdown eth1 are used to bring the new Ethernet interface card into service or offline.

DNS configuration will be required in /etc/resolv.conf. For this and other networking configurations see the YoLinux Networking tutorial.


Links:


Books:

"Networking Linux: A Practical Guide to TCP/IP"
by Pat Eyler
ISBN # 0735710317, New Riders Publishing

Amazon.com
"LINUX TCP/IP Network Administration
by Scott Mann, Mitchell Krell
ISBN # 0130322202, rentice Hall PTR

Amazon.com
"Advanced Linux Networking"
by Roderick W. Smith
ISBN# 0201774232, Addison-Wesley Professional; 1st edition (July 15, 2002)

Amazon.com
"Linux Routing"
by Dee Ann LeBlanc, Joe "Zonker" Brockmeier, Ronald W. McCarty Jr.
ISBN# 1578702674, Sams; 1st edition (October 11, 2001)

Amazon.com
"Policy Routing Using Linux"
by Matthew G. Marsh
ISBN# 0672320525, Sams; (March 6, 2001)

Amazon.com
Amazon book image "Ubuntu Unleashed 2013 edition:"
Covering 12.10 and 13.04 (8th Edition)
by Matthew Helmke, Andrew Hudson and Paul Hudson
Sams Publishing, ISBN# 0672336243
(Dec 15, 2012)

Amazon.com
Amazon book image "Ubuntu Unleashed 2012 edition:"
Covering 11.10 and 12.04 (7th Edition)
by Matthew Helmke, Andrew Hudson and Paul Hudson
Sams Publishing, ISBN# 0672335786
(Jan 16, 2012)

Amazon.com
Amazon book image "Ubuntu Unleashed 2011 edition:"
Covering 10.10 and 11.04 (6th Edition)
by Matthew Helmke, Ryan Troy, Andrew Hudson and Paul Hudson
Surfing Turtle Press, ISBN# 0672333449
(Dec 24, 2010)

Amazon.com
Amazon book image "Fedora 18 Desktop Handbook"
by Richard Petersen
Surfing Turtle Press, ISBN# 1936280639
(Mar 6, 2013)

Amazon.com
Amazon book image "Fedora 18 Networking and Servers"
by Richard Petersen
Surfing Turtle Press, ISBN# 1936280698
(March 29, 2013)

Amazon.com
Amazon book image "Fedora 14 Desktop Handbook"
by Richard Petersen
Surfing Turtle Press, ISBN# 1936280167
(Nov 30, 2010)

Amazon.com
Amazon book image "Fedora 14 Administration and Security"
by Richard Petersen
Surfing Turtle Press, ISBN# 1936280221
(Jan 6, 2011)

Amazon.com
Amazon book image "Fedora 14 Networking and Servers"
by Richard Petersen
Surfing Turtle Press, ISBN# 1936280191
(Dec 26, 2010)

Amazon.com
Amazon book image "Practical Guide to Ubuntu Linux (Versions 8.10 and 8.04)"
by Mark Sobell
Prentice Hall PTR, ISBN# 0137003889
2 edition (January 9, 2009)

Amazon.com

   

    Bookmark and Share


Advertisements





Copyright © 2013 by Greg Ippolito