Skip to main content

11.3.2 IPv4 Addressing

Learn the specifics behind IPv4 addresses.

When generating a new IP address to hand off to a network node, there are also other things we need to configure.

  • the subnet mask
  • the default gateway
  • DNS server address

There are two ways to configure an IPv4 network connection: statically or dynamically.

Static Configuration

In static configuration, each network node is manually assigned their IP address, and that information should never change unless manually reassigned. The problem is manually assigning an IP address to each node is tiresome, and you have to remember each IP address you've already assigned to not cause any duplication conflicts (two nodes that have the same IP address). Manually assigning IP addresses is also prone to errors, as it's quite easy to accidentally input the wrong default gateway IP or subnet mask.

The best place to use static configuration for IP addresses is when nodes are going to be frequently accessed by other network nodes. These devices can include servers, routers, switches, and network printers.

Dynamic Configuration (via DHCP)

With DHCP, we only need to setup a single server with static configuration. From there, every node that needs an IP address with scan the network for a DHCP server. If there is one, it asks the DHCP server for an IP address to associate with it's MAC address. This process eliminates the need to manually assign an IP address to every node and the issues that might arise when doing so.

Address Classes for IPv4

IP addresses are divided into five classes, ranging from the letters (A-E). Each IP class has it's own default subnet mask and IP address range.

Class IP Range [Public] Subnet Mask Host Count
A 0-127 255.0.0.0 224 (16777216)
B 128-191 255.255.0.0 65536
C 192-223 255.255.255.0 256
D (reserved; multicast operations) 224-239 - -
E (experimental; military use) 240-255 - -

IP addresses are held and managed by the Internet-Assigned-Numbers-Authority. IANA assigns blocks of IP addresses to ISPs around the world. When you purchase an Internet plan from an ISP, they're lending you an IP address given to them by IANA. These are known as public IP addresses.

Each IP class reserves a special set of addresses for use in private networks. These IP addresses are only used within the local network. When the devices go online and access data from outside the local network, it does so using the public IP address assigned to it by the ISP. Therefore, it's normal to see devices on different networks that have matching private IP addresses, since they'll be using the public IP address when they go online.

Below is a table of all the private IP ranges, as defined by the Internet Engineering Task Force (Memo RFC1918).

Class IP Range [Private] Address Count
A 10.0.0 - 10.255.255.255 ~16,800,000
B 172.16.0.0 - 172.31.255.255 ~1,000,000
C 192.168.0.0 - 192.168.255.255 ~ 65,000
Special Address 1

There are a special type of IP called Automatic-Private-IP-Addressing. When a DHCP server is unable to find a free IP address to assign to a device, it gives it a special IP address. The device is NOT able to access the network. This special IP address will always begin with 169.254.x.x. If any IP address begins with 169, there is something wrong with the IP configuration or the DHCP server.

Special Address 2

The local loopback address is usually 127.0.0.1 and is commonly referred to as localhost. Computers typically use it as a way to reference itself. It's typically used for testing purposes. Pinging localhost and receiving a response means that the device's NIC is functional.

Special Address 3

There are always two IP addresses reserved by the network. They are the broadcast and network addresses. The broadcast network is usually set to the last address in the network's private IP range, while the network is usually set to the first. For example, if we have a Class C network, the network address would be 192.168.1.0 and the broadcast address would be 192.168.1.255.

This is the reason why an IP address can never end with x.x.x.0 or x.x.x.255.

#XI

#Aplus