IP address formats:
- Every host and router on the Internet has an IP address, which encodes its network number and host number.
- No two machines on the Internet have the same IP address.
- All IP addresses are 32 bits long and are used in the Source address and Destination address fields of IP packets.
- For several decades, IP addresses were divided into the five categories listed in Fig. 3.3.
- This allocation has come to be called classful addressing. It is no longer used, but references to it in the literature are still common.
Figure 3.3 IP address formats.
- The class A, B, C, and D formats allow for up to 128 networks with 16 million hosts each, 16,384 networks with up to 64K hosts, and 2 million networks (e.g., LANs) with up to 256 hosts each (although a few of these are special).
- Also supported is multicast, in which a datagram is directed to multiple hosts. Addresses beginning with 1111 are reserved for future use.
- Over 500,000 networks are now connected to the Internet, and the number grows every year.
- Network addresses, which are 32-bit numbers, are usually written in dotted decimal notation.
- In this format, each of the 4 bytes is written in decimal, from 0 to 255.
- For example, the 32-bit hexadecimal address C0290614 is written as 220.127.116.11.
- The lowest IP address is 0.0.0.0 and the highest is 255.255.255.255.
- The values 0 and -1 (all 1s) have special meanings, as shown in Fig. 3.4.
- The value 0 means this network or this host. The value of -1 is used as a broadcast address to mean all hosts on the indicated network.
Figure 3.4 Special IP addresses
- The IP address 0.0.0.0 is used by hosts when they are being booted.
- IP addresses with 0 as network number refer to the current network.
- These addresses allow machines to refer to their own network without knowing its number (but they have to know its class to know how many 0s to include).
- The address consisting of all 1s allows broadcasting on the local network, typically a LAN.
- The addresses with a proper network number and all 1s in the host field allow machines to send broadcast packets to distant LANs anywhere in the Internet (although many network administrators disable this feature).
- Finally, all addresses of the form 127.xx.yy.zz are reserved for loopback testing.
- Packets sent to that address are not put out onto the wire; they are processed locally and treated as incoming packets.
- This allows packets to be sent to the local network without the sender knowing its number.