What is an IPv4 address, and what are its network and host parts?
EasyConceptIP Addressing & Subnetting
Answer
An IPv4 address is a 32-bit number that identifies a network interface. It is written in dotted-decimal notation as four 8-bit parts called octets, each from 0 to 255, such as 192.168.1.10. The leading bits identify the network, and the remaining bits identify the host within that network.
- Routers look only at the network part to forward a packet, much as a sorting office looks only at the PIN code of a letter.
- Originally the split was fixed by classes: Class A (first octet 1–126, 8 network bits), Class B (128–191, 16 bits) and Class C (192–223, 24 bits). Today a subnet mask or CIDR prefix sets the split freely, which is called classless addressing.
- 32 bits give 2^32, about 4.3 billion addresses, which is why public IPv4 addresses have run out.
Example: Convert 192.168.1.10 to binary, one octet at a time:
192 = 11000000 168 = 10101000 1 = 00000001 10 = 00001010
With a /24 split, the first 24 bits (192.168.1) are the network and the last 8 bits (10) are the host, so this is host 10 on the network 192.168.1.0.