Originally Published: Wednesday, 1 November 2000 Author: Chris Campbell
Published to: enhance_articles_sysadmin/Sysadmin Page: 1/1 - [Printable]

Introduction to Networking, Part 2: Protocols and Applications

Do you get confused by TCP/IP? It's a pretty confusing system if you're building a network for the first time. Chris Campbell returns to break it down for budding sysadmins in this part of his 'Introduction to Networking' series. Take a look!

   Page 1 of 1  

Editor's Note: This piece is written for Mandrake Linux. The concepts provided here are good for all distributions of Linux, but please be sure to check your own distribution for any minor changes.

There is an ocean of protocols in the networking world. However, the growing popularity of the Internet has made many of the proprietary protocols dry up. There are still some that remain, such as Novell's IPX/SPX or Windows' NetBEUI, but both Microsoft and Novell have, with the latest incarnations of their networking schemes, adopted the Internet protocol, TCP/IP as their standard. Linux, like Unix before it, supports TCP/IP inherently as it was developed on the platform. To this end, the protocol of focus in this article will be TCP/IP. Incidentally, it is also the protocol with the most applications written specifically for it.

With the launch of Sputnik by the Russians in 1956, the United States government decided that it would be prudent to remain significantly more technologically advanced than their enemies. The Defense Advanced Research Project Agency (DARPA) was formed and embarked on creating a re-routable network impervious to nuclear attack. Called ARPAnet, it grew slowly for years and was scheduled to be abandoned for a newer network in the early 1980's. The National Science Foundation stepped in to take over administration and the Internet was born. Over a decade passed before it became the easy babysitter and corporate advertising mainstay that it is today. Its standards had been set. The standard protocol, of course, became TCP/IP.

TCP/IP Addresses

Pretty straightforward in configuration, each device on a TCP/IP network has an IP address. This is 32 bit value, typically broken into four eight-bit parts. So, a converted address would be like:

TCP/IP AddressBinary
1.1.1.100000001.00000001.00000001.00000001
255.255.255.25511111111.11111111.11111111.11111111

As illustrated above, 255 is the highest number possible in the 8 bit binary field. This would mean that the entire number of possible IP addresses would be 2 ^ 32 (2 raised to the 32nd power) or 4294967296. A fair amount of these addresses are reserved, or like in the case of any 255 valued field, reserved for subnet masking, a concept we will discuss shortly. There are still 4 billion addresses left! That seems impressive until you realize that there is actually a bit of a shortage of IP addresses. A new version of the schema will shortly be implemented (IPv6).

Subnet Masking

As mentioned, each device has an IP address, and that address is similar to the other devices on its local network. With TCP/IP the networks are segmented by the use of subnet masks. Basically, the computer is told to consider local anything not covered by a bit in the subnet mask. For instance, a local device:

TCP/IP AddressBinary
192.168.1.12111000000.10101000.00000001.1111001

Could be set with a subnet mask:

Subnet MaskBinary
255.255.0.011111111.11111111.00000000.00000000

The computer would mask out any bits covered in the subnet mask:

Local NetworkBinary
X.X.1.121XXXXXXXX.XXXXXXXX.00000001.1111001

So any device address in the range on 192.168.1.X to 192.168.254.X would be considered a local address. By far the most common subnet mask, due no doubt to the scarcity of addresses, is 255.255.255.0. A 128 in the last 8 bit field (octet) is increasingly common also.

Subnet MaskBinary
255.255.255.011111111.11111111.11111111.00000000
255.255.255.12811111111.11111111.11111111.10000000

When a device such as a router is configured with network information, such as a subnet mask, it regards anything in the remainder of the mask's open fields as internal and all other addresses to be external. When a machine is then configured to point to that router as its default gateway or "next hop" router, the machine should be able to be linked to all networks on either side of the router.

Setting up the simple network:

In Linux, TCP/IP configuration is fairly simple and there are numerous ways to do it. Most Linux distributions come with configuration tools such as linuxconf. This can be executed by going to a command line and typing:

linuxconf

This should bring up a GUI type interface. The IP address may be entered here by clicking "Basic Host Information" and typing and IP address and subnet mask into the appropriately marked fields. It is also crucial to select the adapter, which should be "eth0" if there is only one NIC in the machine.

For the intention of a test or non-internet network (LAN), it is best to use reserved IP addresses, that is, IP addresses which will not be resident addresses on the Internet. The most common address sets used for this are:

IP Network RangeTypical Subnet Mask
192.168.1.X255.255.0.0
10.10.10.X255.255.255.0

All devices must have different IP addresses. So, using the 192.168.1.X series, assign the IP address of 192.168.1.1 to the first machine, 192.168.1.2 to the second machine and so on. Subnet mask must remain consistent throughout the network.

It is entirely likely that linuxconf is not included with the version of Linux that you may have, so IP addresses may be set manually from command line:

ifconfig eth0 {IPaddress} netmask {subnetmask}

So, for instance, for the first device in the 192.168.1.X network, the following would be typed:

ifconfig eth0 192.168.1.1 netmask 255.255.0.0

The ifconfig command will set the TCP/IP settings for the time being, but these settings would need to be reset upon reboot. So, on most systems, it is possible to set the configuration at boot-up by editing:

/etc/rc.d/rc.inet1

Here the ifconfig commands can be re-issued at boot-up. Note however, that there are many different ways that the boot-time configuration may be handled, and generally it is advised to use linuxconf for this configuration when available.

Applications

Applications are programs running that utilize a networking protocol. Applications are commonly things such as e-mail and Web browsers.. These applications were written specifically for TCP/IP and may be utilized if the proper server software is installed.

As mentioned before every device on a TCP/IP network gets a separate and different TCP/IP address, and every network is segmented via subnet masks. This can be illustrated if one were to look at the network like a city. Subnet masks could be seen as mail delivery areas, and each TCP/IP address could be seen as a postal address on an apartment building. Now imagine applications as being the apartments within the building. Data (or in the proverbial neighborhood, postage) will come to the correct building as long as it has the correct address (IP), but how does it find the actual application (or tenant) that it is intended for? This is done in TCP/IP by designating ports. Each application runs on a designated port so that any data for it knows where to go. Some of the more common are:

Port NumberService
21FTP
23Telnet
25SMTP (Email)
80HTTP (www)

And so on. A listing of ports may be found in /etc/services.

Testing:

With the IP addresses in place and the machines physically linked together, communication can be tested by either attempting to access a service such as ftp:

ftp {IPaddress of other machine on network}

or telnet

telnet {IPaddress of other machine on network)

These services may be running, but nothing guarantees that. So in order to test communications, there is another service specifically there. This is called ping and may be used to test communication by typing:

ping {IPaddress of other machine on network}

This will send a series of test packets. If you get no response, then something has been misconfigured. Re-review these two articles step-by-step and try again.

If the network is functional, you should get a stream of messages similar to:

Reply from 192.168.1.2: bytes=32 time<10ms TTL=128

If successful, the reply message will continue to repeat. Press CTRL-C to stop the messages. Congratulations! You have successfully created a network! You've taken your first step to a bigger world.





   Page 1 of 1