[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 System Management Guide: Communications and Networks

TCP/IP Addressing

TCP/IP includes an Internet addressing scheme that allows users and applications to identify a specific network or host to communicate with. An Internet address works like a postal address, allowing data to be routed to the chosen destination. TCP/IP provides standards for assigning addresses to networks, subnetworks, hosts, and sockets, and for using special addresses for broadcasts and local loopback.

Internet addresses are made up of a network address and a host (or local) address. This two-part address allows a sender to specify the network as well as a specific host on the network. A unique, official network address is assigned to each network when it connects to other Internet networks. However, if a local network is not going to connect to other Internet networks, it can be assigned any network address that is convenient for local use.

The Internet addressing scheme consists of Internet Protocol (IP) addresses and two special cases of IP addresses: broadcast addresses and loopback addresses.

Internet Addresses

The Internet Protocol (IP) uses a 32-bit, two-part address field. The 32 bits are divided into four octets as in the following:

01111101 00001101 01001001 00001111

These binary numbers translate into:

125 13 73 15

The two parts of an Internet address are the network address portion and the host address portion. This allows a remote host to specify both the remote network and the host on the remote network when sending information. By convention, a host number of 0 (zero) is used to refer to the network itself.

TCP/IP supports three classes of Internet addresses: Class A, Class B, and Class C. The different classes of Internet addresses are designated by how the 32 bits of the address are allocated. The particular address class a network is assigned depends on the size of the network.

Class A Addresses

A Class A address consists of an 8-bit network address and a 24-bit local or host address. The first bit in the network address is dedicated to indicating the network class, leaving 7 bits for the actual network address. Since the highest number that 7 bits can represent in binary is 128, there are 128 possible Class A network addresses. Of the 128 possible network addresses, two are reserved for special cases: the network address 127 is reserved for local loopback addresses, and a network address of all ones indicates a broadcast address.

Therefore, there are 126 possible Class A network addresses and 16,777,216 possible local host addresses. In a Class A address (see figure), the highest order bit is set to 0.

In other words, the first octet of a Class A address is in the range 1 to 126.

Class B Addresses

A Class B address consists of a 16-bit network address and a 16-bit local or host address. The first two bits in the network address are dedicated to indicating the network class, leaving 14 bits for the actual network address. Therefore, there are 16,384 possible network addresses and 65,536 local host addresses. In a Class B address (see figure), the highest order bits are set to 1 and 0.

In other words, the first octet of a Class B address is in the range 128 to 191.

Class C Addresses

A Class C address consists of a 24-bit network address and an 8-bit local host address. The first two bits in the network address are dedicated to indicating the network class, leaving 22 bits for the actual network address. Therefore, there are 2,097,152 possible network addresses and 256 possible local host addresses. In a Class C address (see figure), the highest order bits are set to 1 and 1.

In other words, the first octet of a Class C address is in the range 192 to 223.

When deciding which network address class to use, you need to consider how many local hosts there will be on the network and how many subnetworks there will be in the organization. If the organization is small and the network will have fewer than 256 hosts, a Class C address is probably sufficient. If the organization is large, then a Class B or Class A address may be more appropriate.

Note: Class D (1-1-1-0 in the highest order bits) addresses provide for multicast addresses and are supported by UDP/IP under AIX.

Machines read addresses in binary code. The conventional notation for Internet host addresses is the dotted decimal, which divides the 32-bit address into four 8-bit fields. The following binary value:

0001010 00000010 00000000 00110100

can be expressed as:

010.002.000.052 or 10.2.0.52

where the value of each field is specified as a decimal number and the fields are separated by periods.

Note: The hostent command does recognize the following addresses: .08, .008, .09, and .009. Addresses with leading zeros are interpreted as octal, and numerals in octal cannot contain 8s or 9s.

TCP/IP requires a unique Internet address for each network interface (adapter) on a network. These addresses are determined by entries in the configuration database, which must agree with entries in the /etc/hosts file or the named database if the network is using a name server.

Internet Addresses Using Zeros

When a C class Internet address contains a 0 as the host address portion, (for example, 192.9.200.0), TCP/IP sends a wildcard address on the network. This means that all machines with a Class C address of 192.9.200.X (where X represents a value between 0 and 254) should respond to the request. This results in a network flooded with requests to nonexistent machines.

Similarly, problems occur for Class B addresses such as 129.5.0.0. All machines with a Class B address of 129.5.X.X. (where X represents a value between 0 and 254) are obliged to respond to the request. In this case, since Class B addresses account for bigger networks than Class C addresses, the network is flooded with significantly more requests to nonexistent machines than for a Class C network.

Subnet Addresses

Subnet addressing allows an autonomous system made up of multiple networks to share the same Internet address. The subnetwork capability of TCP/IP also makes it possible to divide a single network into multiple logical networks (subnets). For example, an organization can have a single Internet network address that is known to users outside the organization, yet configure its network internally into departmental subnets. In either case, fewer Internet network addresses are required while local routing capabilities are enhanced.

A standard Internet Protocol address field has two parts: a network address and a local address. To make subnets possible, the local address part of an Internet address is divided into a subnet number and a host number. The subnet is identified so that the local autonomous system can route messages reliably.

In the basic Class A Internet address (see figure), which consists of an 8-bit network address and 24-bit local address, the local address identifies the specific host machine on the network.

To create a subnet address for this Class A Internet address, the local address can be divided into a number identifying the physical network (or subnet) and a number identifying the host on the subnet. Senders route messages to the advertised network address, and the local system takes responsibility for routing messages to its subnets and their hosts. When deciding how to partition the local address into subnet address and host address, you should consider the number of subnets and the number of hosts on those subnets.

In the following figure, the local address is partitioned into a 12-bit subnet address and a 12-bit host address.

You have great flexibility when assigning subnet addresses and host addresses. The bits of the local address can be divided according to the needs and potential growth of the organization and its network structure. The only restrictions are:

If the width of the subnet_address field is 0, the network is not organized into subnets, and addressing to the network is performed using the Internet network address.

The bits that identify the subnet are specified by a bit mask and, therefore, are not required to be adjacent in the address. However, it is generally desirable for the subnet bits to be contiguous and located as the most significant bits of the local address.

Subnet Masks

When a host sends a message to a destination, the system must determine whether the destination is on the same network as the source or if the destination can be reached directly through one of the local interfaces. The system compares the destination address to the host address using the subnet mask. If the destination is not local, the system sends the message on to a gateway. The gateway performs the same comparison to see if the destination address is on a network it can reach locally.

The subnet mask tells the system what the subnet partitioning scheme is. This bit mask consists of the network address portion and subnet address portion of the Internet address (see figure). For example, the subnet mask of the Class A address with the partitioning scheme defined above is shown in the following figure.

The subnet mask is a set of 4 bytes, just like the Internetwork address. The subnet mask consists of high bits (1's) corresponding to the bit positions of the network and subnetwork address, and low bits (0's) corresponding to the bit positions of the host address. A subnet mask for the above address looks like the following figure:

Address Comparison

The destination address and the local network address are compared by performing the logical AND and exclusive OR on the subnet mask of the source host.

The comparison process is outlined below:

  1. Perform a logical AND of the destination address and the mask of the local subnet address.
  2. Perform an exclusive OR on the result of the previous operation and the local net address of the local interface.

    If the result is all 0's, the destination is assumed to be reachable directly through one of the local interfaces.

  3. If an autonomous system has more than one interface (and therefore more than one Internet address), the comparison process is repeated for each local interface.

For example, assume we have two local interfaces defined for a host network, T125. Their Internet addresses and the binary representations of those addresses are shown in the following example:

Local Network Interface Addresses
CLASS A   73.1.5.2    =  01001001 00000001 00000101 00000010


CLASS B   145.21.6.3  =  10010001 00010101 00000110 00000011

The corresponding subnet masks for the local network interfaces are shown in the following example:

Local Network Interface Addresses
CLASS A   73.1.5.2    =  11111111 11111111 11100000 00000000


CLASS B   145.21.6.3  =  11111111 11111111 11111111 11000000

If the source network, T125, is requested to send a message to a destination network with the host address 114.16.23.8 (represented in binary as: 01110010 00010000 00010111 00001000), the system checks whether the destination can be reached through a local interface.

The subnetmask keyword must be set in the configuration database of each host that is to support subnets. Before the subnetwork capability can be used, all hosts on the network must support it. Set the subnet mask permanently in the configuration database using the Web-based System Manager Network application or the Network Interface Selection menu in SMIT. The subnet mask can also be set in the running system using the ifconfig command. Using ifconfig to set the subnet mask is not a permanent change.

Broadcast Addresses

The TCP/IP can send data to all hosts on a local network or to all hosts on all directly connected networks. Such transmissions are called broadcast messages. For example, the routed routing daemon uses broadcast messages to query and respond to routing queries.

For data to be broadcast to all hosts on all directly connected networks, User Datagram Protocol (UDP) and Internet Protocol (IP) are used to send the data, and the host destination address in the IP header has all bits set to 1. For data to be broadcast to all hosts on a specific network, all the bits in the local address part of the IP address are set to 0. There are no user commands that use the broadcast capability, although such commands, or programs, can be developed.

The broadcast address can be changed temporarily by changing the broadcast parameter in the ifconfig command. Change the broadcast address permanently by using the Web-based System Manager fast path, wsm network, or the SMIT fast path smit chinet. Changing the broadcast address may be useful if you need to be compatible with older versions of software that use a different broadcast address; for example, the host IDs are all set to 0.

Local Loopback Addresses

The Internet Protocol defines the special network address, 127.0.0.1, as a local loopback address. Hosts use local loopback addresses to send messages to themselves. The local loopback address is set by the configuration manager during the system startup process. Local loopback is implemented in the kernel and can also be set with the ifconfig command. Loopback is invoked when the system is started.

Getting an Official Internet Address

The Internet Registry (IR) is the organization that is responsible for assigning identifiers, such as IP network numbers and autonomous system numbers, to networks. Currently, the Defense Data Network, Network Information Center (DDN NIC) serves as the IR. To obtain an official Internet address, contact the NIC at INFO@INTERNIC.NET or at 1-800-444-4345 (USA).


[ Previous | Next | Contents | Glossary | Home | Search ]