|Linux Know-How provides a collection of introductory texts on often needed Linux skills.|
|Home Newbie Guide Administrator FAQ Networking How to set up my home network?|
|See also: How to use Samba?, IP Masquerading|
|Search the VIAS Library | Index|
How to set up my home network?
Hardware. Your hardware must be set up properly. Your network card should have been autodetected and set up during the initial Linux installation. If you added a network card later, chances are it was autodetected and configured during a subsequent bootup (by kudzu). If it wasn't, you may want to set up your network card now. If you have more than one network card on your computer, you may also need to set up the second cards manually, since Linux will autodetect only 1 network card.
Under Linux, most drivers for network cards are implemented as kernel modules. So setting up a card manually involves just inserting the proper module with its parameters. You don't need to recompile the kernel, nor even reboot your computer (unless you have a very uncommon card). To figure out what module(s) and parameters you need, you may want to consult the documentations that comes with the kernel source code, e.g.:
If needed, you can list all the modules available for your kernel using something like:
modprobe -l | more
If you need more help, see the Linux Network Administrator Guide (file /usr/share/doc/LDP/nag on your system or check http://www.tldp.org/LDP/nag/). This excellent guide is known as nag.
In most cases, you don't have to specify the parameters (IRQ and address) for your module--the module will know what they should be. However, the parameters were a problem during my setup of two network cards on one computer--you must make sure that you don't have any hardware conflicts. A common source of problems is that the card wants to configure on IRQ 5, which is occupied by the SoundBlaster, or IRQ 3 which conflicts with the second serial port (COM2, cua1, ttyS1). Inspecting the files /proc/interrupts, /proc/ioport and reading bootup messages may help.
For example, my WD8013 card (same as SMC Elite and SMC Elite plus, according to nag) runs under IRQ 10 (set by a jumper on the card and I specified the IRQ in the kernel module setup), under the address 0x300 and uses the "WD" module. My "SMC EtherEZ" card (no jumper settings on the card) runs under IRQ 9, address 0x240 and uses "SMC EtherEZ" module. Please make sure you don't omit the leading "0x" in the address--it means "hexadecimal" and must be there else the number will be interpreted as decimal.
After the module is inserted, you may want to inspect the file /proc/modules to see if the module is indeed loaded (or run lsmod as root). The module configuration file is /etc/modules.conf so if you encounter difficulties (for example, I had difficulty removing modules inserted by mistake), just edit and adjust this file manually, e.g., using pico.
Network configuration. After setting up the network cards and connecting the network cable, set up the network by running (as root):
This program has help! netconf can also be run under GUI, but I did not really try it. If you need more understanding of how networking works, you may want to read the previously mentioned nag. Also, reading this material may be of help: http://ieee.uow.edu.au/~mjp16/wylug-netlinux/notes.html.
It also contains very clear examples on how to set up a small office network that, like our home setup, has only part-time connection to the outside world.
How and what to fill up in netconf depends on your network. You surely want to fill up "Basic Host Information" (enable the first ethernet interface, eth0, fill in the name, aliases and IP number of your local computer) and the "Information About Other Hosts" (names, aliases and IPs of other computers on your home network). This information goes to the files: /etc/hosts and /etc/sysconfig/network, so you may want to inspect these files and adjust them manually.
When setting up the network, don't mess up with the "loopback driver" which has the IP 127.0.0.1. It is always there--it is the IP through which the computer talks to itself.
If you don't have an IP address (as will typically be the case for a home network with no permanent connection to the outside world), you may want to invent one. It does not matter very much what it is since when connecting to the outside world by your modem, you will be dynamically allocated an IP address (a machine can have many IP addresses at the same time). Your invented IP must be formally correct and the net mask must match the class of the network (class A, B or C). See the chapter on IP addresses in the already mentioned Network Administrator Guide (nag) (file /usr/doc/LPD/nag on your system, or if you don't have it, download it now from http://metalab.unc.edu/mdw/index.html#guide.
For a home network, you might want to invent a class C network (up to 254 machines, the smallest) IP number which has the first three digits between 192 to 223. The last three digits identify the machine on your class C network and must be between 1 and 254 (don't use 0, it means "whole network" or 255 which is the "broadcast address"). The middle two sets of digits can be anything from 0 to 255. Thus 184.108.40.206 is the first machine on the class C network 220.127.116.11 (the last zero signifies the whole network), with the broadcast address 18.104.22.168. The network mask for a class C network is always 255.255.255.0 (unless you subdivide your network into smaller "subnet", which is not discussed here).
Rather than completely inventing an IP number, it might be safer/better to use one of the numbers reserved for "private networks". For me, the IP number 192.168.1.1 works just fine. This way, your "invented" IP address is guaranteed never to interfere with any IP that may exist in the world.
Typically, the first machine on a network is the one that is expected to have the connection to the outside world (since it was connected first, but there is no standard for that). So, I filled up the GATEWAY to xxx.xxx.xxx.1 (my first machine) on all machines, except for the machine xxx.xxx.xxx.1, where I left this field blank. Actually, although I left the field blank, netconf inserted the gateway 0.0.0.0 into the /etc/sysconf file. This was a source of an annoying error message during the loading of the network card on the bootup. To get rid of the message, I edited /etc/sysconfig/network and set it to something like this:
[You don't want a gateway on your ethernet interface on this machine if it does not lead to the outside world. The ppp interface on this first machine will be set up as a default gateway once you connect through your modem, e.g. using kppp.]
The name of a computer is entirely arbitrary--the main user normally chooses a short word s/he likes. The domain name of the home network is also entirely arbitrary, unless you have a permanent connection in which case a domain name is registered to you. Try to invent something that does not exist yet--it could make your life easier once you have a permanent connection.
As for the DNS (domain name server, also called "named" = name daemon), RedHat 5.2 and 6.0 comes with DNS preinstalled as "caching-only" so it is easy to configure as such. You may also choose not to use local DNS at all--if your local DNS is looking up an "outside" server and can't find it, it can be a real show-stopper (the machine can appear to be hanged for up to a few minutes). To use local DNS, the "named" service must be enabled-- check this by running setup. To set up the caching-only DNS, fill up the appropriate boxes in netconf. E.g., I filled "nameserver 1" to my first machine on all computers (I entered the loopback address 127.0.0.1 on the machine xxx.xxx.xxx.1, and the proper xxx.xxx.xxx.1 address on all other machines).
No routes to other networks and hosts were required in my network, since I don't have other local networks. So I left this field blank.
Other than setting up the hardware correctly and filling up the info under netconf on each computer, as described above, I did not have to do anything on the standard RedHat to get my network working.
Reboot all computers one by one in any order (this is not necessary, but won't hurt you) and watch the boot messages (if they scroll too fast off screen, use <Shift><PgUp> to scroll up, or use dmesg from the command line to view them later). Did your cards configure correctly? Use the command route (as root) to see if the eth0 interface is running. Use the ping command to test the connections between individual machines. Try to telnet your local computer to see it the loopback-only (lo) interface works:
After a successful login, you can exit the telnet session by typing
Finally, try to telnet another computer on your network:
If this works on all machines, your eth0 network interface is set up.
After setting up your ppp and connecting to your Internet Service Provider (ISP), you will have another network interface (ppp0) and then will be able to telnet any machine in the world.
Here is a summary of the meaning of IP numbers.
The IP number (sometime called "IP address") is split into four groups of numbers separated by dots. E.g., 22.214.171.124 is a fromally-valid IP number. (All numbers here are shown in their decimal representations.) Within each group of numbers, the value may range from 0 to 255 (8 bits). The group of numbers from dot to dot is often referred to as an "octet" because it has 8 digits in its binary representation. The address contains a "network number" followed by "host number" (a host is an individual computer within a network). The network may be denoted by one, two, or three octets. The host is the trailing balance of the IP number (three, two, or one octet, respectively).
When the host number is filled with zeros (in all octets that denote the host), the resulting IP number is interpreted as referring to this host (therefore, the number is called "the network number"). When the host number is filled with 255 (in all the octets), the IP address is interpreted as all hosts on the network (and called "the broadcast address"). When the network number is filled with zeros (in all the octets that denote the network), it is interpreted as referring to this network. If the network number is filled with 255 (in all its octets), it refers to all networks.
Networks are divided into 6 classes. The most important are class A, B, and C.
Private address spaces. The following IP number ranges are reserved for private internets:
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
From among these, an IP number is selected for a network which is behind firewall (or which has no connection to the world-wide web). The balance of the valid IP addresses are registered and resolved by a DNS server.
Default route. This is a special IP address 0.0.0.0. It is used to mark the default network interface i.e., the hardware to which the traffic will go on default. For example, the default route may be assigned to eth0 (the symbolic name for the first ethernet card) or eth1 (the second ethernet card), or ppp0 (the first point-to-point modem connection), etc.
Local host. This is a special IP address 127.0.0.0 (a class A network). It is used for traffic local to the computer and does not involve any real network hardware or access physical networks. It is often called "loopback address". A computer may have many IP addresses at the same time; therefore, it typically has the 127.0.0.0 loopback address, as well as another IP address which is individually assigned.
|Home Newbie Guide Administrator FAQ Networking How to set up my home network?|