Linux Networking/What do I need to start?

From Wikibooks, open books for an open world
< Linux Networking
Jump to: navigation, search

Before you start building or configuring your network you will need some things. The most important of these are:

Current Kernel source(Optional)[edit]

Please note:

The majority of current distributions come with networking enabled,therefore it may not be required to recompile the kernel. If you are running well known hardware you should be just fine. For example: 3COM NIC, NE2000 NIC, or a Intel NIC. However if you find yourself in the position that you do need to update the kernel, the following information is provided.

Because the kernel you are running now might not yet have support for the network types or cards that you wish to use you will probably need the kernel source so that you can recompile the kernel with the appropriate options.

For users of the major distributions such as Redhat, Caldera, Debian, or Suse this no longer holds true. As long as you stay within the mainstream of hardware there should be no need to recompile your kernel unless there is a very specific feature that you need.

You can always obtain the latest kernel source from ftp.cdrom.com. This is not the official site but they have LOTS of bandwidth and ALOT of users allowed. The official site is kernel.org but please use the above if you can. Please remember that ftp.kernel.org is seriously overloaded. Use a mirror.

Normally the kernel source will be untarred into the /usr/src/linux directory. For information on how to apply patches and build the kernel you should read the Kernel-HOWTO. For information on how to configure kernel modules you should read the Modules mini-HOWTO. Also, the README file found in the kernel sources and the Documentation directory are very informative for the brave reader.

Unless specifically stated otherwise, I recommend you stick with the standard kernel release (the one with the even number as the second digit in the version number). Development release kernels (the ones with the odd second digit) may have structural or other changes that may cause problems working with the other software on your system. If you are uncertain that you could resolve those sorts of problems in addition to the potential for there being other software errors, then don't use them.

On the other hand, some of the features described here have been introduced during the development of 2.1 kernels, so you must take your choice: you can stick to 2.0 while wait for 2.2 and an updated distribution with every new tool, or you can get 2.1 and look around for the various support programs needed to exploit the new features.As I write this paragraph, in August 1998, 2.1.115 is current and 2.2 is expected to appear pretty soon.

Current Network tools.[edit]

The network tools are the programs that you use to configure linux network devices. These tools allow you to assign addresses to devices and configure routes for example. Most modern linux distributions are supplied with the network tools, so if you have installed from a distribution and haven't yet installed the network tools then you should do so.

If you haven't installed from a distribution then you will need to source and compile the tools yourself. This isn't difficult.

The network tools are now maintained by Bernd Eckenfels and are available at: ftp.inka.de and are mirrored at: ftp.uk.linux.org.You can also get the latest RedHat packages from net-tools-1.51-3.i386.rpm

Be sure to choose the version that is most appropriate for the kernel you wish to use and follow the instructions in the package to install.

To install and configure the version current at the time of the writing you need do the following:

              user% tar xvfz net-tools-1.33.tar.gz
              user% cd net-tools-1.33
              user% make config
              user% make
              root# make install

Or to use the Redhat packages:

              root# rpm -U net-tools-1.51-3.i386.rpm

Additionally, if you intend configuring a firewall or using the IP masquerade feature you will require the ipfwadm command. The latest version of it may be obtained from: ftp.xos.nl. Again there are a number of versions available. Be sure to pick the version that most closely matches your kernel. Note that the firewalling features of Linux changed during 2.1 development and has been superceded by ipchains in v2.2 of the kernel. ipfwadm only applies to version 2.0 of the kernel. The following are known to be distributions with version 2.0 or below of the kernel.

              Redhat 5.2 or below
              Caldera pre version 2.2
              Slackware pre version 4.x
              Debian pre version 2.x

To install and configure the version current at the time of this writing you need to read the IPChains howto located at The Linux Documentation Project

Note that if you run version 2.2 (or late 2.1) of the kernel, ipfwadm is not the right tool to configure firewalling. This version of the NET-3-HOWTO currently doesn't deal with the new firewalling setup. If you need more detailed information on ipchains please refer to the above.

Network Applications Programs[edit]

The network application programs are programs such as telnet and ftp and their respective server programs. David Holland has been managing a distribution of the most common of these, which is now maintained by netbug@ftp.uk.linux.org. You may obtain the distribution from: ftp.uk.linux.org.

IPv4 Addresses, an Explanation[edit]

Internet Protocol Addresses are composed of four bytes. The convention is to write addresses in what is called `dotted decimal notation'. In this form each byte is converted to a decimal number (0-255) dropping any leading zero's unless the number is zero and written with each byte separated by a `.' character. By convention each interface of a host or router has an IP address. It is legal for the same IP address to be used on each interface of a single machine in some circumstances but usually each interface will have its own address.

Internet Protocol Networks are contiguous sequences of IP addresses. All addresses within a network have a number of digits within the address in common. The portion of the address that is common amongst all addresses within the network is called the `network portion' of the address. The remaining digits are called the `host portion'. The number of bits that are shared by all addresses within a network is called the netmask and it is role of the netmask to determine which addresses belong to the network it is applied to and which don't. For example, consider the following:


            -----------------  ---------------
            Host Address       192.168.110.23
            Network Mask       255.255.255.0
            Network Portion    192.168.110.
            Host portion                  .23
            -----------------  ---------------
            Network Address    192.168.110.0
            Broadcast Address  192.168.110.255
            -----------------  ---------------


Any address that is 'bitwise anded' with its netmask will reveal the address of the network it belongs to. The network address is therefore always the lowest numbered address within the range of addresses on the network and always has the host portion of the address coded all zeroes.

The broadcast address is a special address that every host on the network listens to in addition to its own unique address. This address is the one that datagrams are sent to if every host on the network is meant to receive it. Certain types of data like routing information and warning messages are transmitted to the broadcast address so that every host on the network can receive it simultaneously. There are two commonly used standards for what the broadcast address should be. The most widely accepted one is to use the highest possible address on the network as the broadcast address. In the example above this would be 192.168.110.255. For some reason other sites have adopted the convention of using the network address as the broadcast address. In practice it doesn't matter very much which you use but you must make sure that every host on the network is configured with the same broadcast address.

For administrative reasons some time early in the development of the IP protocol some arbitrary groups of addresses were formed into networks and these networks were grouped into what are called classes. These classes provide a number of standard size networks that could be allocated. The ranges allocated are:


       ----------------------------------------------------------
       | Network | Netmask       | Network Addresses            |
       | Class   |               |                              |
       ----------------------------------------------------------
       |    A    | 255.0.0.0     | 0.0.0.0    - 127.255.255.255 |
       |    B    | 255.255.0.0   | 128.0.0.0  - 191.255.255.255 |
       |    C    | 255.255.255.0 | 192.0.0.0  - 223.255.255.255 |
       |Multicast| 240.0.0.0     | 224.0.0.0  - 239.255.255.255 |
       ----------------------------------------------------------


What addresses you should use depends on exactly what it is that you are doing. You may have to use a combination of the following activities to get all the addresses you need:


Installing a linux machine on an existing IP network

     If you wish to install a linux machine onto an existing IP
     network then you should contact whoever administers the network
     and ask them for the following information:


  ·  Host IP Address
  ·  IP network address
  ·  IP broadcast address
  ·  IP netmask
  ·  Router address
  ·  Domain Name Server Address


     You should then configure your linux network device with those
     details.  You can not make them up and expect your configuration
     to work.


Building a brand new network that will never connect to the Internet" If you are building a private network and you never intend that network to be connected to the Internet then you can choose whatever addresses you like. However, for safety and consistency reasons there have been some IP network addresses that have been reserved specifically for this purpose. These are specified in RFC1597 and are as follows:


          -----------------------------------------------------------
          |         RESERVED PRIVATE NETWORK ALLOCATIONS            |
          -----------------------------------------------------------
          | Network | Netmask       | Network Addresses             |
          | Class   |               |                               |
          -----------------------------------------------------------
          |    A    | 255.0.0.0     | 10.0.0.0    - 10.255.255.255  |
          |    B    | 255.255.0.0   | 172.16.0.0  - 172.31.255.255  |
          |    C    | 255.255.255.0 | 192.168.0.0 - 192.168.255.255 |
          -----------------------------------------------------------


You should first decide how large you want your network to be and then choose as many of the addresses as you require.