Understanding IP Addresses and Networks

by | 25 Oct 2017

IP Addresses

The IP address (Internet Protocol address) is an identifier assigned to each device in a TCP/IP network. Devices use IP addressees to locate and identify the source and destination for packets traveling on the network.

IP addresses are usually written and displayed in human-readable notations, such as 172.16.254.1 in IPv4, and 2001:db8:0:1234:0:567:8:1 in IPv6.

IPv4 addresses are a 32 bit binary addresses. These 32 bits (or 4 bytes) are also called octets, broken up into four sections divided by dots, or periods. Each octet represents a binary (base 2) number between 0 and 28, each octet will be between 0 and 255.

IPv6 addresses are 128 bits, or 16 bytes. While most organizations still use IPv4, all of our devices will eventually run out of address space and IPv6 allows for more addresses. IPv6 addresses are generally written in the following form: hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh, for example: E3D7:0000:0000:0000:51F4:9BC8:C0A8:6420 or in shorthand notation E3D7::51F4:9BC8:C0A8:6420

NOTE: Remember the base 2 and IPv4 networking concepts when you interact with networking topics like subnetting and IP address ranges. For more on octets and IPv4 addresses, read the in-depth article from Cisco and the series from Lifewire.

IP Addresses and Networks

IP addresses tell us both the network segment and the host segment. Within an IP address, you can tell the IP address class and subnet mask.

In the example IP address

192.168.1.1

the network ID is the first 3 octets: 192.168.1. Every host inside the network will have same 3 octets: 192.168.1.2, 192.168.1.3, 192.168.1.4 etc.

The host ID, or .1 in the example, is assigned to the specific address.

Subnet Mask = A subnet (or subnetwork) is a logical subdivision of an IP network. Dividing a network into two or more networks is called subnetting.

To allow for more IP addresses in a network, “Classful” network design allows more individual network assignments. To separate network ID from host ID and classify each IP address in a network, use class to categorize IP address ranges:

  • Class A: 1.0.0.0 – 126.0.0.0 >> localhost
    • Class A Subnet Mask: 255.0.0.0
  • Class B: 128.0.0.0 – 191.255.255.255
    • Class B Subnet Mask: 255.255.0.0
  • Class C: 192.0.0.0 – 223.255.255.0 >> usually your internal network
    • Class C Subnet Mask: 255.255.255.0
  • Class D: 224.0.0.0 – 239.0.0.0 >> Multicast

CIDR Notation for networks

Because “Classful” networking didn’t scale well with the boom of internet-connected devices, the class system was replaced with Classless Inter-Domain Routing (CIDR).

CIDR routing prefixes are expressed as the first address of a network, followed by a slash character (/), followed by the bit-length of the prefix. For example,

192.168.1.1/24

CIDR notation lets you group blocks of addresses into a single routing table entry. CIDR blocks share an initial sequence of bits in the binary representation of their IP addresses (the network ID). To show how large a network is (or how many addresses in that network) you can omit the address portion. A /20 block is a CIDR block with an unspecified 20-bit prefix.

Example 

When you create a VPC in Amazon AWS or a VPN in Azure, you must specify a range of IPv4 addresses; for example, 10.0.0.0/16. [Since IPv6 is still not as common, both clouds offer optional IPv6 addressing.]

The new VPC you created spans the entire AWS region. After you create a VPC, you can add one or more subnets in each Availability Zone. Specify the CIDR block for each subnet. The subnet CIDR block must be a subset of the whole VPC CIDR block. Your subnets can only be in one Availability Zone and cannot span zones. Use separate Availability Zones to protect applications from location failure (by adding high availability).

VPC Network diagram

Network sizing with CIDR notation

Future sections will delve into networking sizing for AWS and Azure, but you will eventually need to calculate your network size using subnet CIDR blocks. A handy tool is Subnet-calculator.com

For example, AWS recommends using a CIDR block of /16 or smaller:

  • 10.0.0.0 – 10.255.255.255 (10/8 prefix)
  • 172.16.0.0 – 172.31.255.255 (172.16/12 prefix)
  • 192.168.0.0 – 192.168.255.255 (192.168/16 prefix)