ANDing: (Boolean and)
Computers use digital logic to interpret IP addresses
This logic is called a Boolean AND. It is the comparison of two bits to yield:
1 & 1 = 1
1 & 0 = 0
0 & 1 = 0
0 & 0 = 0
Any # ANDed with 0 is always 0
Any # ANDed with 1 is always the original #
The ANDing of an IP address & mask = network address
A subnet mask “masks” the host bits of an IP address
Routers and hosts use ANDing to determine networks
It is frequently necessary to be able to use ANDing
You will need to know how routers make routing decisions
Start with the IP address & mask above/below each other
10101100.00010000.00010100.00100011 172.16.24.35 (Host)
11111111.11111111.11111111.111 00000 255.255.255.224
——————————————————
10101100.00010000.00010100.00100000 172.16.23.32 (network address for
host /27)
Subnetting:
Divides networks into smaller networks
Uses the subnet mask to divide the network
Provides increased flexibility
Not limited to default class A, B, or C networks
2 parts of an IP address, Network & Host
Actually 3 parts of an IP address
Subnetted addresses include 3 parts:
Network ID or field
Subnet ID or field
Host ID or field
The subnet field and host field are created from the original host portion of the network
Each Class has a “default” subnet mask if nothing is written
A – 255.0.0.0 or /8
B – 255.255.0.0 or /16
C – 255.255.255.0 or /24
If we do not see a subnet, then default masks are used
Same Network or Different Network?
a 24.9.3.142 24.1.1.1
255.0.0.0 255.0.0.0
Same netowrk
b. 153.42.6.12 153.43.6.12
255.255.0.0 255.255.0.0
Different network
c. 180.100.133.15 180.100.199.15
255.255.255.0 255.255.255.0
Different network
128.1.1.129 What Class ?
B
Class B -> default mask -> 255.255.0.0
First 2 octets = network, last 2 = host
Can not use all 0’s or all 1’s in the Host numbers
Host Range -> 128.1.0.1 – 128.1.255.254
Also called the address space
This network has room for 2^16-2 (65,534) hosts
Most networks are much smaller, so many of these addresses will be wasted
Why not break this address space up into smaller more realistic sized networks
In order to subnet, we must steal of “borrow” bits from the host portion of the IP address
128.1.1.129
255.255.255.0 -> borrow 8 bits
10000000.00000001.00000001.1000001 IP
11111111.11111111.11111111 .00000000 SM
——————————————————
128.1.1.0
255.255.255.0
Subnet #1
10000000.00000001.00000001.00000000 -> 128.1.1.0 network
10000000.00000001.00000001.00000001 -> 128.1.1.1 1st host
10000000.00000001.00000001.11111110 -> 128.1.1.254 last host
Subnet #2
128.1.2.0 network
128.1.2.1 1st host
128.1.2.254 last host
What happens if the network bits do not end at an octet?
10000000.00000001.00 000000.00000000 -> #0 128.1.0.0
10000000.00000001.00 000000.00000000 -> #1 128.1.64.0
10000000.00000001.10 000000.00000000 -> #2 128.1.128.0
10000000.00000001.11 000000.00000000 -> #3 128.1.192.0
Subnets do not have to be at octet boundaries
We may borrow any # of bits as long as we leave at least 2 bits remaining for the HOST numbers
…01.00000000.00000000 -> #0 -> 128.1.0.0
…01.00000000.00000100 -> #1 -> 128.1.0.4
…01.00000000.00001000 -> #2 -> 128.1.0.8
…..
…01.11111111.11111000 -> #? -> 128.1.255.248
How many bits should we borrow?
First, we must determine what we need:
How many subnets?
And/Or
How many hosts per subnet?
The #s we use are determined using powers of 2
E.g., say I need 9 subnets from a Class C:
2^3 = 8 subnets -> not enough!
2^4 = 16 subnets
How many hosts do we have in each subnet?
Class C, so 4 bits left: 2^4 = 16 – 2 = 14 usable host addresses in each subnet
Remember: we subtract 2 because one address is the subnet address and one is the broadcast address
We determine the subnet mask by adding up the decimal value of the bits we borrowed.
1 1 1 1 0 0 0 0
128 64 32 16 8 4 2 1
We add up the decimal value of these bits and get 240. That’s the last non-zero octet of our subnet mask
So our subnet mask is 255.255.255.240
Las Non-Zero Octet (LNZO)
Memorize this table for Class C. You should be able to:
Calculate LNZO if given the # of bits borrowed
Calculate the # of bits borrowed given the LNZO
Calculate the # of bits left for hosts and the # of host addresses available
| Bits borrowed | Non-Zero Octet | Hosts |
| 1 | 128 | 126 |
| 2 | 192 | 62 |
| 3 | 224 | 30 |
| 4 | 240 | 14 |
| 5 | 248 | 6 |
| 6 | 252 | 2 |
CIDR:
Classless InterDomain Routing notation is the technical term for slash notation
EG., 192.168.50.0 /24
What does the 24 tell you?
24 is the number of 1 bits in the subnet mask
Therefore, /24 = 255.255.255.0
Example: 192.168.50.0 /27
What does the 27 tell you?
27 is the number of 1 bits in the subnet maks. Therefore, /27 = 255.255.255.224 (8+8+8+3)
Also, you know 192 is a Class C (default /24), so we borrowed 3 bits
202.151.37.0/26
Bits borrowed?
Class C so 2 bits borrowed.
Subnet mask ?
255.255.255.192
2nd subnet address?
202.151.37.64 -> …01000000
Range of hosts and bdxt address?
202.151.37.65, 202.151.37.126 and 202.151.37.127 bdxt
Calculate ALL subnet information?
192.168.50.0/27
Calculate the network # for every subnet!
Class C -> 3 bits borrowed
#0 000 0000 – subnet 192.168.50.0
#1 001 0000 – subnet 192.168.50.32
#2 010 0000 – subnet 192.168.50.64
#3 011 0000 – subnet 192.168.50.96
#4 100 0000 – subnet 192.168.50.128
#5 101 0000 – subnet 192.168.50.160
#6 110 0000 – subnet 192.168.50.192
37 111 0000 – subnet 192.168.50.224
Magic Number?
192.168.50.0/27
Calculate the network # for every subnet!
Class C -> 3 bits borrowed
All subnets are multiples of the magic Number! (multiple of 32)
Magic Number = 256 – LNZO of your subnet mask
/27 = 224
Therefore 256 – 224 = 32
/27 -> 255.255.255.224 (8+8+8+3)
MN = 256 – 224 = 32
So the 2nd subnet address is 192.168.50.32!!
32 will change depending on what the prefix is (see yellow table above)
200.39.89.0/28
Is 200.39.89.32 a network, host or broadcast?
Tags: vlan, ip, wan, cisco, study, switch














Comments:
(0) comments | Add your comments