Certification Objective 1.09-Basic TCPIP Networking

Certification Objective 1.09-Basic TCP/IP Networking

TCP/IP is a series of protocols organized in layers, known as a protocol suite. It was developed for Unix and eventually adopted as the standard for communication on the Internet. With IP addresses, it can help you organize your network. There are a number of TCP/IP tools and configurations that can help you manage your network.

As with the previous sections in this chapter, the statements here are oversimplifications. So if you find this section overwhelming, read the references cited at the beginning of the chapter. Linux is built for networking, and there is no practical way to pass either the RHCT or the RHCE exam unless you understand networking in some detail.

IP Numbers and Address Classes

Every computer that communicates on a network needs its own IP address. Some addresses are assigned permanently to a particular computer; these are known as static addresses. Others are leased from a DHCP server, associated with the Dynamic Host Configuration Protocol, for a limited amount of time; these are also known as dynamic IP addresses.

Two standards for IP addresses are in use today: IP version 4 (IPv4) and IP version 6 (IPv6). IPv4 addresses have 32 bits and are set up in octets in dotted decimal notation. The range of possible IPv4 addresses is between to While this range includes more than 4 billion IP addresses, that is not nearly enough for the current Internet.

IPv6 addresses have 128 bits and are set up in hexadecimal notation. An IPv6 address is normally organized in eight groups of four hexadecimal numbers each, and it may look like 4abe:03e2:c132:69fa:0000:0000:c0b8:2148. This is a range of over 340,000,000,000,000,000,000,000,000,000,000,000,000 IPv6 addresses.

To ease the transition, specific IPv6 addresses have been assigned for every one of the 4 billion IPv4 addresses. There are still more than 3.4 × 1038 addresses left over. While actual routing on the Internet now commonly uses IPv6, network configuration in Linux is still normally based on IPv4 addresses.

IPv4 addresses are organized into five different classes, as shown in Table 1-7. The academics among you may note that this is different from the official addresses in each IPv4 class as specified in RFC 1518 from the Internet Engineering Task Force (www.ietf.org). The assignable address range includes those IP addresses that can be assigned to a specific computer on a network.

Table 1-7: IP Address Classes


Assignable Address Range



Allows networks of up to 16 million computers


Allows networks of up to 65,000 computers


Allows networks of up to 254 computers


Reserved for multicasts


Reserved for experimental use

In addition, there are several private IP address ranges available for computers and networks. They are associated with network addresses,, and through

IPv6 Addressing

There are 128 bits in an IPv6 address. That's 96 more bits than IPv4. A typical IPv6 address might look like this: 

The best way to understand an IPv6 address is to break it down, bit by bit. When routing to individual computers, the first three bits are set to


which is associated with "unicast" or one computer routing. Note how "unicast" contrasts to "multicast" routing, which would address multiple systems. Of course, a multicast IPv6 address has a different first three bits.

The following bits depend on the functionality of the network. Generally, IPv6 addresses to most networks will be assigned 47 or 48 of the 128 bits. The first three bits are included in the 47 or 48 bits. The remaining (80 or 81) bits are available for addressing on the local network.

In contrast, private IP addresses on a single physical network include the following first 10 bits, also known as the Local Link Unicast:

 1111 1110 10 

Translated to hexidecimal notation, that's also known as fe80, which is what you'll see in the output to the ifconfig command for most Ethernet cards in the inet6 addr line.

To ease the transition from IPv4 to IPv6, IPv4 addresses can be embedded at the end of every IPv6 address. In other words, the IPv4 address embedded above is 

How to Define a Network with IP Addresses

Three key IP addresses define a network: the network address, the broadcast address, and the subnet mask. The network address is always the first IP address in a range; the broadcast address is always the last address in the same range. The subnet mask helps your computer define the difference between the two addresses. You can assign IP addresses between the network and broadcast addresses (not including these addresses) to any computer on the network.

As an example, let's define the range of addresses for a private network. Start with the private network address Use the standard subnet mask for a class C network, Based on these two addresses, the broadcast address is, and the range of IP addresses that you can assign on that particular network is through

If you're working with IPv6, remember there are 128 bits. Private IPv6 addresses are defined by the first nine bits, specifically 1111 1110 1. Any address that starts with these bits is reserved and cannot be used on the Internet, just like the aforementioned private IPv4 addresses.

If this is confusing to you in any way, please refer to the IP Sub-Networking Mini-HOWTO of the Linux Documentation Project at www.tldp.org.

Tools and Commands

A substantial number of commands are available to manage the TCP/IP suite on your Linux computer. Three of the more important commands are ping, ifconfig, and netstat.


The ping command allows you to test connectivity-locally, within your network, and on the Internet. For the purpose of this section, assume your IP address is and the gateway address on your network is If you're having problems connecting to a network, you should use the ping command in the following order.

First test the integrity of TCP/IP on your computer:

 # ping 

Normally, ping works continuously on Linux; you'll need to press CTRL-C to stop this command. If you need to see if you're properly connected to your LAN, you should ping your own IP address:

 # ping 

If that works, ping the address of another computer on your network. Then start tracing the route to the Internet. ping the address for your gateway, in this case, If possible, ping the address of your network's connection to the Internet. And finally, ping the address of a computer that you know is active on the Internet.

You can substitute host names such as www.google.com for an IP address. If the host name doesn't work, there's a problem with the database of host names and IP addresses, more commonly known as a DNS, BIND, or nameserver.

If you're working with IPv6, the ping command is ping6; the loopback address is known as 0:0:0:0:0:0:0:1, sometimes expressed by compressing zeros as ::1. To see how this works, try the following command:

 # ping6 ::1 


The ifconfig command can help you check and configure network adapters. Run the ifconfig command by itself to see the detected adapters on your computer. You can also use ifconfig to assign IP address or hardware port information as well. For example, if you want to assign IRQ 10 to the second Ethernet adapter, run the following command:

 # ifconfig eth1 irq 10 

For more information on ifconfig, refer to Chapter 7.


The netstat command is versatile; it can help you see the channels available for network connections, interface statistics, and more. One important version of this command, netstat -r, displays routing tables that can tell you if your computer knows where to send a message. More information on this command is available in Chapter 7.

Configuring Name Resolution

When I used a static IP address on my high-speed Internet connection, I could sometimes memorize those numbers. But how can anyone memorize the IP addresses of every Web site you need on the Internet? Using four configuration files, Linux can help you translate computer host names to IP addresses.


Red Hat distributions include basic networking parameters in /etc/sysconfig/network. In most cases, this file activates networking and specifies the host name with directives such as this:

 NETWORKING=yes HOSTNAME=Enterprise5.example.com 


The first database of host names and IP addresses was set up in a static text file, /etc/hosts. When there were just a few nodes on the network that eventually turned into the Internet, it was possible to maintain identical /etc/hosts files on each computer.

Here's a typical line in /etc/hosts, which lists the IP address, fully qualified domain name, and alias for one computer connection: linux1.mommabears.com laptop 


There are millions of hosts on the Internet. Even if it were possible to collect all domain names and IP addresses into a /etc/hosts file, the file would overwhelm every computer. And it would overwhelm every network administrator who would have to make sure that all the /etc/hosts files on the Internet match-and get updated every time a new Web site appears. That's why the Domain Name System (DNS) was developed, based on the Berkeley Internet Name Domain (BIND). In /etc/resolv.conf, the IP address of each DNS server is listed with a simple line similar to this:



Many networks configure an /etc/hosts file for the local network and a DNS server for other networks and/or the Internet. When your computer looks for an IP address, this file determines whether it searches through /etc/hosts or DNS first. This is usually a one-line file:

 order hosts,bind 

A computer with this line looks through /etc/hosts first. If it can't find the computer name that you want in that file, it next looks to the DNS server (bind) for the computer name.

But in most cases, this file has been superseded by /etc/nsswitch.conf.


This file relates to the configuration on a network of Linux- and Unix-type computers, which are configured to communicate using the Network File System (NFS). When it is used in concert with the Network Information Service (NIS), networks can maintain a single database of usernames and passwords for all NFS-enabled computers on that network.

The key directive in this file, with respect to name resolution, is

 hosts: files dns 

This is a more straightforward expression of where Linux looks for an IP address when it sees a host name. First, it looks at the file, /etc/hosts, and then it looks at the available DNS server, as defined in /etc/resolv.conf.

RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302)
Linux Patch Management: Keeping Linux Systems Up To Date
ISBN: 0132366754
EAN: 2147483647
Year: 2004
Pages: 227
Authors: Michael Jang

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net