To connect a PC to the Internet, you need to apply an IP address from the Internet Service Provider (ISP).
An IP address is a numerical label assigned to each device on a computer network. An IPv4 address is a 32-bit binary number. IPv4 addresses are expressed in dotted decimal notation, which helps you memorize and identify them. In dotted decimal notation, an IPv4 address is written as four decimal numbers, one for each byte of the address. For example, the binary IPv4 address 00001010 00000001 00000001 00000010 is written as 10.1.1.2 in dotted decimal notation.
An IPv4 address consists of two parts:
Network ID (Net-id): The network ID identifies a network.
Host ID (Host-id): The host ID identifies different hosts on a network. Network devices with the same network ID are located on the same network, regardless of their physical locations.
IPv4 addresses have the following characteristics:
IP addresses do not show any geographical information. The network ID represents the network to which a host belongs.
When a host connects to two networks simultaneously, it must have two IP addresses with different network IDs. In this case, the host is called a multihomed host.
Networks allocated with the network ID are in the same class.
As shown in Figure 1, IP addresses are classified into five classes to facilitate IP address management and networking.
At present, most IP addresses in use belong to Class A, Class B, or Class C. Class D addresses are multicast addresses and Class E addresses are reserved. The easiest way to determine the class of an IP address is to check the first bits in its network ID. The class fields of Class A, Class B, Class C, Class D, and Class E are binary digits 0, 10, 110, 1110, and 1111 respectively. For details about IP address classification, see RFC 1166.
Certain IP addresses are reserved, and they cannot be allocated to users. Table 1 lists the ranges of IP addresses for the five classes.
Class |
Range |
Description |
---|---|---|
A |
0.0.0.0 to 127.255.255.255 |
IP addresses with all-0 host IDs are network addresses and are used for network routing. IP addresses with all-1 host IDs are broadcast addresses and are used for broadcasting packets to all hosts on the network. |
B |
128.0.0.0 to 191.255.255.255 |
IP addresses with all-0 host IDs are network addresses and are used for network routing. IP addresses with all-1 host IDs are broadcast addresses and are used for broadcasting packets to all hosts on the network. |
C |
192.0.0.0 to 223.255.255.255 |
IP addresses with all-0 host IDs are network addresses and are used for network routing. IP addresses with all-1 host IDs are broadcast addresses and are used for broadcasting packets to all hosts on the network. |
D |
224.0.0.0 to 239.255.255.255 |
Class D addresses are multicast addresses. |
E |
240.0.0.0 to 255.255.255.255 |
Reserved. The IP address 255.255.255.255 is used as a Local Area Network (LAN) broadcast address. |
Network ID |
Host ID |
Used as a Source Address |
Used as a Destination Address |
Description |
---|---|---|---|---|
All 0s |
All 0s |
Yes |
No |
Used by local hosts on a local network. |
All 0s |
Host ID |
Yes |
No |
Used by specified hosts on a network. |
127 |
Any value except all 0s or all 1s |
Yes |
Yes |
Used as loopback addresses. |
All 1s |
All 1s |
No |
Yes |
Limited broadcast address (packets with this IP address will never be forwarded). |
Net-id |
All 1s |
No |
Yes |
Directed broadcast address (packets with this IP address is broadcast on the specified network). |
Net-id is neither all 0s nor all 1s.
Private IP addresses are used to solve the problem of IP address shortage. Private addresses are used on internal networks or hosts, and cannot be used on the public network. RFC 1918 describes three IP address segments reserved for private networks.
Class |
Range |
---|---|
A |
10.0.0.0 to 10.255.255.255 |
B |
172.16.0.0 to 172.31.255.255 |
C |
192.168.0.0 to 192.168.255.255 |