ARTICLE

Ask Dr. UN*X
Contributed by Brian Wilson in Network on 2006-03-01 05:35:34

Dr. UN*X gets an email from Adrian saying that he recently added a second DSL line and he wants remote sites to be able to connect to his system using either DSL lines.
Read on and see Dr. UN*X's answer to Adrian.

Two networks = twice as much fun

Dear Dr. UN*X,

I am currently using my Linux box as a server on the Internet, and it's all working fine. The installer program configured the network interface for me. I am currently using a single DSL line but now I have added a second line and I want remote sites to be able to connect to my system using either DSL line.

I have already installed a second network card, but the system does not see it. I checked the card maker's site and there are no Linux drivers for it!

I don't need to do anything fancy (yet) like load balancing, I just want to be able to support two outside IP addresses.

Where do I go from here?

--Adrian

Well Adrian,

You have three main issues to address here. First, you need to get the system to recognize your new hardware. Second, you need to configure the interface as a network connection. Third, (the hard part) you will need to use an advanced routing system call 'iproute2' to support the two lines correctly.

Working with iproute2 is fairly involved so I will deal with the basic hardware and network issues this time and save iproute2 for my column.

The hardware

Many distributions have a program that runs at boot time to detect new hardware; Redhat and its kin use 'kudzu'. Ubuntu and some other Debian derivatives use 'discover'. But since you are asking this question, I assume your system does not have any such support; we will figure it out ourselves. Other readers, I think you will find some of the tools presented here interesting even if your system has automatic detection.

Personally, I disable hardware detection on my servers for two reasons. I don't want the delay at boot, and I don't want the hardware configuration to change without my direct attention.

Though there are many hardware manufacturers who do provide Linux drivers these days, more frequently you will find they do not. This is not as bad as it would seem. There are hundreds of network cards out there, but there are only a few manufacturers of the chipsets that go on them. That means that your network card is almost certainly built with a chipset that your Linux distro already supports. It's possible that you have an oddball card with special unsupported features but unlikely, especially if it's relatively new.

The real trick here is figuring out which driver module to load.

Linux is based on a "monolithic kernel"; the kernel is the main program that stays in memory at all times to perform all basic operating system functions. Drivers for devices such as network cards are implemented as modules. Modules can be compiled right into the kernel, but modern general purpose Linux distributions come with the network drivers compiled as separate, loadable modules; these can be loaded (and unloaded) after the system has booted. By only loading the modules you need for your configuration, the system conserves memory space. No reboots are required to load or remove modules, so lots of kernel reconfiguration can happen seamlessly on running systems.

What chipset do you have?

If you know what you are looking for, you can read the data right off the chips themselve but since you are beginner this is probably the last thing you should try. Besides, the board is installed and your computer is running already, right?

Reading the description from the box the board came in would be a better path. You want the manufacturer name and the model number, such as "Netgear FA-311". Having this information lets you look up what you need online. But even if you got a bare board at a rummage sale you can still press ahead by asking the board to tell you about itself. Every PCI card has model information embedded in it.

Before we go any further, I should mention here that if you have installed a second card based on the same chipset as the first, they will share the same driver. You can stop now if this is the case. When the system booted up, it will have found the new card and written out a log message. Look for it now with this command:

dmesg | grep eth1

This command pipes output of command 'dmesg' into a 'grep' command which searches for the string 'eth1'. (The device name for the first card is eth0, the second is eth1, and so on.) If you are lucky you will see a line starting with 'eth1:', for instance

eth1: ADMtek Comet rev 17 at 0xf800, 00:02:2A:B8:23:D7, IRQ 10.

This means that a driver for the second ethernet interface (/dev/eth1) is already loaded and you can skip to the next section.

Using lspci

If your system has the 'pciutils' package installed (if not you should install it now) you can type "lspci". Output on one of my older servers with 2 network interfaces looks like this:

00:00.0 Host bridge: Intel Corp. 440LX/EX - 82443LX/EX Host bridge (rev 03)
00:01.0 PCI bridge: Intel Corp. 440LX/EX - 82443LX/EX AGP bridge (rev 03)
00:07.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 02)
00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB (rev 01)
00:07.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 02)
00:0d.0 VGA compatible controller: S3 Inc. ViRGE/DX or /GX (rev 01)
00:0e.0 Ethernet controller: Linksys Network Everywhere Fast Ethernet 10/100 model NC100 (rev 11)
00:10.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 02)

The last two lines tell me this server has a Linksys card and an Intel Ethernet Pro 100.

Behind the scenes, lspci reads a table maintained by the kernel called /proc/bus/pci/devices. You can dump out that file with 'cat /proc/bus/pci/devices'. There are bits of potentially useful information here in the last column if you don't have lspci.

Now that you have an idea of what kind of board you have, check the "Linux Ethernet Howto" available at "The Linux Documentation Project" or possibly the network page at Scyld. (Links are in the resources section below.) By the way, it's a good idea to read these docs before you buy new hardware! You can learn what to look for to get the best card for your application.

You will probably find an entry for your card; if not, there is additional information in the "howto" on identifying PCI cards too. Let's say that I want to set up the Linksys card in this server. Based on the entry in the "howto" my guess is that it is a 'tulip'-based card.

Now, Linux is wonderful, but I should mention that you could lock up your system by messing around with loading and unloading kernel modules, so you probably want to proceed with caution here. Don't do this when the server is being used to print your paycheck.



Article Index
Ask Dr. UN*X
Chipset revealed
Test the completed setup
Resources
 
Discussion(s)
minor improvement regarding the test of
Written by izolan on 2006-03-06 02:42:42
snippet from the article:

Test the completed setup.

Without rebooting, you can shutdown and restart the complete networking subsystem with these commands from the console. (Doing the 'stop' will cut you off if you are logged in remotely! If you think this is blatantly obvious, you probably have not done it yet. Be careful.)

/etc/init.d/networking stop
/etc/init.d/networking start

================= beter solution is =============
/etc/init.d/networking restart

By doing it in this way, you can restart the networking on the REMOTE machine without a fear to be cut off

Discuss! Reply!

Remotely Restarting Network Services
Written by Ron on 2006-03-06 07:31:51
Quote:

From the article:
" Without rebooting, you can shutdown and restart the complete networking subsystem with these commands from the console. (Doing the 'stop' will cut you off if you are logged in remotely! If you think this is blatantly obvious, you probably have not done it yet. Be careful.)

/etc/init.d/networking stop
/etc/init.d/networking start"





Please note I've only tested on a Fedora Core 3 system and I'm not guaranteeing this will work for everyone.

On a fedora core based system you can issue the command:
service network restart
to stop and start the networking services. I tested that command from an ssh session and I didn't even get disconnected!

you can also chain the commands together:
#> /etc/init.d/networking stop; /etc/init.d/networking start

I would recommend remotely logging in, starting a screen session and chaining the commands together so that even if you get disconnected when the network stops, the commands will complete by virtue of the screen session.

As I say, its not a fully tested solution, please use at your own risk.
Discuss! Reply!

Strange Domain name
Written by Allan Registos on 2006-05-06 22:59:40
Hello Dr. UN*X

I have been using Fedora Core 4 for sometime now and got to learn a lot of its features. I am also investigating the features of CentOS and now im using it at the time of this writing. But before all this, we are using a Windows NT 4.0 sp6 server with Exchange 5.5 as an Internet sharing and Email server. The problem is our Windows has been sending a lot of Spams, I think it was infected as a ghost PC. This triggers me to use an alternative OS that is stable and more secure than windows. Aside from the spam generated by the NT server by using a fake address and real address by some employees here, it uses the name ´´ in the from field. When I tried to scan my our IP addresses here, the local IP registered this strange name: indus.cmie.ernet.in !!! .in shows that its from India. And when I run linux and run this command: netstat -tap I can still this domain as affiliated with my local/internal IP:

tcp 0 0 indus.cmie.ernet.in:domain *:* LISTEN 4345/named
tcp 0 0 192.168.0.2:domain *:* LISTEN 4345/named

I am confused why this was so...

Thank you in advance...

Discuss! Reply!