IP Subnet Address Ranges¶
An IPv4 (IP version 4) address is a 32-bit integer. For example, the number, 3232345779, is an IP address of a device’s interface. The IP addresses are commonly represented in a dotted-quad notation. Each 8-bit part of the IP address is represented as a decimal, separated by dots:
Binary |
1100 0000 |
1010 1000 |
0000 0001 |
0000 0011 |
---|---|---|---|---|
Decimal dotted-quad |
192. |
168. |
1. |
3 |
Each binary 8-bit block is represented by its equivalent decimal
number, e.g., 1100 0000
is 192
in decimal.
Subnets¶
A subnet is a range of IP addresses that constrains which hosts can talk to each other.
The range of IP addresses defines how many addresses may be possible in the subnet. Each individual network interface in a subnet is assigned an IP address from that range of IP addresses. In this respect, end device network interfaces have a MAC address that uniquely identifies them to the Ethernet network in addition to an IP address that connects them with the other devices in the same subnet.
Tip
Implementation Insight
What is a device interface?
Why do device interfaces have two addresses: an IP and a MAC address?
A device interface refers to the hardware and software elements of a networked device that are used to run communication protocols to send and receive data over a network. In the case of Ethernet, the device interface is the network interface card (NIC) (or, a built-in chip that serves as the Ethernet-capable NIC in the case of embedded processors) that is capable of handling Ethernet protocol messages and it has an Ethernet RJ-45 connector for a cable to be plugged in. In the case of wireless communications, the device interface is the hardware that is capable of sending and receiving wireless electromagnetic waves for handling communication for the wireless protocols.
Every networked device has at least one interface. The addressing of the interface depends on the protocol being used to communicate in the particular network that the device is attached to. In the case of Ethernet, the interfaces on the end devices send and receive packets using the MAC address as the unique identifier in the network. Since networks are connected to each other using the protocol IP, each interface also has an IP address to be able to communicate with networks that are outside the layer 2 Ethernet network that they may be in.
Bridge ports are generally not referred to as interfaces since they do not have sending and receiving functionality, rather a forwarding functionality.
The network interfaces have a pre-assigned MAC address that is not typically possible to change. The assignment of an IP address, on the other hand, is linked to the network the device may be connecting to. The device interface will be assigned an IP address within the subnet and as the device may move from one subnet to another, this address will also be updated.
Analogy: IP vs MAC address
As mentioned before, MAC addresses provide a unique identifier for the end devices in an Ethernet network. Any packet in an Ethernet network will have these unique source and destination MAC addresses to be forwarded from the sender towards the receiver. This is similar to a last name and a first name that we use to identify individuals in a group of people. Most likely the name pair, last name, first name, can identify an individual uniquely. An IP address, on the other hand, has two functions in a computer network: it uniquely identifies the devices in a network, while it also provides a reference to which network a device interface is connected to. In this respect, an individual’s street address is similar to an IP address: it is a unique address for the region that the person resides in and the address specifies the connection of that individual to the town in which the address is in.
Subnets are represented as a.b.c.d/N
where a.b.c.d
is the first
IP address in the range and the number N
(integer between 1-32) is the
prefix length. For
example, the subnet 192.168.1.0/24:
IP addresses are in the range 192.168.1.0 - 192.168.1.255
The repeating pattern in this subnet is 192.168.1
The first IP address in the subnet is 192.168.1.0
/24 indicates that the first 24 bits are the same for all IP addresses within the subnet:
Example IP addresses in this subnet are: 192.168.1.29, 192.168.1.237, 192.168.1.43, etc. corresponding to the bits as follows:
Binary |
1100 0000 |
1010 1000 |
0000 0001 |
XXXX XXXX |
192.168.1.29 |
192. |
168. |
1. |
29 (0001 1101) |
192.168.1.237 |
192. |
168. |
1. |
237 (1110 1101) |
192.168.1.43 |
192. |
168. |
1. |
43 (0010 1011) |
The table illustrates how the first 24 bits (prefix of subnet) is the same in all IP addresses in the subnet while the remaining 8 bits provide individual IP addresses to host interfaces in this subnet.
Note
Network addresses are used to refer to a subnet. For example, for
the IP addresses in the range 192.168.1.0 - 192.168.1.255, we refer to the
subnet name as 192.168.1.0/24
, that is, use the first IP address that
is available in this subnet along with the /24
prefix length that is
used to set the IP address range. First IP address that is available
is determined by setting all other
bits to zero other than the bits in the prefix length:
For example, the subnet
10.50.0.0/16
has a prefix length of 16, therefore, subnet has
the first available IP address as 10.50.0.0
.
When the prefix length is
not a multiple of eight, for example, for the subnet 10.10.128.0/17
,
the range is 10.10.128.0 - 10.10.255.255
and the first available IP
address in this subnet is 10.10.128.0
, therefore, the subnet name is
10.10.128.0.0/17
.
Example IP address range or subnet: 10.1.240.0/20
The IP addresses in the subnet are in the range 10.1.240.0 - 10.1.255.255
/20 indicates that the first 20 bits are the same for all IP addresses in the subnet: example IP addresses can be 10.1.243.23, 10.1.240.55, 10.1.253.101, etc.
Binary |
0000 1010 |
0000 0001 |
1111 XXXX |
XXXX XXXX |
10.1.243.23 |
10. |
1. |
243. (0011) |
23 (0001 1101) |
10.1.240.55 |
10. |
1. |
240. (0000) |
55 (0011 0111) |
10.1.253.101 |
10. |
1. |
253. (1101) |
101 (0110 0101) |
Example subnet: 10.1.240.128/26
The IP addresses in the subnet are in the range 10.1.240.128 - 10.1.240.191
/26 indicates that the first 26 bits are the same for all IP addresses in the subnet: example IP addresses can be 10.1.240.131, 10.1.240.185, 10.1.240.144, etc.
Binary |
0000 1010 |
0000 0001 |
1111 0000 |
10XX XXXX |
10.1.240.131 |
10. |
1. |
240. |
131 (1000 0011) |
10.1.240.185 |
10. |
1. |
240. |
185 (1011 1001) |
10.1.240.144 |
10. |
1. |
240. |
144 (1001 0100) |
Special IP Address Ranges¶
Private address ranges are not routed in the networks and therefore, are not reachable by other networks. The following IP address ranges are reserved to create private networks:
10.0.0.0/8: 10.0.0.0 - 10.255.255.255
172.16.0.0/12: 172.16.0.0 – 172.31.255.255
192.168.0.0/16: 192.168.0.0 – 192.168.255.255
These private address spaces are defined in the RFC 1918.
Note
Example organization IP address space
University of Houston’s public IP address space is the subnet 129.7/16. IP address allocations are managed by organizations such as ARIN. Here is the page that provides information about the IP address allocation of the University of Houston.
In addition, the internal networks at the University of Houston (and similar enterprises) may allocate IP addresses to end hosts within the private range of 172.16/12.