Home Networking, glossary and overview

ArticleCategory: [Es gibt verschiedene Artikel Kategorien]

AuthorImage:[Ein Bild von Dir]

TranslationInfo:[Author and translation history]

AboutTheAuthor:[Eine kleine Biographie über den Autor]

Guido is a long time Linux fan. All his computers in the house
are integrated into a network.

Abstract:[Here you write a little summary]

Networking becomes more and more popular. Your old 486 can perfectly work
as file-server or run IP-Masquerading to give the whole family Internet
access from different computers at the same time.
This article will provide you with the basic overview to start
a home network. It will explain the vocabulary which you need to
understand literature and other articles on networking. The focus of the
article is a small scale home network.

ArticleIllustration:[This is the title picture for your article]

ArticleBody:[The article body]

10Base2

This is an Ethernet with 10MBit/s over coaxial cable. The ends of the cable must
be terminated on both ends with a 50 Ohm resistor. The total length
of the cable may not be more than 185 meters. The minimum distance between
the cards should be more than 0.5 meters. The network cards are connected
to the cable using a T-connector. No Hub is required and the cards are all connected directly
to the cable.This is probably the cheapest setup for
a home network. It is also called "cheapernet".
It is important that the cable runs directly from network card to network
card (bus topology). There must not be any cable between the card
and the T-connector.

10baseT

Ethernet with 10MBit/s using twisted pair cable. Every card is connected
via twisted pair cable to a central point called hub. This results
in a star topology of the network.
The cable length
between card and hub should not be more than 100 meters. If you want to
connect only 2 cards then it is also possible to leave away the hub and
use a cross-connect cable.

100baseT and 100baseT4

This type of
network uses also twisted pair cable (as 10baseT ) but runs with
100 MBit/s. For most home applications the cheaper 10MBit/s networks
should be more than sufficient. 100baseT uses pairs 2 and 3 from the
twisted pair cable. 100baseT4 uses all 4 wire pairs.

RJ-45 Connector

This is the type of connector used for the 10baseT, 100baseT and 100baseT4
type of networks. It is a small flat plastic connector with 8 pins.

10baseT uses pairs 2 and 3 only

100baseT uses pairs 2 and 3 only

100baseT4 uses pairs 1,2,3 and 4

Pin

Name

Description for 10baseT

1

TX+

Tranceive Data+

2

TX-

Tranceive Data-

3

RX+

Receive Data+

4

n/c

100BaseT4 only

5

n/c

100BaseT4 only

6

RX-

Receive Data-

7

n/c

100BaseT4 only

8

n/c

100BaseT4 only

Note:

TX & RX are swapped on Hub's.

Note: you need special pliers to connect the RJ-45 connector to
the cable.

Cable types

The following cable types are common:

50 Ohm coaxial cable. Used for 10base2 networks, max 10 Mbit/s

Twisted pair:

UTP (Unshielded Twisted Pair) cable, the cheapest type of Twisted Pair cable,
thin and flexible as there is not shielding. The chances for radio
interferences are high. Radio
interferences can go in both directions. You may disturb a close by
short-wave radio receiver and a longer cable can also pick up strong
electric fields (e.g from an electric heating going on and off).
This cable is however totally sufficient for home networking where
the distances are usually only a few meters.

STP (Shielded Twisted Pair) cable with one single shielding going around
all the wires. This cable is very common. It is still a bit flexible and
also not very expensive. Possibilities for radio interferences are reduced.

STP (Shielded Twisted Pair) cable will separate shielding around each
wire pair. Expensive and not recommended for home networking.

The different Twisted Pair pair cable types are standardized
in categories according to their attenuation.

The mapping between the pins on the RJ-45 connector and the Twisted Pair
wires is standardized. There are several standards and they use slightly
different colors. Valid pin assignments are:

Wire pair number

Connector pins

standard 1

standard 2

standard 3

standard 4

1

4/5

blue/white

white/blue

white/blue

white/brown

2

3/6

white/green

red/orange

cyan/purple

green/yellow

3

1/2

white/orange

black/green

white/orange

grey/pink

4

7/8

white/brown

yellow/brown

cyan/purple

blue/red

Cabling is really only relevant if you want to run 20 or more meters
of cable through the whole house. If you want to connect just a few computers
in the same room then you can get cheap ready made cables with connectors. These
are typically available with a length between 1 and 10 meters.

Cross connect cable

This is a special cable to connect just 2 network cards over twisted
pair cable. You need only a HUB if you want to connect 3 and more
Computers. The cross connect swaps RX and TX. The
2 connectors are connected as follows:

Pin No

Pin No

1 connected

to 3

2 connected

to 6

3 connected

to 1

4 connected

to 5 (100baseT4)

5 connected

to 4 (100baseT4)

6 connected

to 2

7 connected

to 8 (100baseT4)

8 connected

to 7 (100baseT4)

9 connected

to 9 (100baseT4)

You can also buy ready made cross connect cables
with connectors.

Hub

A HUB is needed for networks with twisted pair cable and more than
2 computers. The HUB amplifies the signal from a computer and distributes
it to all other connected computers. For home networking you typically want
a 5 or 8 port "work group hub". Ethernet switches can also be
used instead of HUBs but they are far more expensive and make only
sense if you expect high traffic with many computers connected to
the network.

LAN

LAN stands for Local Area Network and denotes a broadcast network.
A broadcast network is a network where each computer can reach
each other computer without going through a router.
E.g all computers connected along one coaxial cable or all computers
connected to one HUB form a LAN.

Cards

My personal experience is that the cheapest cards are the best.
The more expensive ones do usually not give you any additional
features. ISA PNP cards may cause trouble. Most cards which are
sold as ISA PNP cards come with a DOS floppy disk and software
where you can change the flash ROM settings of that card and
configure it to not use PNP. You can set a fixed interrupt and IO address.
(Note: if you have
a PNP bios then you must also tell it to disable PNP for this interrupt).
The standard IO address is normally io=0x300. You can see which
address and interrupts are already used by typing:
cat /proc/interrupts /proc/ioports | more
(Note: These are the interrupts and addresses which are really used by
a driver at the moment.)

If you bought such an ISA PNP card then you will probably find
that the DOS floppy disk is not of much use for a Linux only user.
You or a friend
might have an old boot-able dos floppy somewhere. Copy the program
that came with the network card to that floppy. Boot from it and change
the setting of the network card.
The settings are stored in flash Rom so, you just do this once after you
installed the hardware and then never again.

The cheapest cards are usually NE2000 cards and cost today about
$15 (or 15 Euro). These are well supported
under Linux. NE2000 cards are available as ISA or PCI bus cards.
The ISA bus cards need the kernel modules "ne" and "8390".
You can either let the driver probe for it or provide IRQ and IO at
the command line.
Loading of kernel module without auto-probing can be done as follows:
insmod 8390insmod ne irq=10 io=0x300

With a PCI card you don't usually have any trouble with interrupts
and IO addresses but they are a bit more expensive. The kernel modules
for the NE2000 PCI cards are called ne2k-pci and 8390.

Network interface

The network interface is physically represented by your network
card but the term network interface is also used for the representation
of a software name to which you assign an IP-address. If you have
a modem and an Ethernet card on your computer then you have
already at least two IP addresses and network interfaces for this one
computer. An IP addresses is always assigned to a network interface
never to a host (computer). You can uniquely drive the hostname from the
IP address but there is in general a one to many relation between
hostname and IP address. The command ifconfig is used to print the
settings for the different active network interfaces and you can use this
command also to configure a network interface. Here is an example
printout:

Routing

Your Linux kernel has an "internal IP router". The routing
table tells it what to do with an incoming IP packet. Dependent
on the IP address of that packet you can decide in the routing table
where to send it to. Under Linux you can type
/sbin/route or netstat -r
to see the routing table but the standard Unix command is netstat -r.
How to set up the routing would be beyond the scope this article and there will
be a separate article covering this subject.
The Linux Network Andministators's Guide (www.linuxdoc.org/LDP/nag/nag.html) is one good online source
for more information on how to set up routing.

PLIP

Parallel port IP is a possibility to use the parallel port as
network interface. The kernel configuration parameter
is called CONFIG_PLIP and you should preferably configure it as
module. PLIP is a cheap possibility to connect your Laptap to another
computer and via this computer to your home network. You need to buy
a parallel port cable with 2 male connectors also known
as LapLink cable.
If you want to build the cable your self then the wiring is:

Pin No

Pin No

17

to 17

25

to 25

2

to 15

3

to 13

4

to 12

5

to 10

Pin No

Pin No

6

to 11

15

to 2

13

to 3

12

to 4

10

to 5

11

to 6

PLIP is not as fast as Ethernet but the speed is already sufficient
for decent networking applications like e.g NFS.

IP addresses

You need to decide which addresses to use for your network.
Normally you will get one IP addresses assigned form your Internet
service provider when you "go online". This IP addresses
is more or less automatically assigned to the ppp interface. You do
normally not have to worry about it.
What you need to decide now is what addresses to assign to the
other interfaces of your private network (e.g eth0 and plip1 interface).
A number of addresses are reserved for private use. This addresses are not
routed in the Internet and can not cause you any trouble when
you re-use them. Their ranges are:

Netmask

Network Addresses

255.0.0.0

10.0.0.0 - 10.255.255.255

255.255.0.0

172.16.0.0 - 172.31.255.255

255.255.255.0

192.168.0.0 - 192.168.255.255

The first block is a single Class A network number, the second block is
a set of 16 contiguous Class B network numbers, and the third block is
a set of 255 contiguous Class C network numbers.

Which address should you pick? Well, it does not really matter but
I recommend using consecutive numbers. E.g you have 2 computers
connected via Ethernet and you need now 2 addresses to assign to
the 2 network cards (you assign it to the software representation
of the cards. This software representation is called interface). Just use
192.168.0.1 and 192.168.0.2

Files

Most distributions come these days with pretty graphical
user interfaces (GUIs) to
configure networking (e.g yast or netcfg). You can use them if you want.
Refer to the user manual of your Linux distribution on how to use them.
This article shall not focus on a specific distribution. It explains
therefore the underlying configuration files that will somehow magically
be modified if you use the GUIs from your distribution. This gives
you also the possibility to verify what the configuration GUIs did.

/etc/hosts and /etc/host.conf

For a small home network it does not make much sense to have DNS
server running. Instead you can just enter the names of the machines
in a file called /etc/hosts
Example:

Together with the file /etc/hosts goes a file called
/etc/host.conf where you say how to resolve names.
You should use the following in this file:

# /etc/host.conf
order hosts bind
# Allow multiple addrs
multi on

/etc/resolv.conf

The file /etc/resolv.conf says where to resolve anything
that can not be found in /etc/hosts. You need to ask
your ISP for the ip address of his DNS server. You should enter
more than one DNS server if possible. If the first DNS server is slow
or down then the next will be asked. The syntax is:

setting the hostname

/etc/HOSTNAME or (/etc/sysconfig/network for redhat) is a file where many distributions configure
the name of the local machine. But in reality the host name of a machine
is set via the command hostname. What happens in these distributions
is that during startup (e.g /etc/rc.d/rc.sysinit) the file /etc/HOSTNAME
is read and then its content is feed to the command hostname.
Which file is exactly used depends really on the peculiarities of your
specific installation. It should however now be easy for you
to investigate this since you know that you should grep for hostname.
Example how to set the hostname:

hostname obelix.mynet

tcp wrapper

/etc/hosts.allow this is a configuration file for a security
system called tcp wrapper.
All you need to know, is that you should
add the ip-addresses of all the machines in your local network, excluding
the machine where this file is located, behind the keyword ALL:.
Example: obelix has 2 network interfaces that go to other hosts in
your local net. The interface with the ip address
192.168.0.2 goes to asterix and the interface with the ip address
192.168.0.3 goes to idefix.
In this case you write:

# hosts.allow
# See tcpd(8) and hosts_access(5) for a description
ALL: 192.168.0.2 192.168.0.3

If you run a NFS server on obelix then you need also to add the
line

portmap: 192.168.0.2 192.168.0.3

Network File System (NFS) gives you the
possibility to access files on other host as if they were locally on
the disk.

/etc/hosts.deny is also for the tcp wrapper it should never be changed
and should always look as follows:

portmap: ALL
ALL: ALL

/etc/hosts.equiv

/etc/hosts.equiv allows local users to log into other machines
(e.g with rsh) without password. You may decide if you want this.
The syntax is: On full name (as in /etc/hosts) of a trusted host
per line. E.g

asterix.mynet
idefix.mynet

/etc/hosts.lpd

The /etc/hosts.lpd file is important if you would like
to enable network printing services via lpd. How to configure
network printing is another story but this file must be present on
the machine where you run the lp-daemon and it must list the names
of all the machines that are allowed to print. The syntax is the same
as hosts.equiv. The network printer configuration it self is
best done with the system admin tools from your distribution (e.g
yast in suse and printtool in redhat). The Printing-HOWTO from the
Linux Documenation project describes how to set it up if you do not
want to use the system admin tools from your distribution.

sendmail

The file /etc/service.switch is used by sendmail. On the
hosts inside your network (the ones that do not have a
direct Internet connection) you write:

hosts files
aliases files

You configure then your sendmail on these hosts to forward all mail
to the machine that has the modem and you use this one as a mailhost.

Sendmail reads at startup a configuration file called
/etc/sendmail.cf and this file is quite difficult to read.
The sendmail sources use therefore a macro language called
m4 to generate the sendmail.cf out of a macro file. To do this
you need the m4 macro processor (probably already installed on your system)
and a part of the sendmail sources. Redhat Linux installs also these
sources to /usr/lib/sendmail-cf other distributions may not come with
it but you can always unpack the sendmail sources.
Documentation on how the sendmail configuration works can be obtained
from www.sendmail.org.

A central mail host is called mail-hub. The idea is that all the different
machines in your network forward just their mail to this hub and the hub
stores the mail. You then access it via NFS or pop/imap.
A m4 file to do exactly that looks as follows:

To generate the sendmail.cf file form the above sendmail.mc
file you go into the cf directory of the sources (redhat /usr/lib/sendmail-cf/cf) and put the sendmail.mc there. Then you run m4 sendmail.mc > /etc/sendmail.cf

Please note: to just get networking running you will not need sendmail
at all and you can send and receive mail with netscape without bothering about
sendmail. Sendmail is probably something for the more advances Linux users.

A bit more difficult is the configuration of your mailhost. It must
deliver local mail and forward external mail. External mail can e.g be forwarded
via smtp (Simple Mail Transfer Protocol) in which case you should read the sendmail documentation (
www.sendmail.org)
about "define(`SMART_HOST', smtp:provider.mail.host)dnl".
For outgoing mail via smtp you need also on your mailhost computer a
/etc/service.switch that enables
DNS lookup:

hosts files dns
aliases files

You can also use UUCP and other methods. It really depends on what your Internet
provider offers.
UUCP stands for Unix to Unix Copy and is an old message transfer system
but it is very good for getting mail from your ISP. Again your Internet
provider must offer this service
The more Windows focused companies may not even know what
UUCP is.
How does UUCP work for you?
Example: The domain of your provider is somewhere.org and
your host is called form outside linuxnet (outside means
ppp-interface, internally in our examples we
called it sofar obelix). Your provider gives you all mail via UUCP
that goes to <sombody>@linuxnet.somewhere.org You can then distribute it
using sendmail. Every local user has his/her own mail account which
YOU can set up. It is just a matter of adding another unix user.
Unfortunately most Internet providers offer today just one pop mail address
and then you all this does not apply to you. Use in this case netscape or
fetchmail.

IP-Masquerading (NAT)

IP Masquerading is the Linux term and most other people call it
Network Address Translation. This is a very valuable thing for
a small home network. It gives you the possibility to access the
Internet from any of your local machines although only one machine
is known in the Internet. This one machine is probably connected via
modem/PPP and has a valid Internet wide routed ip-address assigned
dynamically (or statically) to its ppp0 interface.
With IP-Masquerading several people on different computers in
your home network can access the Internet at the same time.
_LF_ will have a separate article on how to setup IP-Masquerading.
I recommend also reading the howto on IP-Masquerade.
For the moment I will just explain how it works in principle.

To understand how IP-Masquerade works you must understand how a TCP
connection is set up. When you connect to a host on the Internet with
your web-browser then you connect to the ip address of that machine and
the web server application. The application (e.g a web server) is selected
by something called port number. The port numbers are pre-defined.
Port 80 is the port number for the web server application. Thus if you
type www.linuxfocus.org in your netscape then it knows that it must
connect to the IP address 195.53.25.18 (= www.linuxfocus.org) and port 80.
For a full tcp connection where data can be send and received, pairs
of IP address and port numbers are needed. That is
195.53.25.18 and 80 plus your own ip address and a local port number
to which the web server can reply. The local port number is usually allocated
at random. E.g:

If you start a second netscape window and setup an other connection
to www.linuxfocus.org then a new local port number is choosen:

www at www.linuxfocus.org: your.machine.at.your.isp:
IP=195.53.25.18 Port=80 ----- IP=123.123.456.1 Port=4123
IP=195.53.25.18 Port=80 ----- IP=123.123.456.1 Port=4541
Note: twice port 80 is not correct but
we just say so to make the example simpler.

When a TCP packet comes back from the web server then it knows
to which netscape window to go because of the difference in the
port number on your machine. In the case of a private network behind your.machine.at.your.isp
the situation is:

None of the IP addresses of interfaces from privatehost1.mynet are known
in the Internet. Therefore it is impossible to send an IP-packet from
the Internet back to privatehost1.mynet. No router in the Internet
would know where to send it to. However your.machine.at.your.isp
has an IP addresses which is known in the Internet and as we saw above,
different connections can be told apart by their port-numbers.
privatehost1.mynet can request a connection to
www.linuxfocus.org and port 80. It would choose a port number, e.g 3211,
and send a TCP packet in the direction of
your.machine.at.your.isp. The host
your.machine.at.your.isp would normally (without
IP-Masquerade) just route the packet out to the Internet where it would
disappear (at least the answer from the www.linuxfocus.org server would
disappear). With IP-Masquerade your.machine.at.your.isp catches the
packet and builds up a new connection with a local random port number.
It then remembers that any answer packets back to that port must be sent
on to privatehost1.mynet and port 3211.
So IP-Masquerade, builds up a new connection for you and has
a mapping table from its port numbers to IP addresses and port numbers
in the private network. If an answer packet comes back to the machine
where IP-Masquerade is running it checks to which private IP addresses and
portnumber it should forward the packet.

IRQ

Problems with interrupts are not specific to networking. They can occur
anytime you add new hardware to your computer. Unfortunately the PC hardware
does only allow for 16 interrupts and most of them are already in use.
It is possible to share interrupts between two PCI cards at the expense of
some CPU power. It is not possible to share interrupts between ISA bus
cards. If you have a PNP Bios and insert a ISA bus card with fixed
IRQ into your computer then you must first go into the BIOS setup
and reserve that IRQ otherwise the BIOS may try to assign the IRQ to
other hardware and that will not work.

Under Linux you can see how often certain hardware has already
generated an interrupt by using the command cat /proc/interrupts.
Hardware which is not used will not generate any interrupts.

The following is a list of the pre-defined IRQs. You can only use them
for other purposes if you do not use the hardware component assigned to it.
E.g if you use SCSI drives instead of IDE then you can use IRQ 14/15
for other things.

IRQ

Assigned to

0

timer

1

keyboard

2

cascade (programmable IRQ controller)

3

serial 2

4

serial 1

5

free, usually sound card

6

floppy

7

parallel port, but under linux printers will not
generate any iterrrupt

8

real time clock

9

free

10

free

11

free

12

ps2 mouse (/dev/psaux)

13

math co-processor

14

IDE 1

15

IDE 2

Example network

After so much theory I would like to discuss a little example network
with you. Why do people build home networks? Here some ideas:

Networks allow us to share resources. One computer my have a modem and
Internet connection, all share it and use it. One computer may have
a printer, all computers can share it. One computer may have
a special drive (e.g zip-dirve, cd-rom, dvd) all computers can use
it and mount it via NFS. One computer may have a large disk with lots
of images and sound files. All computers can access it.

It is a technically interesting thing.

Now to our example network. We have one computer with modem, one with
a printer. These two are connected via Ethernet. Both have cdrom and
floppy drives. There is also a laptop
which has neither printer nor modem and also no cdrom. We connect it
to the free parallel port on the first computer and give it therefore
access to printer cdrom and the modem/Intenet.
How would you set up such a network? Well, first you buy the hardware.
You need [besides computers modem and printer], 2 network cards
a cross-connect cable and a Laplink cable. No hub is required.
You install the hardware connect the cables and make sure you cause
no interrupt (IRQ) conflict with the new hardware.
Next you either re-configure the kernel or you just load the necessary
kernel modules if they are already there. Most hardware support will
be already compiled in if you use the pre-configured kernel from
one of the major distributions.
Now you use the command ifconfig and assign an IP address to the new
network interfaces. You then use the command route to define which
IP-packets must be send where. After that your network should be
operational. You can not yet use domain names and IP Maskerade will
also not yet work but you can send around a ping and
watch how the LED on your network card flashes.
If you use the following IP addresses:

You stop this with crtl-c. Take also a look at the command
cat /proc/interrupts where you should see your network card
or PLIP in the case of the Laptop connection. A cat /proc/ioports
should show your new hardware and the command netstat -i shows
how many IP packets were sent to which interface.
You can use at this stage already ftp between
the computers and transfer files.

Basically your network is there but nothing really cool works.
Now you must edit the different configuration files (use also the nice
graphical tools that are available with the various distributions).
Finally you setup IP-Maskerade and NFS. Now your network is fully functional.

I hope that this gave you a good overview. Don't be disappointed if I did not
tell you exactly how to really configure the software part. There will be
separate articles covering ifconfig/route/netstat, IP-Maskerade, PPP setup,
network printing with lpd
and NFS. This article was supposed to give a good overview to make it easier
to understand other articles on networking.

Happy networking

ps: _LF_ is always happy to receive articles on networking. Not all articles
are written yet and this is just the start of a series. Let us
know if you are an experienced user and would like to write an article.