Private addresses:

Class A: 10.0.0.0 - 10.255.255.255 [1 network]
Class B: 172.16.0.0 - 172.31.255.255 [16 networks]
Class C: 192.168.0.0 - 192.168.255.255 [256 networks]

A private IP address is the address our network router assigns to our device. Each device within the same network is assigned a unique private IP address — this is how devices on the same internal network talk to each other. Private IP addresses let devices connected to the same network communicate with one another without connecting to the entire internet.

A public IP address is an IP address that can be accessed directly over the internet and is assigned to our network router by our internet service provider (ISP). Our personal device hence has a private IP that remains hidden when we connect to the internet through our router’s public IP.

NAT stands for network address translation. It’s a way to map multiple private addresses inside a local network to a public IP address before transferring the information onto the internet.

IP addresses identify each device connected to the internet. The existing IP version 4 (IPv4) uses 32-bit numbered IP addresses, which allows for 4 billion possible IP addresses, which seemed like more than enough when it launched in the 1970s. However, the internet has exploded, and while not all 7 billion people on the planet access the internet regularly, those that do often have multiple connected devices: phones, personal desktop, work laptop, tablet, TV, even refrigerators. Therefore, the number of devices accessing the internet far surpasses the number of IP addresses available. Routing all of these devices via one connection using NAT helps to consolidate multiple private IP addresses into one public IP address. This helps to keep more public IP addresses available even while private IP addresses proliferate.
IPv6 was created for many reasons. One of them was to accommodate the need for more IP addresses. This is because traditional NAT itself couldn’t quite keep up with demand. IPv6 uses 128-bit numbered IP addresses, which allow for exponentially more potential IP addresses than IPv4. It will take many years before this process finishes; so until then, using NAT for IPv4 addresses will remain a common practice. More importantly, though, IPv6 does more than just provide a (much) larger IP address space - IPv6 also makes routing much more efficient.

Subnet masks

One restriction of subnet masks is that all the network bits [1s] must be contiguous and all the host bits [0s] are contiguous.

There are 4 methods of representing subnet mask:

  1. Dotted-decimal: 192.168.1.0 255.255.255.0
  2. Number of networking bits: 192.168.1.0/24
  3. Hexadecimal: 192.168.1.0 0xFFFFFF00
  4. Binary: 192.168.1.0 11111111111111111111111100000000

The most common of these formats are dotted-decimal and number of networking bits.

Default Subnet mask for Classes A, B and C:

Class A - 255.0.0.0
Class B - 255.255.0.0
Class C - 255.255.255.0

IP address and Subnet Mask have symbiotic relationship.

255.255.255.0 can be Class A or Class B, too.
255.255.0.0 can be Class A, too, but cannot be Class C.

This list shows valid Subnet Mask values:
00000000 = 0
10000000 = 128
11000000 = 192
11100000 = 224
11110000 = 240
11111000 = 248
11111100 = 252
11111110 = 254
11111111 = 255

Planning IP addressing - 6 steps

  1. Figure out network and host requirements [determine the number of hosts that do or will exist on the largest segment in your network].
  2. Satisfy host and network requirements [2X ≥ number of networks you need, where X represents subnet bits. 2Y - 2 ≥ number of hosts on your largest segment, where Y represents host bits. X + Y ≤ total number of host bits.] Figure out X and Y to fulfill your need for given IP address (subnet mask) and check if X + Y is correct for the written formula.
  3. Figure out the subnet mask [add number of network (subnet) bits from earlier step to the default subnet mask value].
  4. Figure out the network addresses.
  5. Figure out the directed broadcasts for your networks [the directed broadcast of a subnet is one number less than the next network number].
  6. Figure out the host values for your networks [any address between the network and directed broadcast address is a host address for a given network].

Example:
We have been assigned Class C address 192.168.1.0 [network number]; we should follow the previous procedure and determine host addresses accordingly.

1

Host number of largest segment is 14, total number of segments is 14, too.


2

2X ≥ 14 subnets, X needs to be 4 in this example, which gives us 16 subnets.
2Y - 2 ≥ 14 hosts, Y is 4, also, which would result in 14 hosts.
X + Y = 4 + 4 = 8, and that is ≤ 8 [8 is total number of host bits for a given Class C network, SM 255.255.255.0].


3

Here is a reminder that a default number of networking bits for a Class A is 8, Class B is 16, and Class C is 24. Given this, now just add class address bits to the subnet bits from above step, which gives you total number of networking bits. In our example, it is 24 + 4 = 28.
Our subnet mask for a given Class C network 192.168.1.0 is 192.168.1.0/28 [we have default SM 255.255.255.0 and adding contiguous 1s to last octet 128 + 64 + 32 + 16 = 240, we get subnet mask 255.255.255.240; this could be done in another way - in our example the number of host bits that are used are 4 lower-order bits, so adding 1 + 2 + 4 + 8 is 15. The largest number represented by a byte is 255, and since we are not using these bits we will subtract this value from 255: 255 - 15 = 240].


4

We are focusing here on multiplier i.e. multiplying value; in our example it is 14 valid hosts per subnet. Since 2Y - 2 tells us that we have also a network and a broadcast address, each network has a total of 16 addresses, and is incremented by 16 from subnet to subnet. Another way to come to this multipier is that in a byte you can have values from 0 - 255, resulting in a total of 256 numbers, and 256 - 240 (from above) equals to 16.
The interesting octet is the octet that contains the network and the host boundary: in our example it is 4th octet with the value of 240.
So, we have following networks: 192.168.1.0, 192.168.1.16, 192.168.1.32, 192.168.1.48, 192.168.1.64, 192.168.1.80, 192.168.1.96, 192.168.1.112, 192.168.1.128, 192.168.1.144, 192.168.1.160, 192.168.1.176, 192.168.1.192, 192.168.1.208, 192.168.1.224, 192.168.1.240 - we can see here that the network number in the last octet (in the last subnet) matches interesting octet in our subnet mask (240), which will always be true when you perform subnetting.


5

The directed broadcast of a subnet is one number less than the next network number, so for a subnet of 192.168.1.0 directed broadcast is 192.168.1.15 in our example, for a subnet 192.168.1.16 it is 192.168.1.31, and so on until subnet 192.168.1.240 where 192.168.1.255 is directed broadcast address.


6

This is the easiest step: any address between the network and directed broadcast address is a host address for a given network. So, for a network 192.168.1.0 and directed broadcast 192.168.1.15, host addresses are in range 192.168.1.1 - 192.168.1.14, for a network 192.168.1.96 and directed broadcast 192.168.1.111, host addresses are in range 192.168.1.97 - 192.168.1.110 etc.

« Previous Next »