Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [165]

By Root 2810 0
separated by periods. For example, the IP address for our machine boulder is written as “128.138.240.1”. The leftmost byte is the most significant and is always part of the network portion.

When 127 is the first byte of an address, it denotes the “loopback network,” a fictitious network that has no real hardware interface and only one host. The loopback address 127.0.0.1 always refers to the current host. Its symbolic name is “localhost”.

An interface’s IP address and other parameters are set with the ifconfig command. Jump ahead to page 300 for a detailed description of ifconfig.

IP address classes


Historically, IP addresses were grouped into “classes,” depending on the first bits of the leftmost byte. The class determined which bytes of the address were in the network portion and which were in the host portion. Today, routing systems use an explicit mask to specify the network portion and can draw the line between any two bits, not just on byte boundaries. However, the traditional classes are still used as defaults when no explicit division is provided.

Classes A, B, and C denote regular IP addresses. Classes D and E are used for multicasting and research purposes. Table 13.3 describes the characteristics of each class. The network portion of an address is denoted by N, and the host portion by H.

Table 13.3 Historical Internet address classes

a. The values 0 and 255 are special and are not used as the first byte of regular IP addresses. 127 is reserved for the loopback address.

Subnetting and netmasks


It is rare for a single physical network to have more than a hundred computers attached to it. Therefore, class A and class B addresses (which allow for 16,777,214 and 65,534 hosts per network, respectively) are really quite silly and wasteful. For example, the 126 class A networks use up half of the available address space.

Most sites that have these addresses use a refinement of the addressing scheme called subnetting, in which part of the host portion of an address is “borrowed” to extend the network portion. For example, the four bytes of a class B address would normally be interpreted as N.N.H.H. If subnetting is used to assign the third byte to the network number rather than the host number, the address would be interpreted as N.N.N.H. This use of subnetting turns a single class B network address into 256 distinct class-C-like networks, each capable of supporting 254 hosts.

This reassignment is effected by using the ifconfig command to associate an explicit “subnet mask” with a network interface. Each bit of the netmask that corresponds to the network portion of an IP address is set to 1, and host bits are set to 0. For example, the netmask for the N.N.N.H configuration would be 255.255.255.0 in decimal or 0xFFFFFF00 in hex. ifconfig normally uses the inherent class of an address to figure out which bits are part of the network. When you set an explicit mask, you simply override this behavior.

See page 300 for more information about ifconfig.

The division between network part and host part need not fall on a byte boundary. However, the network bits must be contiguous and must appear at the high order end of the address. Configurations such as N.N.H.N were once allowed but were not common; they are no longer permitted.

Netmasks that do not end at a byte boundary can be annoying to decode and are often written as /XX, where XX is the number of bits in the network portion of the address. For example, the network address 128.138.243.0/26 refers to the first of four networks whose first bytes are 128.138.243. The other three networks have 64, 128, and 192 as their fourth bytes. The netmask associated with these networks is 255.255.255.192 or 0xFFFFFFC0; in binary, it’s 26 ones followed by 6 zeros. Exhibit C shows the relationships among these numbers in a bit more detail.

Exhibit C Subnet mask base conversion

A /26 network has 6 bits left (32 − 26 = 6) to number hosts. 26 is 64, so the network has 64 potential host addresses. However, it can only accommodate 62 actual hosts, because

Return Main Page Previous Page Next Page

®Online Book Reader