Subnetting

anchored to 143.00_anchor


Overview

contains some information about the idea and application of subnetting. Most which where not given during the lab itself.

Contains content from the following sources: https://www.freecodecamp.org/news/subnet-cheat-sheet-24-subnet-mask-30-26-27-29-and-other-ip-address-cidr-network-references/

for a short / quick overview consider 143.07_subnet_cheat_sheet

a good webapp for calculating subnets with different traits might be found here

Concept / Idea

The idea of subnets is relatively easy in nature: We would like to create networks within networks to allow separation of hosts or similar. Further this can be used to split a given block into smaller portions, like 134.12.0.0/16 --> which we may've been supplied. Consider that we would like to split this network into 12 subnets - for whatever reason - meaning that we would require 4bits of subnet-identifiers to denote a better split for this.

By applying those additional 4bits we are also shrinking the amount of possible hosts in this network from $2^{32-16}$ to $2^{32-16-4} = 2^{12}$ - yet we gain the chance to split them accordingly!.

To illustrate this idea further consider the following graphic:

Beside splitting the network into smaller ones, hosts can easily map out which devices they can reach / or not.

To signal a given subnet we can make use of CIDR - also denoted in 143.01_ip_subnets - which allows use to describe the used subnet-mask at the end of the given range / host-ip: 10.10.10.0/24 --> Subnetmask = 255.255.255.0.

to take the definition from freedcodecamp:

[!Definition] Subnetmasks Subnet masks function as a sort of filter for an IP address. With a subnet mask, devices can look at an IP address, and figure out which parts are the network bits and which are the host bits.

TypeDecimalBinary
IP address192.168.0.10111000000.10101000.00000000.01100101
Subnet mask255.255.255.011111111.11111111.11111111.00000000

With the two laid out like this, it's easy to separate 192.168.0.101 into network bits and host bits. Whenever a bit in a binary subnet mask is 1, then the same bit in a binary IP address is part of the network, not the host.

Since the octet 255 is 11111111 in binary, that whole octet in the IP address is part of the network. So the first three octets, 192.168.0, is the network portion of the IP address, and 101 is the host portion.

In other words, if the device at 192.168.0.101 wants to communicate with another device, using the subnet mask it knows that anything with the IP address 192.168.0.xxx is on the same local network.

Another great resource showing why subnetting is good useful may be found here at cloudflare

They also come up with a good explanation / analogy for reasons of subnetting:

[!Quote] Motivation for Subnets - by Cloudflare Imagine Alice puts a letter in the mail that is addressed to Bob, who lives in the town right next to hers. For the letter to reach Bob as quickly as possible, it should be delivered right from Alice's post office to the post office in Bob's town, and then to Bob. If the letter is first sent to a post office hundreds of miles away, Alice's letter could take a lot longer to reach Bob.

Like the postal service, networks are more efficient when messages travel as directly as possible. When a network receives data packets from another network, it will sort and route those packets by subnet so that the packets do not take an inefficient route to their destination.

Subnetting with IPv6

The whole definition of subnetting with Ipv6 can be found here: RFC 2373

Subnetting with IPv6 follows the same principles as with IPv4, but with some simplifications. Because IPV6 is long - 128bits! - a subnetmask is not really feasible to use. Als alternative a new notation was introduced that indicates the size of a given subnet identifier (e.g. fd01::\64) Furthermore addresses like broadcast were swept - they are now replaced by v6 multicast - and the notation of a network was removed too: ( i.e the representation as 10.10.10.0/24 was removed, allowing us to use 10.10.10.0 as valid address - in ipv6 of course). With those additions we suddenly have more addresses available - although we have enough see here As example: The subnet fd01::\64 allows us to use all addresses in the range of fd01::0000:0000:0000:0000 - fd01::ffff:ffff:ffff:ffff for hosts!

Typically, non-aggregated subnets use a 64 bit subnet prefix. The rest of the address, bits 65 - 128, are used as an interface identifier. Interface identifiers are constructed according to the IEEE EUI-64 format. Most of the time, the interface identifier is either constructed from the MAC address of a network interface card, or it is generated randomly when SLAAC with privacy extensions is used.