KEMBAR78
Topic 5 IP Addressing and Subnetting | PDF | Ip Address | Computer Network
0% found this document useful (0 votes)
99 views70 pages

Topic 5 IP Addressing and Subnetting

The document covers IP addressing and subnetting, focusing on IPv4 addressing schemes, classful addressing, and the importance of valid IP addresses. It explains the structure of IP addresses, subnet masks, and the use of private IP addresses in networks, along with concepts like NAT and port forwarding. Additionally, it includes examples and review questions to reinforce understanding of the material.

Uploaded by

heavencraft.site
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views70 pages

Topic 5 IP Addressing and Subnetting

The document covers IP addressing and subnetting, focusing on IPv4 addressing schemes, classful addressing, and the importance of valid IP addresses. It explains the structure of IP addresses, subnet masks, and the use of private IP addresses in networks, along with concepts like NAT and port forwarding. Additionally, it includes examples and review questions to reinforce understanding of the material.

Uploaded by

heavencraft.site
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

IP ADDRESSING &

SUBNETTING

EGE203 – Topic 5
Topic 5 : Learning Outcomes 2

1 2 3

Identify and able to configure Construct network segments Relate to the use of IPv6
valid IP addresses using the using IPv4 Subnet Addressing Addressing
IPv4 Addressing Scheme
(Topic 5B) (Topic 5C)
(Topic 5A)
Topic 5A – IPv4 Addressing 3

Application

Presentation

IPv4 Addressing Session

Fundamentals Transport

Network

Data Link

Physical
Internet Address Schemes
4

• Internet enabled devices e.g. PCs/smartphones/tablets/printers need


both IP and MAC address

• Computers need IP Address e.g. 100.1.2.3


– Hierarchical & organized  similar to postal codes
– To identify different LANs

• Computers have unique MAC Address e.g. 123456789abc


– Non-hierarchical & not organized  similar to NRIC
– To identify specific device within a LAN
– MAC address is embedded on the NIC
Internet Networks
5

• The Internet  Many interconnected LANs


– Schools, Business networks
– Each LAN has unique network address
• Each network is controlled internally
• Use routers to connect different LANs
together
Network B
(Twitter)
Network A 1
(NYP) 6 2 Network C
3
4 (Google)
5
Network D
(Facebook)
IP Address
6

• A number to identify your computer/phone (location) on the


Internet

• No IP No Internet 
What is an IPv4 Address?
7

• Address to identify a device in the network


• IPv4 comprises 32-bits (or 4 octets)
– ** Dotted-decimal notation
Example: 128.3.2.65

128 . 3 . 2 . 65
Dotted-decimal notation
10000000 00000011 00000010 01000001
Binary notation

8 Bits 1 Byte 1 Octet Recap: Why max value is 255?

1 1 1 1 1 1 1 1
[Max value is 255 (because 128+64+32+16+8+4+2+1=255) ] 27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Classful Addressing
8

 5 Classes : A,B, C, D, E
Address 1st Octet 1st Octet Network/Host ID No. of Host per Network
Class Decimal High (N = Network, Networks (Usable
Range Order Bits H=Host) Addresses)

A 1 - 126* 0 N.H.H.H 126 16,777,214


(27 – 2) (224 – 2)
B 128 - 191 10 N.N.H.H 16,382 65,534
(214) (216 – 2)
C 192 - 223 110 N.N.N.H 2,097,150 254
(221) (28 – 2)
D 224 - 239 1110 Reserved for Multicasting
E 240 - 254 11110 Experimental; used for research

* 127 is reserved as the loopback address


Classful Addressing
9
IPv4 Classful Addressing
10

 3 Classes for computers : A, B, C


Address Class 1st Octet Decimal Range Network Address
A 1 - 126* N.
B 128 - 191 N.N.
C 192 - 223 N.N.N.

 Need to know min = 0, max = 255


 Let’s practice
IP Class Network Address
15.1.2.3 A 15.0.0.0
180.4.5.6 B 180.4.0.0
200.70.80.90 C 200.70.80.0
* 127 is reserved
Check Your Understanding
11

IPs Class No. of Network Network Same Are they


Octet Address Network? neighbours?
200.10.20.5 and C 3 200.10.20.0 Yes Yes
200.10.20.6
200.10.20.5 and
201.10.20.6
C 3 200 & 201.10.20.0 No No
150.1.2.3 and
150.1.2.4 B 2 150.1.0.0 Yes Yes
150.1.2.3 and
150.1.3.4
B 2 150.1.0.0 Yes Yes
150.1.2.3 and
151.1.2.4 B 2 150 & 151.1.0.0 No No
10.5.6.7 and
10.5.6.8 A 1 10.0.0.0 Yes Yes
10.5.6.7 and
10.88.99.144 A 1 10.0.0.0 Yes Yes
10.5.6.7 and
A 1 10 & 11.0.0.0 No No
11.5.6.8
Reserved IPs
Network 1: 199.3.4.0 Network 2: 155.66.0.0 12

• Network Address
– Use to identify network  CANNOT assign to any computer
– 1st IP in a network e.g. 199.3.4.0

• Broadcast Address
– Use to inform ALL computers  CANNOT assign to any computer
– LAST IP in a network e.g. 199.3.4.255

• AVOID USING “0” or “255” in IPs


Valid / Invalid IPs
13

 Let’s practice
IP Class Valid Address If no, state the reason
(yes/no)
200.1.3.255 C No Broadcast Address
180.23.255.255 B No Broadcast Address
15.0.0.0 A No Network Address
170.20.0.255 B Yes Not Broadcast or Network Address
25.0.255.0 A Yes Not Broadcast or Network Address
30.255.0.0 A Yes Not Broadcast or Network Address
180.22.255.0 B Yes Not Broadcast or Network Address

* 127 is reserved
Subnet Masks
14

 IP address MUST have a partner  Subnet Mask


 Subnet mask help computer calculate network address from IP

Class Default Subnet Mask No. of 1s


A 255.0.0.0 /8
B 255.255.0.0 /16
C 255.255.255.0 /24

 Another way of writing 255.0.0.0 is /8 (slash notation)


Subnet Masks Example
15

Given an IP address 15.3.6.1, what is its network ID?


1st step : Class A IP  Default subnet mask is 255.0.0.0

2nd step: Network ID = IP address AND Default subnet mask

0000 1111 0000 0011 0000 0110 0000 0001 (15.3.6.1)


AND 1111 1111 0000 0000 0000 0000 0000 0000 (255.0.0.0)
0000 1111 0000 0000 0000 0000 0000 0000 (15.0.0.0 network)
Loopback Address
16

 Reserved 127.0.0.1

 To test itself; check if TCP/IP protocol is ok

 E.g. ping 127.0.0.1


 E.g. ping localhost
Private IP Addresses
17

Class Network ID Blocks of Addresses


A 10.0.0.0 1
B 172.16 – 172.31 16
C 192.168.0 – 192.168.255 256

 CANNOT be routed on the Internet Which network IP is better?


 Not recognised on the Internet R1
 Use in private home/office E1:200.10.20.1
networks
 E.g. used by all PCs inside NYP E0:
192.168.1.254
 Free
 Secure, cannot be accessed from
outside `
LAN B
 Use NAT (Network Address PC1: 192.168.1.1 PC2: 192.168.1.2

Translation) to access Internet LAN A PCX: 200.10.20.2


NAT and Port Forwarding
18

Google web server


1.2.3.4 Web Server1
 Internet 
192.168.1.2
Routers’s External Routers’s Internal
To: 1.2.3.4 (Google)
Public IP Private IP
204.5.5.5
From: 204.5.5.5:9999
192.168.1.1(NAT) 192.168.1.3
To: 204.5.5.5:80
88.1.1.1 NAT:
(WebServer1) To: 1.2.3.4 (Google)
192.168.1.3:9999 
From: 88.1.1.1 PC1
204.5.5.5:9999 From: 192.168.1.3:9999

• Network Address Translation change Private IPs to Public IP


– For a office network with 1000 PCs using private IPs, how many public
IPs will be needed?

• Port Forwarding
– Let Internet computer access specific computer in private LAN
• E.g. forward port 80 on router to send to Web Server1
Port Forwarding:
204.5.5.5:80  192.168.1.2:80
IP Addressing Example 1
19

• Any problem with the IP address?


• Any other IP address needed?

E0

R1

PC1: 200.8.8.88 PC2: 10.2.3.999

LAN A
IP Addressing Example 2
20

S0
S1
R2

S0
S1

E0:200.10.20.1
S0
S1
R1 R3
E0:
192.168.1.254

`
LAN B
PC1: 192.168.1.1 PC2: 192.168.1.2
(Japan)
LAN A (Singapore) PCX: 200.10.20.2

• How many networks are there? LANs = ___


2 , WANs= ___
3
• Give an IP for R1’s S0 interface (public
______ or private IP will be better?)
• What is the difference between E0, S0 and S1 interfaces LAN vs WAN
IP Addressing Example 3
21

• Give suitable IPs with subnet mask using slash notation for the network
• Write the subnet mask in slash notation To ISP to Internet

S0: _______________
11.11.11.1/8

E1:____________
Sales LAN
192.168.101.1/24
R1
E0:192.168.100.1/24
____________

`
192.168.100.10/24
HR1: ___________
HR2:192.168.100.11/24
____________ 192.168.101.10/24
Sales1: ______________ `

HR LAN 192.168.101.11/24
Sales2: ______________
Review Questions
22

1. The loopback address is used to send a packet from the


________ to ________.

a) Host; a specific host


b) Host; all other hosts
c)______________
Host; itself
d) Router; all other hosts

2. Which of the following is true of the IP address 192.168.1.10?

a) The network address is 192


b) The host address is 0.10 Class Range
c) The network address is 192.168.1.0
________________________________ A 1 - 126
d) The host address is 0.0.10
B 128 - 191

C 192 - 223
Review Questions
23

3. A device has 2 IP address. This device could be a _______.

a) A computer
b) A router
____________
c) A hub
d) A& B

4. What destination address is used to send a packet from a host


(188.1.1.1) to all hosts?

a) 0.0.0.0 Class Range


b) 188.0.0.0 A 1 - 126
c) 188.1.1.1
d)____________
188.1.255.255 B 128 - 191
C 192 - 223
Review Questions
24

5. What is the subnet mask given 200.5.23.5/24?

a) 255.0.0.0
b) 255.255.0.0
c) 255.255.255.0
_________________
d) 255.255.255.255

6. Which of the following is a useable IP?

a) 10.0.0.0
b) 150.45.0.0 Class Range
c) 200.2.3.255 A 1 - 126
d) ____________
150.0.255.0 B 128 - 191
C 192 - 223
Review Questions
25

9. Which of the following IP is recognized on the Internet?

a) 10.5.6.88
b) 172.16.139.26
c) 192.168.6.55 Class Range
d)____________
200.3.7.9 A 1 - 126
B 128 - 191
C 192 - 223
Topic 5A – IPv4 Addressing 26

Application

Presentation

IPv4 Addressing Session

Fundamentals Transport

(Revision) Network

Data Link

Physical
What is an IPv4 Address?
27

• Address to identify a device in the network


• IPv4 comprises 32-bits (or 4 octets)
– ** Dotted-decimal notation
Example: 128.3.2.65

128 . 3 . 2 . 65
Dotted-decimal notation
10000000 00000011 00000010 01000001
Binary notation

8 Bits 1 Byte 1 Octet

[Max value is 255 (because 128+64+32+16+8+4+2+1=255) ]


General rule for IPv4 Addressing #1 - Classful Addressing
Class Range Default Subnet Mask 28
A 1 - 126 255.0.0.0
• #2 – Public vs Private Addressing
B 128 - 191 255.255.0.0
– Public IP (publicly routed, 3 main classes as shown in table) C 192 - 223 255.255.255.0
– Private IP (not routed over internet; for internal network purposes)
A • 10.0.0.0 to 10.255.255.255 Num of network =
0000 0000 - 0
.
. 2^7 = 128, 2^7-2 =126

B • 172.16.0.0 to 172.31.255.255
0111 1111 - 127

C • 192.168.0.0 to 192.168.255.255

• #3 - Exception to the rule:


– 0.0.0.0/8 is reserved
– 127.0.0.0/8 is reserved for loopback testing
– Class D: 224.0.0.0 to 239.255.255.255 is reserved for IP multicast
– Class E: 240.0.0.0 to 255.255.255.255 is reserved for future use
Subnet Mask
29

• Break network to smaller network segments


• A host can send traffic to another host on the same subnet using switches
• A host to send traffic to another host on a different subnet will go through a router
• Example: 192.168.10.15 / 255.255.255.0
Network Portion Host Portion

• The contiguous “1”s in the subnet mask signify the network portion. The contiguous “0”s in the
subnet mask signify the host portion.
• First address in the network reserved for network, Last address in the network reserved for
broadcast
Topic 5B - IPv4 Subnet Addressing 30

IPv4 Subnet
Addressing
Network and Hosts
31

• You have a LAN network at home aka Home Wifi


• You can find many hosts in a LAN e.g.
– PCs, tablets, smartphones, printers, TV, game consoles, CCTV, smart aircon,
smart LED lighting, smart switches, smart lock

Router

Switch/Hub
(optional)

Hosts
Network vs Hosts
32

Class A: 27 = 126 networks; 224 > 16 million hosts

N H H H
8 bits 24 bits

Class B : 16
214 = 16,384 networks; 2 – 2 = 65,534 hosts

N N H H
16 bits

Class C : 221 > 2 million networks; 28 – 2 = 254 hosts

N N N H
8 bits
Problem with Classful Addressing
33

 Difficult to manage a single Class A or B network


 Class A & B networks have too many network hosts
 Class A : 16 million hosts, Class B : 65k hosts
 Class C max 254 hosts, still too many for small/medium organizations

HR2 PC Sales1 PC
HR1 PC 141.14.1.3 141.14.1.4 Sales2 PC
141.14.1.2 141.14.1.5

Finance PC2
141.14.1.9 Finance PC1 Marketing2 PC Marketing1 PC
141.14.1.8 141.14.1.7 141.14.1.6

Class B Network : Different department PCs all in 1 single network


Why Subnet?
34

• Subnetting divides a LAN into smaller groups aka subnets


– Create smaller broadcast domains, improve network performance
– Same as a town e.g. Ang Mo Kio which is broken into smaller avenues; easier to
manage
• Subnets are all EQUAL size
– Same subnet mask is used for all subnets
Subnet #0 Subnet #1
- HR dept - Sales dept
 In the earlier example, better to
divide Class B network into 4 groups Subnet #2 Subnet #3
 HR, Sales, Marketing, Finance - Finance -Marketing
 Easier to manage 4 subnets than 1 single dept dept
BIG network

All 4 subnets are all EQUAL size


Why Subnet? To ISP to Internet
35
S0

R1

Is this a good
` Fa0/0: 192.168.1.254

Sales1: 192.168.1.3
network design?
`

Sales1: 192.168.1.4
Type text here
HR1: 192.168.1.1 HR2: 192.168.1.2

HR and Sales LAN


 Poor security! Both HR and Sales are in the same broadcast domain
 HR PCs can pick up broadcasts by Sales PCs and vice versa
 Better to create smaller broadcast domains  Separate HR and Sales
Subnetting
36
To ISP to Internet

S0

Better design?
R1
Fa0/1:192.168.1.129
Sales LAN
Fa0/0:
192.168.1.1

HR1: 192.168.1.2 `

HR2: 192.168.1.3 Sales1: 192.168.1.130 `

HR LAN Sales1: 192.168.1.131

 More security HR network is separated from Sales


 Externally , only 1 network address (192.168.1.0)
 Internally, there are 2 smaller networks (2 subnets)
How to Subnet? – 4 Steps
37

• To subnet a given network address, ask yourself

1. How many host bits do I need to borrow?


2. What’s the new subnet mask?
3. What’s the “magic number”?
4. List subnetwork addresses

• Let’s look at each of these questions in detail


Step 1 – How many host bits to borrow?
38

• If you know no. of subnets needed, then use

2BB = no. of subnets created

where BB=host bits borrowed

OR
• If you know no. of hosts in each subnet, then use

2HB - 2 = Max. number of hosts

where HB=Host bits needed

BB = Total Host Bits - HB


Class C Subnet Example 21=2
39
22=4
23=8
24=16
• Given Class C network 192.168.1.0 25=32
• Design goal: I want 3 subnets 26=64
27=128
28=256
• Step 1: How many host bits to borrow?
– What power of 2 will give 3 subnets?

22 = 4 subnets > 3 subnets required


where 2=bits borrowed

We borrow 2 bits to create 4 subnets


Class C Subnet Example N N N H 40

• How many bits are left for hosts? 8 - 2 = 6


6
Class C 8 host bits
– Max no. of hosts = 2 - 2 = 64 – 2 = 62 hosts for each subnet

• We will created 4 EQUAL SIZE subnets


– 3 to use, 1 will be “wasted”
• Each subnet has max 62 hosts.

• Without subnets, there are 254 hosts in 1 single network


• With subnets using 2 bits, we have cut this network into 4 subnets with max
62 hosts in each subnet
– More manageable and secure with smaller networks
Step 2 – What is the Subnet Mask?
41

• The subnet mask will change because of subnetting


N N N H

– Default subnet mask for Class C = 255.255.255.0


– We borrowed 2 bits 2 host bits set to 1

1 1
128 64 32 16 8 4 2 1

We add up the decimal value of these borrowed bits and get 192.

So our new subnet mask is 255.255.255.192


Subnet Masks Template
42

128 64 32 16 8 4 2 1

1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
Step 3 – What is the “Magic Number”?
43

• Magic number = Size of subnet

Magic number = 256 – Subnet mask last non-zero octet

• In our Class C example, our subnet mask was


255.255.255.192  192 is our last non-zero
octet.
• Our magic number is 256 - 192 = 64
Step 4 – List the Subnets
44

• Our Class C address is 192.168.1.0


• Magic number 64 is subnet size; keep adding 64 to get next subnet

Subnet # Subnet Address Subnet Valid IP Broadcast


(First IP) Range Address (Last IP)
0 192.168.1.0 192.168.1.1 - 192.168.1.63
+64 192.168.1.62
1 192.168.1.64 192.168.1.65- 192.168.1.127
+64 192.168.1.126
2 192.168.1.128 192.168.1.129 - 192.168.1.191
+64 192.168.1.190

3 192.168.1.192 192.168.1.193 - 192.168.1.255


192.168.1.254
Class C Subnet Questions
45

• Are IPs 192.168.1.60 and 192.168.1.61 in the same network?


• Are IPs 192.168.1.62 and 192.168.1.65 in the same network?
• Can a PC use IP = 192.168.1.128?
• Can a PC use IP = 192.168.1.191?
• A sample Class C subnet topology:

Fa0/1:192.168.1.65 Sales LAN (Subnet #1)


R1
Fa0/0:
192.168.1.62 192.168.1.64 /26

HR1: 192.168.1.60 `

HR2: 192.168.1.61 Sales1: 192.168.1.66 `


HR LAN(Subnet #0)
Sales1: 192.168.1.67
192.168.1.0/26
Check Your Understanding
46

• How many host bits to borrow given the no. of subnets?

No. of subnets needed No. of host bits to borrow


2 1 21 = 2
3 2 22 = 4
5 3 23 = 8
8 3 23 = 8
10 4 24 = 16

2BB = no. of subnets created

where BB=host bits borrowed


Recap: Subnetting  Why subnet? 47
 Improve Network Performance
 Boost Network Security
 Ease Management (smaller networks)

 Quick steps for subnet


21=2  Step 1: Determine # of Host Bits to borrow
22=4
23=8
 Step 2: Calculate new subnet mask
24=16  Step 3: Calculate magic number
25=32  Step 4: Enumerate the network
26=64
27=128 Example:
28=256 Step 1: 22 can cover 4 subnets. 2 host bits to borrow
141.14.0.0 split to 4 sub-networks
S0: 10001101 00001110 00000000 00000000 Step 2: 11000000 = 192 => New Subnet Mask = 255.255.192.0
S1: 10001101 00001110 01000000 00000000
Step 3: Magic number = 256-192 = 64
S2: 10001101 00001110 10000000 00000000
S3: 10001101 00001110 11000000 00000000 Step 4: Enumerate the subnets
Subnet #0: 141.14.0.0 Subnet#1: 141.14.64.0
Subnet #2: 141.14.128.0 Subnet#3: 141.14.192.0
Class B Subnet Example 21=2
22=4 48
23=8
24=16
• Given Class B network 172.30.0.0
25=32
• Design goal: I want 200 subnets 26=64
27=128
– Step 1: How many host bits to borrow? 28=256

• Step 1: How many host bits to borrow?


– What power of 2 will give 200 subnets?

28 = 256 subnets > 200 subnets required


where 8=bits borrowed

We borrow 8 bits to create 200 subnets


Class B Subnet Example N N H H
49

• How many bits are left for hosts? 16 - 8 = 8


8
Class B 16 host bits
– Max no. of hosts = 2 - 2 = 256 – 2 = 254 hosts for each subnet

• We will created 256 EQUAL SIZE subnets


– 200 to use, 56 will be “wasted”
• Each subnet has max 254 hosts.

• Without subnet, there are 65k hosts in 1 single network


• With subnet using 8 bits, we have cut this big network into 256 subnets with max
256 hosts in each subnet
– Easier to manage smaller networks with 254 hosts than 1 network with 65k hosts
Step 2: What is the Subnet Mask?
50

• The subnet mask will change because of subnetting

N N H H

– Default subnet mask for Class B = 255.255.0.0


– We borrowed 8 bits 8 host bits set to 1

__
1
128
__
1
64
__
1
32
__
1
16
1__
8
__
4
1 __
2
1 __
1
1
. __ __ __ __
128 64 32 16
__ __ __ __
8 4 2 1

We add up the decimal value of these borrowed bits and get 255.0.

So our new subnet mask is 255.255.255.0


Step 3 – What is the “Magic Number”?
51

• Magic number = Size of subnet

Magic number = 256 – Subnet mask last non-zero octet

• In our Class B example, our subnet mask was


255.255.255.0  255 is our last non-zero octet.
• Our magic number is 256 - 255 = 1
Step 4 – List the Subnets
52

• Our Class B address is 172.30.0.0


• Magic number 1 is subnet size; keep adding 1 to get next subnet
• We keep adding 63 to get all 4 subnets addresses

Subnet # Subnet Address Subnet Valid IP Broadcast


(First IP) Range Address (Last IP)
0 172.30.0.0 172.30.0.1 - 172.30.0.255
+ 172.30.0.254
1
1 172.30.1.0 172.30.1.1 - 172.30.1.255
+ 172.30.1.254
1
2 172.30.2.0 172.30.2.1 - 172.30.2.255
+ 172.30.2.254
1
3 172.30.3.0 172.30.3.1 - 172.30.3.255
172.30.3.254
Class B Subnet Sample Topology 53

IT LAN (Subnet #3)


#2)

 1 External Network: 172.30.0.0 172.30.2.0 /24


` IT1 IP: 172.30.2.2
 Internally, have many subnets SM: 255.255.255.0
Gateway: 172.30.2.1

IT2 IP: 172.30.2.3


` SM: 255.255.255.0
Fa0/2:172.30.2.1/24 Gateway: 172.30.2.1

Fa0/1:172.30.1.1/24 Finance LAN (Subnet #1)


R1

Mkg1 IP: 172.30.0.2


Fa0/0:
172.30.0.1/24 172.30.1.0 /24
SM: 255.255.255.0
Gateway: 172.30.0.1
Fin2 IP: 172.30.1.3
` SM: 255.255.255.0
Mkg2 IP: 172.30.0.3 Gateway: 172.30.1.1
SM: 255.255.255.0 `
Sales1 IP: 172.30.1.2
Gateway: 172.30.0.1
SM: 255.255.255.0
Marketing LAN(Subnet #0) Gateway: 172.30.1.1

172.30.0.0/24
VLSM (Not Tested) – under EG2709 [For Info]
54

 Note: In real-world scenario,


requirement varies, # of hosts differs
 Example:
 HR department : 28 PCs
 IT department: 28 PCs
 Sales department : 14 PCs
 Marketing: 7 PCs

 You can have Variable Length Subnet


Masking (VLSM) starting with the
largest subnets
 Example:
 HR department : 200.20.25.0/27
 IT department: 200.20.25.32/27
 Sales department : 200.20.25.64/28
 Marketing: 200.20.25.80/28
 Point to Point: 200.20.25.96/31
Use of Subnet Zero and Last Subnet 55

• Long time ago, 1st and last subnet could not be used. Now no such restriction
• Subnet zero  All zeros in the subnet
• Last Subnet  All 1s in the subnet
• Some network designers are concerned having a mix of very old equipment and
new network devices such that they would avoid using all zeros or all ones in the
subnet field
• RFC 1878 in 1995 stated, "This practice (of excluding all-zeros and all-ones
subnets) is obsolete. Modern software will be able to utilize all definable networks."
Today, the use of subnet zero and the all-ones subnet is generally accepted and
most vendors support their use. However, on certain networks, particularly the ones
using legacy software, the use of subnet zero and the all-ones subnet can lead to
problems.

• Cisco note: Though discouraged, subnet zero and the all-ones subnet have always
been usable. Use of the all-ones subnet and subnet zero is explicitly allowed since
Cisco IOS v12. Before that, need to activate using “ip subnet-zero” command.
Example: 140.50.0.0/24 56

• This is a Class B IP address but the subnet mask ≠ /16


– Must be a subnet
• Step 1: No. of host bits borrowed = 24 – 16 = 8
• Step 2: New subnet mask = 255.255.255.0
• Step 3: Magic No. = 256 - 255 = 1 Bits Non-zero
Borrowed Octet
• Step 4: List the Subnets
1 128
Subnet No. Subnet Address 2 192
3 224
0 140.50.0.0
4 240
1 140.50.1.0 5 248
2 140.50.2.0 6 252
7 254
• No. of subnets = 28 = 256 8 255
Example: 202.151.37.0/25 57

• This is a Class C IP address but the subnet mask ≠ /24


– Must be a subnet
• Step 1: No. of host bits borrowed = 25 – 24 = 1
• Step 2: New subnet mask = 255.255.255.128
• Step 3: Magic No. = 256 - 128 = 128 Bits Non-zero
• Step 4: List the Subnets Borrowed Octet
1 128
Subnet No. Subnet Address
2 192
3 224
0 202.151.37.0
4 240
1 202.151.37.128 5 248
6 252
• No. of subnets = 21 = 2
7 254
8 255
Example: 198.53.67.0/26 58

• This is a Class C IP address but the subnet mask ≠ /24


– Must be a subnet
• Step 1: No. of host bits borrowed = 26 – 24 = 2
• Step 2: New subnet mask = 255.255.255.192
• Step 3: Magic No. = 256 - 192 = 64
• Step 4: List the Subnets Bits Non-zero
Borrowed Octet
Subnet No. Subnet Address
1 128
0 198.53.67.0 2 192
1 198.53.67.64 3 224
4 240
2 198.53.67.128
5 248
3 198.53.67.192 6 252
• No. of subnets = 22 = 4 7 254
8 255
Example: 194.53.45.26/29 59
Bits Non-zero
• What type of IP is this? [host/subnet/broadcast IP] Borrowed Octet
• This is a Class C IP address but the subnet mask ≠ /24 1 128
– Must be a subnet 2 192
• Step 1: No. of host bits borrowed = 29 – 24 = 5 3 224

• Step 2: New subnet mask = 255.255.255.248 4 240


5 248
• Step 3: Magic No. = 256 - 248 = 8
6 252
• Step 4: List the Subnets
7 254
Subnet No. Subnet Address Subnet Valid IP Range Broadcast Address 8 255
0 194.53.45.0 194.53.45.1 - .6 194.53.45.7
1 194.53.45.8 194.53.45.9 - .14 194.53.45.15
2 194.53.45.16 194.53.45.17 - .22 194.53.45.23
3 194.53.45.24 194.53.45.23 - .30 194.53.45.31
– 194.53.45.26 is a host IP from Subnet 3
Class Range Convention Default Subnet Mask Slash CIDR Notation

Recap: Subnet A
B
1 - 126
128 - 191
N.H.H.H
N.N.H.H
255.0.0.0
255.255.0.0
/8
/16
C 192 - 223 N.N.N.H 255.255.255.0 /24
Valid IP Addressing (with Subnets)
Class IP Address New Subnet Which Subnet? Network Broadcast Range of Valid Host IP
Anything not the 1st
(CIDR Notation) Mask Address Address Addresses nor the last IP is
C 192.168.5.30 / 25 255.255.255.128 Subnet #0 192.168.5.0 192.168.5.127 192.168.5.1 – 192.168.5.126 usable for host
B 172.18.65.40 / 19 255.255.224.0 Subnet #2 172.18.64.0 172.18.95.255 172.18.64.1 – 172.18.95.254

• Step 1 – Host bits borrowed = 25-24 = 1 (=> it also means 21 subnets will be created)
• Step 2 – New subnet mask (4th octet become 10000000 = 128) => 255.255.255.128
• Step 3 – Magic Number = 256 – 128 = 128
• Step 4 – List the subnets Use this to derive broadcast IP – last IP of previous
Add Magic Number
subnet is the broadcast address
• Subnet #0 - 192.168.5.0
• Subnet #1 – 192.168.5.128
• Step 1 – Host bits borrowed = 19 – 16 = 3 (Borrow 3 bits from the Host Portion 255.255.0.0 )
• Step 2 – New subnet mask (3rd octet become 11100000 = 224) => 255.255.224.0
• Step 3 – Magic Number = 256 – 224 = 32
• Step 4 – List the subnets Add Magic Number
• Subnet #0 - 172.18.0.0
• Subnet #1 – 172.18.32.0
• Subnet #2 – 172.18.64.0 ……..
Router Type Network Next Hop

Subnet with Routing Company C 172.30.0.0/24 NA


61
C 172.30.1.0/24 NA
C 172.30.2.0/24 NA
 Take previous example C 1.0.0.0/8 NA

 Internally, have 3 subnets or more S 0.0.0.0/0 1.0.0.2


 Marketing 172.30.0.0/24, Finance 172.30.1.0/24, IT 172.30.2.0/24
 Externally, only 1 Network:172.30.0.0/22 (instead of 3) [Summary Route]

Router Type Network Next Hop


ISP C 1.0.0.0/8 NA
C 2.0.0.0/8 NA
S 192.168.1.0/24 2.0.0.2
S 172.30.0.0/22 1.0.0.1

Router Type Network Next Hop


Home C 2.0.0.0/8 NA
C 192.168.1.0/24 NA
S 0.0.0.0/0 2.0.0.1
The Key!! 62

• MEMORIZE THIS TABLE!!!

Bits Borrowed Non-zero Octet


1 128
2 192
3 224
4 240
5 248
6 252
7 254
8 255
IP Addressing & Subnetting 63

~~ IPv6 Address Overview~~


Some History 64

IPv4, 1973  now  to be zero soon!!! IPv6, 1998  now  future


Create 4.3 billions IPs using 32 bits Unlimited, using 128 bits

• But IPv4 will still be around for a long time…

• As of Jan 2015, IPv6 traffic share reported reaching 4.77%. Check out statistics
on Google
Problem with IPv4 65

• 32-bits gives 232 unique numbers

• 232 = 4,294,967,296
– there are over 4 billion possible IPv4 addresses
– but many are “wasted” due to the allocation scheme
IP Address Shortage 66

• In the early days of the Internet, IP addresses were allocated to organizations based
on request rather than actual need
• When will IPv4 run out?: check out exhaustion Counter
• Rate of IPv6 adoption? IPv6 connectivity
– Belgium (30%)
– America (14%)
– Germany (13%)
– Asia
– Japan (6%)
– Malaysia (5.9%) U.S.: 14%
China: 1.44%
– Singapore (2.7%) Japan: 6%

– Taiwan (0.6%) Malaysia: 5.9%


Singapore: 2.7%
– South Korea (0.36%)
IPv6 : The Next Generation 67

IP version 6 (IPng) has 128-bits, giving 2128 unique combinations

340 undecilllion 4.3 billion

Example of IPv4: 192.168.25.88


Example of IPv6: 2001:0db8:85a3:0042:0000:8a2e:0370:7334

Each of the delimited entry is a 16-bits binary


e.g. FFFF = 1111 1111 1111 1111
IPv4 vs IPv6 68

• IPv4’s 32 bits continues to be the dominant form of IP addressing

• IPv6 is slowly being integrated in the existing Internet


– World IPv6 Launch on June 6, 2012, marks the start of a coordinated rollout by
major websites and Internet service and equipment providers
• As of Jan 2015, global IPv6 adoption was only 4.77% [IPv6 video]
• Facebook now has 27 million IPv6 users
• 5% of Google users are on IPV6
RIR 69

• The Regional Internet Registries (RIRs) are responsible, within their assigned
regions, for allocating globally unique IP addresses (IPv4 and IPv6) and
autonomous system numbers
• The world is divided into five RIRs:
– AfriNIC for Africa
– ARIN for America, Canada, parts of the Caribbean & Antarctica.
– APNIC for Asia, Australia, New Zealand
– LACNIC for Latin America and parts of the Caribbean region
– RIPE NCC for Europe, Russia, the Middle East, and Central Asia
70

You might also like