IP Addressing Tutorial – Network Address, Mask

Q1. What is network address?
Answer: We can view network and host addresses in two ways:
1) Network-ID and Host-ID

An IP address is made of two parts, the left part is network ID, the right part is host ID.

For example, in 100.3.4.5, if 100 is a network ID, then 3.4.5 is a host ID. If 100.3 is network ID, then 4.5 is a host ID.

2) Network-address and host-address. Let’s look at two examples:

IP-address Network-ID Host-ID Network-address Host-address Mask
100.4.5.6/8 100 4.5.6 100.0.0.0 100.4.5.6 /8
150.1.2.3/16 150.1 2.3 150.1.0.0 150.1.2.3 /16
Note: Network mask is presented as /m where m is a 2-digit decimal number between 8~31.
Note: IP, network, and host addresses are usually presented with masks.

Q2. What is mask?
Answer. IP uses network mask to break up a 32-bit IP-address into network-ID and host-ID. Network-address is made of network-ID bits on the left and 0 bits on the right.

For example, for 150.1.2.3/16, 16 is the network mask, 150.1 is network-ID, 150.1.0.0/16 is network-address, 2.3 is host-ID, 150.1.2.3/16 is host-address. Network-address is used by routers to forward packets. Host address is used to distinguish hosts in the same network.

Q3. Why network addresses?
Answer: When numbers are too many, we use hierarchical structure to manage them. For example, telephone number are structured as.

For example, 086.021.1234.5678 is a number in China, Shanghais. The voice message is switched by country code, city code, and prefix. Structured phone numbers are much easier to switch than flat 10-digit phone numbers.

Internet faces a similar situation. There are nearly 4.2 billion addresses (IP has 32 bits. or 2^32 individual addresses.) Routers use routing tables to foreword packets. Obviously, it’s much easier for router to handle structured addresses than 4 billion flat ones.

IP’s solution is to use network-addresses to forward packets, not individual ones. Network mask breaks an address into a network-ID and a host-ID. Routing tables use network addresses, not IP addresses.

For example,
– 100.0.0.0/8 network has 16,777,216 addresses. In a routing table, (100.0.0.0/8, next hop interface) says: forward packets with the same destination network to the same next hop interface.
– 150.1.0.0/16 network has 65,536 addresses. In a routing table, (150.1.0.0/16, next hop interface) takes care of forwarding 65,536 individual addresses in 150.1.0.0/16 network.
– 150.1.0.0/16 network has 65,536 IP addresses. In a routing table, (150.1.0.0/16, next hop interface) takes care of forwarding 65,536 individual address in 150.1.0.0/16 network.
– 222.111.44.0/24 has 256 IP addresses. In a routing table, (222.111.44.0/24, next hop interface) forwards 256 IP addresses in 222.111.44.0 network to the next hop interface.

Q4. How present mask in decimal?
Answer. Present mask the same way as IP address. For example.
/8 is presented as 255.0.0.0.
/16 is presented as 255.255.0.0.
/24 is presented as 255.255.255.0

Q5. Why mask length is multiple of 8 but?
Answer: There are two type of IP addressing schemes: classful and classless. What we’ve talked so far is classful. Classless IP (OM IP) address can use mask of any length. See next tutorials for details.

This article is the FAQ of an interactive animation. You can play this animation listed under External links.