IP Address

By Xah Lee. Date: .

IP Address

IP address is used to identify all internet devices. (Each internet device may have one or more IP address.)

There are 2 versions of IP address: IPv4 and IPv6.

IPv4 is the older standard. Because it's only 32 bits, good for 2^32 unique address (about 4.2 billion). This is not enough since late 1990s. So, IPv6 was invented.

How to find the IP address of my network adapter?

How to find the IP address of my router?

IP Address Structure: Network, Host, Special Addresses

IP addresses are divided into 2 parts: network and host. The beginning bits are the network, the rest are host.

When a router gets a packet, it needs to know where to send this packet to (of all devices connected to it). Ultimately, this is done by a look-up table called Routing table (aka Routing Information Base, RIB)

When the network part of a destination IP address matches the network part of a from IP address, then the router knows it's from the same network, so it can send it to the host machine. Else, it is a different network, it can send it to another router.

The reason IP address is divided into network and host parts is because it makes routing much more efficient. Similar to a home address is divided into Country, State/Province, City, then finally street address.

Netmask: Network Bitmask

For example, if a IP address has a bitmask of 11111111 11111111 00000000 00000000, it means the first 16 bits of the IP address is network, and rest the host.

CIDR Notation

CIDR notation is used to indicate how many bits in the beginning of a IP address are network. (CIDR means Classless Inter-Domain Routing)

CIDR notation is like this x.x.x.x/n, where the x.x.x.x is the usual dotted decimal notation for IP address, and the n is the number of bits for the network part.

example:

192.0.2.0/24

It means the first 24 bits are network.

IPv4 Special Address

When the network part of a IP address or the host part of a IP address is all 0 or all 1, it has special meaning.

There are more special addresses. See Reserved IP addresses