> For the complete documentation index, see [llms.txt](https://neerajcysec.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://neerajcysec.gitbook.io/notes/networking/ccna-notes/subnetting-3.md).

# Subnetting (3)

{% embed url="<https://youtu.be/z-JqCedc9EI>" %}

## Review

* [Subnetting (1)](/notes/networking/ccna-notes/subnetting-1.md)
* [Subnetting (2)](/notes/networking/ccna-notes/subnetting-2.md)

## Subnetting Class A

* 10.0.0.0/8 network. 2000 subnets. Find the prefix length and the no. of hosts per subnet.
  * Borrowing 11 bits allows us to make 2000 subnets (2^11 = 2048).
  * So /19 prefix (8+11).
  * 13 hosts remaining, so 8190 hosts per subnet.

> Each bit you borrow doubles the number of subnets you can make.

* 10.217.182.223/11
  * Network addr : 10.192.0.0/11 (change hosts bits to 0)
  * Broadcast addr : 10.223.255.255 (change hosts bits to 1)
  * First usable addr : 10.192.0.1/11 (network addr + 1)
  * Last usable addr : 10.223.255.254 (broadcast addr - 1)
  * No. of hosts : 2,097,150 (21 host bits = 2^21 - 2)

## Variable-Length Subnet Mask (VLSM)

> Process of creating subnets of diff. sizes to make use of network addr. more efficiently.

* Till now we used Fixed-Length Subnet Mask (FLSM) - all subets use the same prefix length (subnetting a class C network into 4 subnets using /26).

### Steps

* Assign the largest subnet at the start of the address space.
* Assign the second-largest subnet after it.
* Repeat the process until all the subnets have been assigned.

<figure><img src="https://935233489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUGyWMBzIPoBvXNyR5UOW%2Fuploads%2FFzq3rT5vZCleWJ3zzt7J%2FVLSM.png?alt=media&amp;token=e5567985-01c1-4284-9e77-4c07e27ee40b" alt=""><figcaption></figcaption></figure>

**Tokyo LAN A**

* Network addr : 192.168.1.0/25
* Broadcast addr : 192.168.1.127/25
* First usable addr : 192.168.1.1/25
* Last usable addr : 192.168.1.126/25
* No. of hosts : 126 takes half of the total subnets

**Toronto LAN B**

* Network addr : 192.168.1.128 (Tokyo A broadcast + 1)
* Prefix length : /26 (because 45 hosts)
* Broadcast addr : 192.168.1.191/26
* First usable addr : 192.168.1.129/26
* Last usable addr : 192.168.1.190/26
* No. of hosts : 62 takes quarter of the total subnets

**Toronto LAN A**

* Network addr : 192.168.1.192 (Toronto B broadcast + 1)
* Prefix length : /27 (because 29 hosts)
* Broadcast addr : 192.168.1.223/27
* First usable addr : 192.168.1.193/27
* Last usable addr : 192.168.1.222/27
* No. of hosts : 30

**Tokyo LAN B**

* Network addr : 192.198.1.224 (Toronto A broadcast + 1)
* Prefix length : /28 (since 8 hosts, cannot use /29 because only 6 hosts are allowed)
* Broadcast addr : 192.198.1.239/28
* First usable addr : 192.198.1.225/28
* Last usable addr : 192.198.1.238/28
* No. of hosts : 14

**Point-to-point connection**

* Network addr : 192.198.1.240
* Prefix length : /30
* Broadcast addr : 192.168.1.243/30
* First usable addr : 192.168.1.241/30
* Last usable addr : 192.168.1.242/30
* No. of hosts : 2

> In CCNA exam, don't use /31 prefix length for point-to-point connections.

## Resources

* <http://subnettingquestions.com/>
* <http://subnetting.org/>
* <https://subnettingpractice.com/>
