**1. IPv4 Structure**

**is a**

IPv4

IPv4

**32 bit Address**

__DIVIDED__by decimal into

**4 octets**of

**8 bits EACH**(1 BYTE per OCTET)

Let's look at the address

__192.168.1.23__as a complete 32 bit string in binary:

**WHAT TO KNOW!!!**1. How many BITS?

- 32 = 11000000.10101000.00000001.00010111

- 4 BYTES Total, 1 per octet

- 4 Octets = OCTET 1
**.**OCTET 2**.**OCTET 3**.**OCTET 4

Each

**OCTET can range**from**0 through 255**…Results in**256 possible values**!**2. IPv4 Default Classes**

First OCTET of IP ADDRESS tells us A LOT!!!

Starting Range of IP Address

**(First Octet)**

**determines ADDRESS CLASS**and

**DEFAULT MASK**

Why do we create CLASS DIVISIONS at these numbers???Why do we create CLASS DIVISIONS at these numbers???

__Where's 127 from the chart???__

127.0.0.1 is reserved as a loopback OR interface HOME Address. You can troubleshoot your ability to send and receive IP traffic by pinging yourself at 127.0.0.1. If you successfully SEND and RECEIVE, your device has no issues using the IP Stack. If the ping fails, you would want to troubleshoot the physical device (hardware/driver) and/or the installation of the IPv4 protocol stack.

Let’s Break an Address Down!!!

EXAMPLE: 192.168.1.23

EXAMPLE: 192.168.1.23

**Subnet Mask**– Dictates

__where__the Network Address ENDS and Host Address BEGINS in IP Addresses

**Subnet Mask Formats**

Subnet Masks can appear in different formats but ALL mean the same thing when you know how to read them!

Default Class C Subnet Mask

- CIDR Format - /24 = Defines HOW MANY bits are enabled in the Mask
- Decimal Format - 255.255.255.0 = Each octet is ALL bits ON which equals 255 in decimal format
- Binary Format - 11111111.11111111.11111111.0 = First 24 ON and bits in octets add up to 255 in each

__RULE:__When enabling bits in the mask, bits MUST be enabled from

__Left > Right__and

__NO SKIPPING__!

255.255.255.0 OR /24 OR 11111111.11111111.11111111.00000000

...ALL the SAME THING

Default Masks in BINARY!

Just as we Interpret the IP Address in Binary, we will use the Subnet Mask the same way!!!

Just as we Interpret the IP Address in Binary, we will use the Subnet Mask the same way!!!

- ANY
**Enabled**bit**(1)**in the mask__IDENTIFIES__**NETWORK Portion!** - ANY
**OFF**bit**(0)**in the maskas the__IDENTIFIES__**HOST Portion!**

**3. Default Network Structure**

Default

**Masks create**a predefined

**separation**in the possible 4 Billion+ addresses

**to create**default

**NETWORK RANGES!**

Networks of HOW MANY HOSTS???

Problem is... Default Ranges are NOT very Flexible!

**Let’s Explore the Class Ranges!**

**192.168.1.0 /24**

This means we are working with a

**Class C**(192 first octet) with a

**default Class C mask**

/

**24**OR

**255.255.255**.0 OR

**11111111.11111111.11111111**.00000000

**We DO NOT USE the first Address and Last Address for Nodes/devices!**

__RULE:__**1 Network of 256 Total Addresses and 254 Usable Addresses (0 is a valid address so it counts!).**

__Results:__**Usable**means we can

**assign**these to

**network interfaces (HOST portion of MASK).**

**WHAT TO KNOW!!!**-
**Net ID**= 192.168.1.**0**(Why???**First Address**of Network) **Broadcast**= 192.168.1.**255**(Why???**Last Address**of Network)**Usable Range**= 192.168.1.**1 THROUGH**192.168.1.**254**(**Everything in between**)

**172.16.0.0 /16**

This means we are working with a

**Class B**(172 first octet) with a

**default Class B mask**

/

**16**OR

**255.255.**0.0 OR

**11111111.11111111.**00000000.00000000

**We DO NOT USE the first Address and Last Address for Nodes/devices!**

__RULE:__**1 Network of 65,536 Total Addresses and 65,534 Usable Addresses (**

__Results:__**256**

**X**

**256**

**=**

**65,536**).

**Usable**means we can

**assign**these to

**network interfaces (Host Portion of Mask)**

**WHAT TO KNOW!!!**-
**Net ID**= 172.16**.0.0**(Why???**First Address**of Network) **Broadcast**= 172.16**.255.255**(Why???**Last Address**of Network)**Usable Range**= 172.16**.0.**172.16.**1**THROUGH**255.254**(**Everything in between**)

**10.0.0.0 /8**

This means we are working with a

**Class A**(10 first octet) with a

**default Class A mask**

/

**8**OR

**255.**0.0.0 OR

**11111111**.00000000.00000000.00000000

**We DO NOT USE the first Address and Last Address for Nodes/devices!**

__RULE:__**1 Network of 16,777,216 Total Addresses and 16,777,214 Usable Addresses (**

__Results:__**256**

**X 256**

**X**

**256 = 16,777,216**).

**Usable**means we can

**assign**these to

**network interfaces (Host Portion of Mask)**

**WHAT TO KNOW!!!**-
**Net ID**= 10.**0.0.0**(Why???**First Address**of Network) **Broadcast**= 10**.255.255.255**(Why???**Last Address**of Network)**Usable Range**= 10**.0.0.****1 THROUGH**10.**255.255.25****4**(**Everything in between**)

Class and Mask Summary!!!

******4. CIDR Notation**

****

**CIDR**=

__lassless__

**C**__nter-__

**I**__omain__

**D**__outing__

**R**Allows you to express the Subnet Mask in a SHORT HAND notation.

**5. Bit Borrowing aka Subnetting**

These

**MASK bits**CAN be

**manipulated**to

**create new sub-networks**from the standard default ranges in a process known as

**bit borrowing**AKA...

**Subnetting!!**!

**We MUST borrow from**

__RULE:____when converting bits and__

**Left to Right****!**

__CANNOT SKIP ANY__**If you**

__RESULTS:__**increase**total

**number of networks**(create subnets),

**you decrease**the

**total addresses**in resulting subnet (sub-network).

**We ONLY have the pre-defined Total Addresses available from the STARTING DEFAULT CLASS!**

__WHY subnet?__- Class A = 16.77 million addresses per network
- Class B = 65,536 addresses per network
- Class C = 256 addresses per network

Why Subnetting???

– Allows you to__Security__**contain/route**packets__ONLY__**where necessary**–__Performance__**Minimize**broadcast/transmission**ranges**__Simplify Mgmt/Troubleshooting__**– Divide**networks on GEO**location**

## Subnetting Example 1

**192.168.1.0 /24**

Problem:Problem:

*We NEED 4 subnets from THIS 1 Network!*What we KNOW!

- Class???
- Class
**C**(First Octet =**192**)

- Class
- Public OR Private???
**Private**Range =**192.168**.x.x

- Default Mask???
- CIDR = /24 OR Class C = 255.255.255.0

- NetID???
- 192.168.1.0 (First Address in Network Range)

- Broadcast???
- 192.168.1.255 (Last Address in Network Range)

- Usable Range???
- 192.168.1.1 Through 192.168.1.254 CAN be assigned to HOSTS

**1 Class C Network of a total 256 addresses!**

__Results:__**Starting from your Default Mask**(in Binary), we can begin manipulating the HOST bits!

**Class C Mask in Binary…**

/24 OR 255.255.255.

__0__OR 11111111.11111111.11111111.

__00000000__

**Power of 2^n!!!**

__Remember__**…**1’s define Network Range while the 0’s define HOST addresses in Networks

We currently have 256 total host addresses…

*How???*- 8 0’s in the Binary portion of the mask…
**2^8 = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 256**

Each bit we convert to a

**1**, results in

**½**the number of HOSTS and DOUBLES the number of NETWORKS

Let’s borrow our first bit!

**We MUST borrow from**

__RULE:____when converting bits and__

**Left to Right****!**

__CANNOT SKIP ANY__/24 CAN ONLY become a /25 by turning on the 25th bit in the MASK!

**/25**OR 255.255.255.

**OR 11111111.11111111.11111111.**

__128____0000000__

**1****2 Networks of 128 Hosts in Each**

__Results:__- 2 X 128 = 256 Total Addresses (Original Class C Range)

__HOW???__

__(Decimal OR Power of 2 Approach)__

*Decimal Approach*

*Power of 2 Approach***How many bits did we borrow (Convert to 1’s) from our**

*Solve for Subnets…***DEFAULT MASK**?

- 11111111.11111111.11111111.
00000000__1__- 1 bit = 2^1 = 2 OR in other words...2 Subnets

**How many bits remained HOST bits?**

*Solve for Hosts…*- 7 remaining 0’s = 2^7 = 2 x 2 x 2 x 2 x 2 x 2 x 2 = 128 HOSTS Per Network

Define the new Subnet Range ResultsDefine the new Subnet Range Results

__...__

We DO NOT USE the first Address and Last Address of the subnets for Nodes!__RULE:__1st Subnet has 128 Total Addresses and 126 Usable Addresses.__Results:__**Usable**means we can**assign**these to**network interfaces (HOST portion of MASK).**

****

**WHAT TO KNOW from borrowing 1 bit!!!**____

*That’s NOT enough NETWORKS*…we wanted 4 total. Let’s borrow another bit!

**Remember the RULES above...**

/26OR 255.255.255.

/26

**OR 11111111.11111111.11111111.**

__192____000000__

**11****4 Networks of 64 Hosts Each**

__Results:__- 4 X 64 = 256 Total Addresses (Original Class C Range)

__HOW???__

__(Decimal OR Power of 2 Approach)__

*Decimal Approach*

*Power of 2 Approach***How many bits did we borrow (Convert to 1’s) from our**

*Solve for Subnets…***DEFAULT MASK**?

- 11111111.11111111.11111111.
0000000__11__- 2 bits = 2^2 = 2 x 2 = 4 OR in other words...4 Subnets

**How many bits remained HOST bits?**

*Solve for Hosts…*- 6 remaining 0’s = 2^6 = 2 x 2 x 2 x 2 x 2 x 2 = 64 HOSTS Per Network

__Define the new Subnet Range Results____...__

We DO NOT USE the first Address and Last Address of the subnets for Nodes!__RULE:__1st Subnet has 64 Total Addresses and 62 Usable Addresses.__Results:__**Usable**means we can**assign**these to**network interfaces (HOST portion of MASK).**

****

**WHAT TO KNOW from borrowing 2 bits!!!**____

*That’s Perfect!!! We ended up with 4 NETWORKS with each being 64 Addresses in size. We borrowed 2 bits!*

**The**

Shortcuts for Class C bit borrowing (w/ Decimal Approach)

Shortcuts for Class C bit borrowing (w/ Decimal Approach)

**last bit**we turn

**ON**will define the

**size of networks**to solve for

**HOSTS**!

**If we borrow bits up to the 29th bit (value of 8), networks are 8 in size (6 HOSTS USABLE)!**

__Example:__

## Subnetting Example 2

**172.20.0.0 /16**

Problem:Problem:

*We NEED to accommodate 481 HOSTS without wasting addresses!*What we KNOW!

- Class???
- Class
**B**(First Octet =**172**)

- Class
- Public OR Private???
**Private**Range = 172.16.0.0 THROUGH 172.31.255.255

- Default Mask???
- CIDR =
**/16**OR Class B =**255.255**.0.0

- CIDR =
- NetID???
- 172.16.0.0 (First Address in Network Range)

- Broadcast???
- 172.16.255.255 (Last Address in Network Range)

- Usable Range???
- 172.16.0.1 Through 172.16.255.254 CAN be assigned to HOSTS

**1 Class B Network of a total 65,536 addresses!**

__Results:__Starting from your Default Mask (in Binary), we can begin manipulating the HOST bits!

**Class B Mask in Binary…**

/16 OR 255.255.0.

__0__OR 11111111.11111111

__.00000000__

__.__

__00000000__

*Power of 2^n Approach!!!*

__Remember__**…**1’s define Network Range while the 0’s define HOST addresses in Networks

We currently have 65,536 total host addresses…

*How???***16**0’s in the binary HOST portion of the mask…**2^16 = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 65,536**

Each bit we convert to a

**1**, results in

**½**the number of HOSTS and DOUBLES the number of NETWORKS.

**We MUST borrow from**

__REMEMBER the RULE:____Left to Right__when converting bits and

__CANNOT SKIP ANY!__16 > 17 > 18 > 19 > etc…

**We can even move from the 3rd octet into the 4th octet!**

Let’s borrow our first bit!

For the challenge here, we are concerned with making a subnet to accommodate 481 hosts. If all bits are set to 1's, we will have NO HOST addresses available.

/32 leaves NO 0's. This does not allow for ANY host addresses.

Starting with the

/31 leaves only one 0. This permits for only 2 host addresses.

For the challenge here, we are concerned with making a subnet to accommodate 481 hosts. If all bits are set to 1's, we will have NO HOST addresses available.

/32 leaves NO 0's. This does not allow for ANY host addresses.

**/32**OR 255.255.__.__**255****OR 11111111.11111111.**__255____.__**11111111**____**11111111**Starting with the

**32nd bit**, we will determine how many hosts are accommodated by leaving the 32nd bit as a 0./31 leaves only one 0. This permits for only 2 host addresses.

**/31**OR 255.255.__.__**255****OR 11111111.11111111.**__254____.__**11111111**__0__**1111111**__HOW???____(Decimal OR Power of 2 Approach)__

*Decimal Approach*

*Power of 2 Approach***How many bits remained HOST bits?**

*Solve for Hosts…*- 1 remaining 0 = 2^1 = 2 = 2 HOSTS Per Network

**How many bits would we have to borrow (Convert to 1’s) to leave only 1 HOST bit enabled from our**

*Solve for Subnets…***DEFAULT MASK (/16)**?

- 11111111.11111111.
**11111111****.**0__1111111__- 15 bits = 2^15 = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 32,768 OR in other words... 32,768 Subnets of 2 Hosts (65,536 Total Addresses). That accounts for ALL original addresses available in our single /16 network we started with.

This might give us a different perspective of viewing the mask (Host perspective) but this is WAY OFF from the 481 hosts would would like per network.

Let's leave the 30th bit OFF and see how that impacts the networks. We will still be way off, but before I jump further into the mask, let me make sure the concept is understood...

Let's leave the 30th bit OFF and see how that impacts the networks. We will still be way off, but before I jump further into the mask, let me make sure the concept is understood...

*Decimal Approach***How many bits remained HOST bits?**

*Solve for Hosts…*- 2 remaining 0's = 2^2 = 2 x 2 = 4 HOSTS Per Network

**How many bits would we have to borrow (Convert to 1’s) to leave only 2 HOST bit enabled from our**

*Solve for Subnets…***DEFAULT MASK (/16)**?

- 11111111.11111111.
**11111111****.**00__111111__- 14 bits = 2^14 = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 16,384 OR in other words... 16,384 Subnets of 4 Hosts (65,536 Total Addresses). That accounts for ALL original addresses available in our single /16 network we started with.

At this rate, we would be here for a while to reach 481 hosts. Let's work under the understanding that each time we leave 0 in the mask, the amount of HOST addresses available will double.

**6. VLSM**

To be continued....

VLSM Example 1

To be continued....

VLSM Example 2

To be continued....