Understanding TCP/IP

TCP/IP is the standard protocol used for networking in the Linux world. As you probably know, it is also the protocol that most Unix networks use, and the protocol that the Internet is based upon.

A protocol is a language machines use to communicate. It has nothing to do with the physical connection between the computers, which is based on a variety of (mostly) Ethernet technologies. In other words, the cabling between the computers could be made up of 10-Base-T wiring with RJ-45 jacks that connect to network cards. Or the connection could be made with high-speed fiber optic cable. From the viewpoint of the protocol used over the wiring, it just doesn't matter. This software abstraction layer—the TCP/IP protocol—makes it easy to consider networking without paying much attention to the underlying hardware, in much the same way that one can think about Java programming without paying attention to the hardware that will be running it.

The TCP/IP protocol

TCP is short for Transmission Control Protocol, and IP stands for Internet Protocol.

The job of the TCP part of this combined protocol is to encapsulate packages of information, called packets. IP acts as the transmission and routing agent for the TCP packets. IP also steers packets composed in UDP—User Datagram Protocol—which is a protocol similar to TCP.

IP knows nothing about the content of the packets it is guiding. Conversely, TCP packets have no idea where they are going or how they are going to get there. Think of this setup as a pilot fish guiding a blind nurse shark—the fish is needed to get the shark to its destination.

Configuring TCP/IP

If you have the task of configuring a TCP/IP network, or configuring a machine connected to a TCP/IP network—called a node—you'll need to understand some important TCP/IP concepts. You'll find that understanding the meaning of this terminology and these concepts will make it much easier for you to get networking up and running. These concepts include the following:

  • IP addresses

  • Subnetworking and netmasks

  • Broadcast addresses

  • Gateway addresses

  • Name servers

IP addresses and netmasks

An IP address (IP for short) is a four-part number that uniquely identifies a computer, called a host. Each of the four numbers, referred to as a tuplet, is separated by a period. Every host that has direct access to the network must have a unique IP address.

Each of the four numbers that make up an IP address can have a value between 1 and 255, making a total of around 4.2 billion IP addresses available. These four billion addresses are assigned in groups, known as networks, to organizations needing IP addresses. There are three kinds of networks:

  • Class A, identified by the first tuplet in the IP address. There are 16,777,216 possible IP addresses in a Class A network.

  • Class B, identified by the first two tuplets in the IP address. There are 65,536 possible IP addresses in a Class B network.

  • Class C, identified by the final tuplet in the IP address. There are 256 possible IP addresses in a Class C network.

For example, the IP address 24.16.108.142 could be host 142 on a Class C network, host 108.142 on a Class B network, or host 16.108.142 on a Class A network. How's a poor machine to know what type of network it is on?

This is where the subnetmask—also called a netmask, or subnetwork mask—comes in. Netmasks use a logical AND between tuplets to determine the network class. Table Table 13.1 shows the meaning of netmasks.

Netmasks and Their Meanings
NetmaskMeaning
255.0.0.0Class A network
255.255.0.0Class B network
255.255.255.0Class C network

Note that when you apply a logical AND to an IP address such as 24.16.108.142 with the Class C netmask 255.255.255.0, you get a zero in the final tuplet, 24.16.108.0. This address, called the network address, cannot be used for an actual host on the network.

Broadcast addresses

Another special IP address is the broadcast address. The broadcast address is used to send information to all hosts on a network. When you use a broadcast address , instead sending a packet to one host, you broadcast it to all hosts.

The broadcast address is the network IP with the host portion replaced by 255. For the Class C network 24.16.108.0, this would be 24.16.108.255.

The broadcast address cannot be used for an actual host. This means that—subtracting the network address and the broadcast address—a Class C network actually has IP addresses for a maximum of 254 hosts.

Gateway addresses

A gateway address belongs to a machine that provides a route to the outside world. These machines are often called gateways.

Most often, a gateway has two network interfaces: one connected to a local network, and one connected to the outside world, meaning the Internet as a whole.

For a host to connect to the outside world, it needs to know the IP address of at least one gateway.

Name servers

The Domain Name System (DNS) is a distributed database that resides on name servers and that translates IP addresses to domain names. If you know the IP address of a host you want to connect to, then you don't need DNS or name servers. Typically though, most applications and networks assume that users prefer to remember domains, such as http://www.bearhome.com, rather than IP equivalents, such as 204.0.134.135.

Each registered domain has at least two DNS servers responsible for answering lookup queries that apply to the domain.

Every host that wants to be able to translate domain names into IP addresses needs the IP address for at least one DNS server that can contact other DNS servers as necessary to get name lookups. Name server information is usually required when you are configuring TCP/IP.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.111.208