ARTICLE

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

Chipset revealed

Using the command 'lsmod', you can see what modules are already loaded.

Here is output from lsmod on my sample system

# lsmod
Module Size Used by Not tainted
sd_mod 10316 0 (autoclean) (unused)
scsi_mod 86068 1 (autoclean) [sd_mod]
i2c-dev 3492 0 (unused)
i2c-core 12228 0 [i2c-dev]
ipt_state 504 3 (autoclean)
ip_conntrack 19044 0 (autoclean) [ipt_state]
iptable_filter 1644 1 (autoclean)
ip_tables 11776 2 [ipt_state iptable_filter]
8139too 12776 1
crc32 2848 0 [tulip 8139too]
eepro100 18548 1
mii 2144 0 [8139too eepro100]
raid1 12688 3

To load the 'tulip' module, type the command 'modprobe tulip'. In classic UNIX fashion, this command gives no feedback if it works, only if it fails.

Trying to load a module for which there is no network card installed does not hurt anything (in my experience). Modprobe will load the module, the module will look for hardware, and if it does not find anything it will exit with an error like "init_module: No such device".

Success just gives you another command line prompt, but some useful output will be written to the kernel log file, which you can list by typing 'dmesg'; the last few lines of output are the interesting ones; on my system after loading the tulip driver I see this:

Linux Tulip driver version 0.9.15-pre12 (Aug 9, 2002)
PCI: Found IRQ 10 for device 00:0e.0
tulip0: MII transceiver #1 config 3100 status 7849 advertising 05e1.
tulip0: MII transceiver #2 config 1000 status 7849 advertising 05e1.
tulip0: MII transceiver #3 config 1000 status 7849 advertising 05e1.
tulip0: MII transceiver #4 config 1000 status 7849 advertising 05e1.
eth1: ADMtek Comet rev 17 at 0xf800, 00:02:2A:B8:23:D7, IRQ 10.

The first line identifies the module itself and the subsequent ones are the output it generated as it probed for ethernet cards and initialized itself. The good news is the line starting with 'eth1'. This means the card is now available as network device /dev/eth1. Success!

Once you have figured out which driver you need to have loaded, you have to arrange for it to load every time it is needed after you reboot the system. You do this by adding line(s) to the modprobe configuration file (Alas, this config file goes by different names on different distributions and sometimes even different releases of the same distro. A common name is /etc/modprobe.conf, and /etc/modules.conf is another one. On Debian-based systems, look in the /etc/modutils/ directory.)

In my example, I'd see the eepro100 line for the Intel EtherPro card and add another after it, like this:

alias eth0 eepro100
alias eth1 tulip

Each 'alias' line associates a device (in this case /dev/eth0 and /dev/eth1) with a particular driver, so that when the system tries to configure a given device using its device name, the module system will be able to automatically find the right driver and load it.

Using the module loader, on reboot the system won't automatically load the unless you reference it from your network configuration. That's your next step. (You can force loading of modules at boot but that is another story. You don't need to do that for network drivers.)

Now we configure the network interface

Now that you have configured your system to load the right driver for your card, you have to configure the network interface.

Distros vary a lot in how they support configuration of a network interface. Most have some kind of text- or desktop-based control panel for doing network configuration. But again, it's more instructive to lift the hood and look inside. If you learn what's going on inside, you can debug the system much more easily.

In your case you are adding a second interface using another DSL line, so what you want to do is copy the existing setup for the first interface and then edit it.

The systems that I have worked with fall into two camps, Redhat and Debian.

Redhat-like systems

This includes Mandriva and Trustix, among others. SuSe is similar.

The Redhat (and similar) systems keep things in /etc/sysconfig. The 'network' file defines the primary interface and gateway (usually Internet router). Then in /etc/sysconfig/network-scripts, you will find an individual file for each interface. As a starting point I'd suggest not touching /etc/sysconfig/network. Go into /etc/sysconfig/network-scripts and copy the eth0 file, and edit it to support your new interface. (SuSE uses the same idea but files are moved around. Can't have things to simple.)

This is what a typical network file looks like:

# cd /etc/sysconfig
# cat network
NETWORKING=yes
HOSTNAME=mercury.mydomain.com
NOZEROCONF=yes
GATEWAYDEV=eth0
GATEWAY=66.224.50.232

Here are commands to create and edit the file for your new interface:

cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth1 # Copy the existing interface config file
gedit ifcfg-eth1 # (or use whatever text editor you want)

You have to change the file as appropriate for your needs; in your case, using a second DSL line, the interface should be able to get an IP address from the DSL gateway, so you can leave it set to dynamic addressing.

DEVICE=eth0	         # All I'd have to do is change this line to read "eth1"
BOOTPROTO=dhcp
ONBOOT=yes

Debian-based

This includes Ubuntu, which is the desktop software I am using right now.

Debian-based systems keep all the networking settings in files in the directory /etc/network/. You will want to edit the interfaces file, and add a new block there to describe the new interface.

These are the commands to edit the file...

# cd /etc/network
# gedit interfaces

...and these are the lines in the file

# The primary network interface
iface eth0 inet dhcp

# Added these lines to activate second network interface on 20 Feb 2006
iface eth1 inet dhcp

Activating the new interface

Turning on and off just the new interface can be done with 'ifup eth1' and 'ifdown eth1' respectively. Output from these commands varies on different distros; mine gives lots of feedback, some give none. Either way after running either command, you can look at the current settings by running the command 'ifconfig eth1'. You will want to make sure the interface got an IP address from the DSL router after running 'ifup', so look for the 'inet addr' line. If the address line is missing, DHCP failed. Check cabling and make sure your new DSL provider actually uses DHCP to provide the address. More details than this are really beyond the scope of this column. See the resources section below for more info.

Here is the output for a functioning interface.

# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:04:75:C1:CB:4A
inet addr:192.168.123.247 Bcast:192.168.123.255 Mask:255.255.255.0
inet6 addr: fe80::204:75ff:fec1:cb4a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1749454 errors:0 dropped:0 overruns:0 frame:0
TX packets:1185618 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1660257798 (1.5 GiB) TX bytes:364994034 (348.0 MiB)
Interrupt:11 Base address:0x1000


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!