One may want to use Ethernet for a number of reasons: for a home network, for a connection to the Internet, for internal use within your business, or whatever else you can think of that a network has use for.
Due to the nearly endless possibilities of an Ethernet network, I can't cover EVERYTHING here.
Here are the sections I've divided this page up into:
The hardest part of getting your machine set up for Ethernet would probably be getting the card detected in the first place. You will probably have to enable support for your network card by checking with how your distribution is configured. Most modern distributions already have it enabled.
If you have an older Linux distribution, read up on recompiling your kernel with support for your Ethernet card enabled, as well as other stuff you might need in compiling your kernel.
My Ethernet card is labeled as NE2000-compatible; it's jumperless and I had to set the IRQ and all that other stuff in its diagnostic program under MS-DOS. That was found in the A:\UTILITY directory on the floppy, where the information was stored. Because it was jumperless, I had no option but to use the software to set the IRQ and I/O base address stuff there. In all likelihood, you probably won't need to do this annoying little step.
I can't predict all the possible configurations people might have on their individual systems, but the standard IRQ for Ethernet cards is 10 and the standard I/O base address is 0x300. If you don't know what these are, please don't hit the back button on your browser; you'll find out soon enough that this isn't really all that hard.
To enable support for your Ethernet card in your kernel, use make config, make menuconfig, or make xconfig. I recommend make menuconfig so that you can go back and fix your mistakes later. And yes, this is part of recompiling your kernel. NE2000 cards should be under "Other ISA Cards" or whatever; the only thing you need to enable it is choose the card that you need and nothing else. Choosing cards that you won't need really won't hurt you, but it will make your kernel a little bigger. But hey, if you want to play it safe and just include support for everything there, go ahead, I am not stopping you. Note that the more devices you support in your kernel, the larger it will be, and the more memory (RAM) it will use up when loaded.
If you're not sure whether your card is supported, read the Ethernet-HOWTO. That has mostly hardware information about Ethernet cards. Look at the index of the HOWTO for the information you need.
With my card, I had to use boot parameters to specify which IRQ, I/O base address, and device that my card used. In order to do that, I had to tell the kernel what to look for (known as passing arguments to the kernel). Since I had my card set to work on IRQ 10, on I/O base address 0x300, and it was my only Ethernet card, I would stick these to the "linux" part when LILO popped up:
Up there, I'm telling Linux that my Ethernet device is on IRQ 10, I/O base address is 0x300, and the device created for the Ethernet card is eth0. Again, you should type that when you boot with LILO; when LILO boot: pops up, type linux ether=10,0x300,eth0. When you boot up, it should read something like this, with perhaps a few changes depending on what settings you choose to use:
ne.c:v1.10 9/23/94 Donald Becker (firstname.lastname@example.org) NE*000 ethercard probe at 0x300: 00 40 05 48 2e 83 eth0: NE2000 found at 0x300, using IRQ 10.
You can bypass having to type in those arguments all the time if you edit your /etc/lilo.conf file and use the append keyword to pass to the kernel while it starts on your machine:
image=/boot/vmlinuz-2.2.16 label=Linux append="ether=10,0x300,eth0" read-only
Now, what if you have another card? (If you don't have one, skip on to the next section.) I got another NIC just recently, a Netgear 310tx which uses the DEC Tulip chipset. I enabled the driver during my kernel configuration; it was under the "EISA, VLB, PCI and on board controllers" section. So I recompiled and rebooted the new kernel with support for this card built in. It found it but couldn't find my old one, which I wanted it to. I wrote down the I/O base address and the IRQ that it found, which were 0x6100 and 11, respectively. (I obtained this from dmesg | grep eth; you might have luck with that too.)
So, having something like that, I made changes to /etc/lilo.conf so it would detect both cards on the next bootup. I know you're just dying to know how I did that.
image=/boot/vmlinuz-2.2.16 label=Linux append="ether=11,0x6100,eth0 ether=10,0x300,eth1" read-only
My little image section in there looks about the same as it did before, only now I've made the new PCI card be eth0 and the old one be eth1 but still with their hardware information so that Linux can find them. Remember to re-run lilo, too.
Once the card is detected, you have stuff to do. The first step, I think, would be to assign an IP address (a series of 4 numbers separated by dots representing a host or a group of hosts) to your machine. Let's just say that you're going to assign the address 192.168.1.1 to your machine. You would do this by typing the following:
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
The "netmask" part is pretty standard: it doesn't change if you're using Ethernet. The "up" at the end is simply telling Linux that you're setting your network connection active, so it's up. And if you're not paying attention, the "eth0" part after "ifconfig" is representing the device that your Ethernet card uses.
If you happen to know for a fact that you are supposed to use DHCP, skip all the little ifconfig stuff and try running dhcpcd. This might be the case if you're in a company office and plugged into their network. If you really know for a fact that you use DHCP, you can configure your machine for networking for good.
As stated in the NET-3 HOWTO, it is possible to write large volumes about routing; I, however, don't like reading unnecessary information so I'll try to summarize it into what you really need to know. Let's say you use a hub. You have an IP address of 192.168.1.0 and your younger sister has her computer set to 192.168.1.2. In order to get a ping from her machine (and not have to load Windows 95 first) you'll have to tell your machine that a hub is ready and waiting to have information passed through it.
If the machines on your network have the IP addresses 192.168.1.*, then the entire network is represented by 192.168.1.0 (192.168.1.255 officially). Since 192.168.1.0 gives you the entire network (even if you're 192.168.1.3, 192.168.1.4, 220.127.116.11, and so on), you want to contact the entire network, which, again, is 192.168.1.0. You would do this using route as root:
route add -net 192.168.1.0 netmask 255.255.255.0 eth0
Basically, if your network has machines that are assigned IP addresses that are 192.168.1.*, you represent the whole network with 192.168.1.0. If your network's machines have IP addresses of 192.168.2.*, then your whole network would be represented by 192.168.2.0 and you would type route add -net 192.168.2.0 netmask 255.255.255.0 eth0 in order to get your Linux machine to contact the rest of the network.
That should also work for networks with no hubs, if you connect the computers all to each other using those RJ-58 cables (the ones that look like TV wiring). I haven't tried it myself but few people use that kind of setup these days.
All of the above will allow you to contact hosts within your network. Now you have to be able to contact hosts outside your own local network, especially those on the Internet. You'll have to configure a gateway, a machine that's connected to the Internet and that is willing to share its connection with you. For example, if the machine with the IP address 192.168.1.5 is your gateway to the Internet, you would type this (as root) to send requests for addresses that are out of your network:
route add default gw 192.168.1.5 eth0
If you are connected to the Internet through a dialup connection using PPP (which most people are), you would do something different, depending on what machine the Internet connection is running off of. If the machine you're working on is the machine that's connected to the Internet through PPP, then you would type something like this:
route add default ppp0
That will configure your system to send requests for packets that are not in your network to the Internet through your modem. (I hope you're still following along; if you don't understand I'm not doing a good job...)
You might want to use IP Masquerading, a way to share your Internet connection with others on your network. The way it basically works is when a request is sent from a machine within your network, your machine takes a look at it and if it's "addressed" to an Internet address, your machine sends the packet out through your connection, whether it be Ethernet or PPP.
If you've got a host within your LAN that's your gateway to the Internet, then you would use route add default gw 192.168.1.5, if 192.168.1.5 is the IP address of the gateway. When your connection is shared this way instead of IP masquerading, each machine on the network (known as a node) has its own IP address on the Internet.
The information about routing and your IP address on your Ethernet network would be very inconvenient to type in every single time you want to be connected to the rest of the network, so we'll put it in your system startup files.
One easy (but very sloppy) way is to put the following example lines in the file /etc/rc.d/rc.sysinit:
route add -net 192.168.1.0 eth0 ifconfig eth0 192.168.1.1 up
I don't recommend doing it that way, but it's quick, it's simple and it's almost guaranteed to work. Should you choose to go that route (no pun intended), put the lines at the bottom of the file rc.sysinit. The right way to do it would be to use the linuxconf program in Red Hat for your network settings. Alternatively you can edit /etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-eth0, and /etc/hosts. If you're a true beginner, go ahead and use pico to edit these text files if you have no experience with Unix editors such as vim or emacs.
Your /etc/sysconfig/network file may look something like this:
NETWORKING=yes HOSTNAME=methuselah.lan DOMAINNAME=lan GATEWAY=192.168.1.5 GATEWAYDEV=eth0 FORWARD_IPV4=no TIMESERVERATBOOT=no TIMESERVERTYPE=ntp TIMESERVERHOST=(none) TIMESERVERRESYNC=(none)
And your /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0 IPADDR=192.168.1.1 NETMASK=255.255.255.0 NETWORK=192.168.1.0 BROADCAST=192.168.1.255 ONBOOT=yes
Finally, your /etc/hosts:
127.0.0.1 localhost localhost.localdomain 192.168.1.1 methuselah.lan methuselah
(Something else to note about /etc/hosts is that it might be the reason that your sendmail or Samba startup is slow on bootup; because it can't figure out what to do with the hostname that you set for your computer.)
The equivalent I found on Slackware a while back was that you can just edit /etc/rc.d/rc.inet1 (or the other rc.inet* file) and it will set it for you automatically. You specify the values of certain things like your IP address and broadcast address (and more, of course).
So if you're going to edit one of those files, just go ahead and use your favorite text editor (pico, vim, vi, emacs, joe, jed; the list goes on).
On the Windows 95 machine, if you have one on the network, start by clicking on the Start button, then going to Settings, then Control Panel, and finally Network.
In the Network dialog box, if you haven't already, add a TCP/IP service for your Ethernet card, if you haven't already. Highlight TCP/IP for your Ethernet adapter, and click on the Properties button. Fill in the information that you need, such as the gateway IP address (the Linux box if it's running IP masquerading), the nameserver (your ISP's nameserver), the IP address assigned to your machine within your network (such as 192.168.1.2), and any other stuff you might have to fill in.
You can also run winipcfg to see if you currently have an IP address on the network.
That's about all I know about setting up the Windows box, so let's move on. Hopefully you have whatever other machines (nodes) on the network already set up.
To test if your connection works, try pinging another host on your network. Let's say your machine is 192.168.1.1 and the other machine, the one you're going to ping, is 192.168.1.2. This is what you'd type to start pinging the host:
If lines periodically appear and look something like this, your connection works:
64 bytes from 192.168.1.2: icmp_seq=0 ttl=32 time=1.2 ms 64 bytes from 192.168.1.2: icmp_seq=1 ttl=32 time=1.0 ms 64 bytes from 192.168.1.2: icmp_seq=2 ttl=32 time=1.0 ms 64 bytes from 192.168.1.2: icmp_seq=3 ttl=32 time=1.0 ms 64 bytes from 192.168.1.2: icmp_seq=4 ttl=32 time=1.1 ms
To stop pinging, type Control-C (Ctrl+C) to get back to the prompt.
If you have trouble and are wondering how to solve your problem, either solve it yourself and give me a summary of your scenario, or alternatively, ask for help. And, as usual, suggestions are always welcome.
Copyright © 1997-2000 Joshua Go (joshuago at users dot sourceforge dot net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.