|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|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.
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:
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).
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:
Could be set with a subnet mask:
The computer would mask out any bits covered in the subnet mask:
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.
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:
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:
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:
So, for instance, for the first device in the 192.168.1.X network, the following would be typed:
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:
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 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:
And so on. A listing of ports may be found in /etc/services.
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:
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:
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:
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|