IP address

From Hill2dot0
Jump to: navigation, search
IPv4 Addresses

Each device attached to a TCP/IP-based network must be given a unique address. These addresses are carried in the IP packet to identify the source and destination hosts. IP defines 32 bit (four octet) addresses, which permit over four billion hosts to attach to a single internetwork. IP addresses are represented in a format known as dotted decimal, where each octet is represented by its decimal equivalent and the four numbers are separated by a dot (.). With eight bits, you can represent numbers between 0 and 255. Therefore, the IP address represented in binary as 10000000 01000011 00100110 00010111 (hexadecimal 80-43-26-17) is written (and spoken) in dotted decimal as

Each IP address has two components: a network identifier (NETID) and a host identifier (HOSTID). The NETID identifies the specific network to which the host is attached. The HOSTID uniquely identifies a host within that network. This distinction is important because routers route to a given NETID and don’t care about the HOSTID. IP actually permits the boundary between the NETID and the HOSTID to shift. By extending the NETID and shrinking the HOSTID for a given network, one network can be partitioned into multiple subnetworks, a process known as subnetting. To indicate where the new boundary has been set for a given network, a subnet mask is used.

IP does not permit the NETID or HOSTID to be all ones or all zeros. All ones means broadcast and can be used for all networks or all hosts. For example, the IP address has NETID 128.17 and HOSTID 255.255. It means all hosts on the network with NETID 128.17. To any IP device, refers to the entire 128.17 network, regardless of HOSTID.

IP Address Classes

IPv4 Address Classes

The relationship between the sizes of the NETID and the HOSTID is important. If we presume that the address is divided in half, a 16 bit HOSTID allows up to 65,534 hosts (bit values of all zeros and all ones are not allowed) to attach to a single subnetwork. A 16 bit NETID allows a total of 65,534 such networks to exist in the same internetwork. Although this might seem like an ideal balance at first glance, it begins to look seriously flawed when we consider that the average LAN has fewer than a hundred hosts. This means less than 100 of the possible 65,534 addresses for each network are being used; the rest are wasted. At 100 hosts per subnetwork, fewer than 6,554,000 hosts will probably attach to the internetwork, wasting over 99.8% of the available addresses—certainly not an efficient mechanism. As proof, consider that the entire address space would have been exhausted by mid-1995 had addresses been assigned this way.

To strike a balance between efficient use of the address space and the needs of different networks, five classes of address were defined, designated Class A through Class E. The three main classes of interest to us are A, B, and C. The essential difference between these classes, as depicted on the visual, is the relative size of the NETID and the HOSTID fields.

Class A addresses, indicated by a 0 bit in the first bit of the address, has an 8 bit NETID and a 24 bit HOSTID. There are only 126 possible Class A addresses. With eight bits in the NETID and the requirement that the first bit be set to 0, only the numbers from 0 to 127 can be represented. Zero is not allowed and 127 is reserved, leaving the numbers from 1 to 126. Thus, a Class A address has a number between 1 and 126 in the first octet (e.g., and Class A addresses are intended for use in very large networks since the 24 bit HOSTID can uniquely identify over 16 million hosts.

Class B addresses, indicated by a 1 bit followed by a 0 bit in the first two bits of the address, have a 16 bit NETID and a 16 bit HOSTID. Subnetworks can support up to 65,534 hosts and there are 16,382 possible network addresses. The restriction of the first two bits to 1 and 0, respectively, limits the value of the first octet to the range 128 to 191. Thus, IP addresses and are examples of Class B addresses. Class B addresses are intended for moderate sized networks. Many corporations have a block of Class B addresses assigned to them, rather than a single Class A address.

Class C addresses, indicated by two 1s followed by a 0 in the first three bits of the address, are intended for small subnetworks. Class C addresses have a 24 bit NETID and an 8 bit HOSTID, permitting over two million possible network addresses. The first number of a Class C address always falls in the range 192 through 223 (e.g., and and each subnetwork can support up to 254 hosts (0 and 255 are not permitted).

Class D addresses begin with a digit between 224 and 239, and are used for multicast applications such as the Open Shortest Path First (OSPF) protocol. Class D addresses are also used in the H.323 Voice over IP (VoIP) standards for gatekeeper discovery functions.

Class E addresses begin with a number between 240 and 255 and are used for experimental purposes.

Hosts, Routers, and IPv4 Addresses

Hosts, Routers, and IPv4 Addresses

Host identifiers (HOSTID) are assigned locally by an address administrator. This function is essential to ensure that duplicate addresses are not assigned within an organization, just as the Internet Corporation for Assigned Names and Numbers (ICANN) structure is in place to ensure that duplicate network identifiers (NETID) are not assigned.

IP addresses themselves are not assigned on a per device basis, as the name HOSTID might imply, but on a per port or attachment basis. This means that some equipment is administratively part of multiple networks, as shown in the accompanying visual.

On the left of the diagram, we have a LAN with an assigned Class C NETID (the “0,” of course, is not part of the NETID, but is written as a placeholder). The two PCs and the router on the LAN have been assigned HOSTIDs 17, 5, and 100, respectively.

This LAN is attached to some wide area network (WAN) service provider that has an assigned Class B NETID The WAN has assigned the Site #1 LAN router a HOSTID of 81.54, so that the router’s WAN port has an IP address of

A similar scenario can be found at Site #2 where a customer’s host system is directly attached to the customer’s own router. Note that the host/router point-to-point link has two IP addresses because that link connects ports on two different systems. Note also that the router has a HOSTID from the WAN’s address space.

Finally, the host at Site #3 has a HOSTID directly from the WAN’s address space. This represents a host that is actually a part of the WAN. Although not shown here, each of the links going into the WAN’s “cloud” actually has to terminate at some sort of switching system, be it a host, hub, router, or whatever. This means that the end of the links that we don’t see have yet another set of IP addresses assigned.

Private IP Addresses

Because the IP address space is relatively small, much work has been done to conserve that address space. Enter NAT (or NAPT). These technologies make it possible for a consumer (corporate or residential) to be allocated as few as a single address from their ISP and use it to support multiple systems within their network. The addresses actually used by the internal systems are translated by the NAT or NPAT device before being forwarded onto the Internet.

To prevent conflict, the IANA has allocated three address blocks for these private networks. These addresses, which may not be used across the public Internet, include:

  • through
  • through
  • through

A fourth block is reserved for Automatic Private IP Addressing (APIPA):

  • through

IP Loopback Address

Another address that may not appear on the Internet is the IP loopback address ( This address is used within every IP capable device for local loopback testing. If a ping is issued to this address from any system, it tests the viability of the local TCP/IP protocol stack within that system.

See Also


<mp3>http://podcast.hill-vt.com/podsnacks/2007q1/ip_address.mp3%7Cdownload</mp3> | IP address
<mp3>http://podcast.hill-vt.com/podsnacks/2007q3/private_ip_addresses.mp3%7Cdownload</mp3> | private IP addresses
<mp3>http://podcast.hill-vt.com/podsnacks/2007q1/static-dynamic-ip.mp3%7Cdownload</mp3> | Static vs. Dynamic IP Addressing