ccna-notes7-day13-subnetting
CIDR (Classless Inter-Domain Routing)
ccna-notes2
-
Class A 0.0.0.0 ~ 127.255.255.255
- Prefix /8
-
Class B 128.0.0.0 ~ 191.255.255.255
- /16
-
Class C 192.0.0.0 ~ 223.255.255.255
- /24
-
Class D 224.0.0.0 ~ 239.255.255.255
-
Class E 240.0.0.0 ~ 255.255.255.255
-
wasted ip address Company X needs IP addressing for 5000 end hosts. A class C network does not provide enough addresses, so lass B network must be assigned. This will result in about 60000 addresses being wasted.
-
CIDR β replace the class Class A = /8 Class B = /16 Class C = /24
This allowed larger networks to be split into smaller networks, allowing greater efficiency.
These smaller networks are called βsubnetworksβ or βsubnetsβ
2^n - 2 = usable address
n = number of host bits
- 2^7+2^6 β 192
- /26 β 32-26 = 6(1 bytes got 2 1 1 in the first)
2^6-2 = 62 usable addresses
205.90.113.0/30 = 203.0.113.0 - 203.0.113.3
.00000000 .00000001 β we use .00000010 β we use .00000011
The remaining addresses in the 203.0.113.0/24 address block (203.0.113.4 - 203.0.113.255) are now available to be used in other subnets!
/31 β replacing the 0 and broadcast addresses β use it only if point to point access
/32 static route β specific host only , but not network
CIDR
Case:
45 hosts per switch , 4 switch in Total plus the 0 and broadcast addresses, +2
47*4=188
2^6-2=62 usable address (/26)
subnet 2 β one bit higher than broadcast address
64
subnet 3 β 10000000
11000.0.0.0.10101000.00000001.1000000
192 . 168 . 1 . 128
11000.0.0.0.10101000.00000001.10111111
192 : 168 . 1 . 191
Subnetting trick:
just need to add 64 to find next subnetting
Now we need to borrow 5 subnet in the Case
borrowing 3 bits β 8 subnets
β 192.168.255.0/27(borrowing 3)
- use the trick β
32 | 16 8 4 2 1
Subnet 6: 192.168.255.160/27 - not used Subnet 7: 192.168.255.192/27 - not used Subnet 8: 192.168.255.224/27 - not used
- What subnet does host 192.168.5.57/27 belong to?
Subnet ID: /27
only got 192.168.5.57(pc)
11011011 β
What subnet does host 192.168.29.219/29 belong to ?
Subnet ID: 192.168.29.216/29
table
Subnetting Class B Networks
You have been given the 172.16.0.0/16 network. You are asked to create 80 subnets for your companyβs various LANs. What prefix length should you use?
172.16.0.0/16
You have been given the 172.22.0.0/16 network. You are required to divide the network into 500 separate subnets. What prefix length should you use? 172.22.0.0/16 Borrowing 9 bits= 512 subnets
Borrowing 8 bits = 256 subnets (2^x) 2^8 β subnets
8 host bits = 254 hosts per subnet (2^8-2) , host number
Question β
What subnet does host 172.25.217.192/21 belong tο¬
Subnet ID: /21
ans 172.25.216.0
- forget about the host for subnet
- cal subnet first
- cal host
9 host bits = 2^9 - 2 = 510 usable addresses
What is the broadcast address of the network 192.168.91.78/26 belongs to?
- instead of change it to all 0 , you change it to all 1
ans: Broadcast address: 192.168.91.127 /26
Quiz: You divide the 172.16.0.0/16 network into 4 subnets of equal size. Identify the network and broadcast addresses of the second subnet.
-
Borrow 2 bits = 2*2 = 4 subnets
-
/18 case
-
Quiz You divide the 172.30.0.0/16 network into subnets of 1000 hosts each. How many subnets are you able to make?
-
10 host bits = 2^10- 2 = 1022 hosts
32 -10-16=6 2^6 = 64 subnets
Class A subnet
You have been given the 10.0.0.0/8 network. You must create 2000 subnets which will be distributed to various enterprises. What prefix length must you use? How many host addresses (usable addresses) will be in each subnet?
2^? = 2000 subnets = 11
borrow 11 13 host remaining 2^13-2=8190
Question
PC1 has an IP address of 10.217.182.223/11.
Identify the following for PC1βs subnet:
-
Network address: all 0 address after the position
-
Broadcast address: all 1 address after the position
-
First usable address: network address + 1
-
Last usable address: brodcast address -1
-
Number of host (usable) addresses:
VLSM Variable-Length Subnet Masks
Until now, we have practiced subnetting used FLSM (Fixed-Length Subnet Masks).
This means that all of the subnets use the same prefix length (ie. subnetting a class C network into 4 subnets using /26).
VLSM (Variable-Length Subnet Masks) is the process of creating subnets of different sizes, to make your use of network addresses more efficient.
VLSM is more complicated than FLSM, but itβs easy if you follow the steps correctly.
- Assign the largest subnet at the start of the address space.
- Assign the second-largest subnet after it.
- Repeat the process until all subnets have been assigned.
- adjust from each lan
- But what prefix length for Toronto lan b 192.198.1.128 /26 β
2^? β 45
= 6
32 -6 -24 = 2
borrow 2
/26
Network address: 192.168.1.128/26 Broadcast address: 192.168.1.191/26 First usable address: 192.168.1.129/26 Last usable address: 192.168.1.190/26 Total number of usable host addresses: 62 2^6-2 =62
192.168.1.191 = broadcast address of Toronto LAN B 192.168.1.192 = network address Toronto LAN A (new section)
Network address: 192.168.1.192/27 Broadcast address: 192.168.1.223/27 First usable address: 192.168.1.193/27 Last usable address: 192.168.1.222/27 Total number of usable host addresses: 30
192.168.1.0/24
192.168.1.223 = broadcast address of Toronto LAN A 192.168.1.224 = network address of Tokyo LAN B
require 8 hosts ββ 2^3 = 8 β 2^4 = 16 β
- although /29 allow 8 address because still need network and broadcast (extra)
Network address: 192.168.1.224/28 Broadcast address: 192.168.1.239/28 First usable address: 192.168.1.225/28 Last usable address: 192.168.1.238/28 Total number of usable host addresses: 14
Rest β Point to point connectino only require 2 address
192.168.1.0/24 192.168.1.239 = broadcast address of Tokyo LAN B 192.168.1.240 = network address of point-to-point connection
ccna recommend using /30 instead of/31
Network address: 192.168.1.240/30 Broadcast address: 192.168.1.243/30 First usable address: 192.168.1.241/30 Last usable address: 192.168.1.242/30 Total number of usable host addresses: 2
VLSM β tailed made
http://www.subnettingquestions.com/ https://subnetting.org/ https://subnettingpractice.com/
Question:
Question: How many subnets are available with the network 172.16.0.0/26?
To determine how many subnets are available with the network 172.16.0.0/26
, we need to break down the process and calculate the number of subnets that can be created by adjusting the subnet mask.
Step 1: Understand the /26
subnet mask
A /26
subnet mask means that the first 26 bits of the IP address are used for the network portion, leaving 6 bits for the host portion.
-
The subnet mask for
/26
in binary looks like this:11111111.11111111.11111111.11000000
In decimal, the subnet mask is
255.255.255.192
.
Step 2: Identify the number of available subnet bits
Since the default subnet mask for a class B address (172.16.0.0
) is /16
(which has 16 network bits), moving from /16
to /26
means we are borrowing 10 bits from the host portion to create more subnets.
-
The formula to calculate the number of subnets is:
[ \text{Number of subnets} = 2^n ]
where
n
is the number of bits borrowed from the host portion. In this case,n = 26 - 16 = 10
.
Step 3: Calculate the number of subnets
Now, using the formula, we can calculate the number of subnets:
[ \text{Number of subnets} = 2^{10} = 1024 ]
Conclusion:
With the network 172.16.0.0/26
, you can create 1024 subnets.
- missing lab of subnet
canβt be 2^6 because need to -2
so this should be 2^7 -2
32 -7 = 25
- =/25
ip address 192.168.5.126 255.255.255.128
-
- 1 to set up next lan
do show ip g0/1 - check own ip (as route or gateway) - pc2 β static gateway as bove - pc2 β fastethernet 0 ip 192.168.5.1 - subnet mask |> 255.255.255.128
-
Explain Network Address:
The IP range for 192.168.5.126 with subnet mask 255.255.255.128 gives a network range from 192.168.5.0 to 192.168.5.127 (network address to broadcast address).
Network and Broadcast Information: Network Address: 192.168.5.0 Broadcast Address: 192.168.5.127 This means the usable IP range for devices is 192.168.5.1 to 192.168.5.126.
Lan2
Lan1
int g0/0
ip add 192.168.5.190 255.255.255.192
no stut
do sh ip int g0/0 β result Internet address is 192.168.5.190/26 Broadcast address is 255.255.255.255
set pc1 gateway β .5.190 (last usable) set pc1 fastethernet 0 β .5.129(first usable)
Lan3
-
frist number = last lan(area) broast ip address 191 + 1 β network address
-
broadcast address: all 1111 after borrow β 207
-
submask net = 11110000 β 255.240(all borrow become 1)
en conf t int g0/0 ip add 192.168.5.206 255.255.255.240 no stut this is router
do sh ip int g0/0
pc3
ip add .5.206
fastethrnet .5.l 193
subnet mask 255.255.255.240
Lan4
Point to Point
/30 is safe here
int g0/0/0
Configure stabic routes on each router so that ol PCs can ping eachother
- Lan 3 to Lan 4:
ping 192.168.5.209 from pc1 to pc4