Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 54

Computer Network

Chapter 06
Network Layer
(Part II)

1
Prepared by: Yee Jian Chew
Network Layer Technologies

NAT

2
Prepared by: Yee Jian Chew
NAT (Network Address Translation)

• A.k.a IP Masquerading
• IP address space (with many private IP
addresses) hidden under a single public IP
Address

3
NAT: network address translation

https://wikieducator.org/Aoraki_Digital_Technologies/Level_2/DT_2.50_AS91377/More_Advanced_Networking/Network_Address_Translation

6
NAT: network address translation

https://wikieducator.org/Aoraki_Digital_Technologies/Level_2/DT_2.50_AS91377/More_Advanced_Networking/Network_Address_Translation

7
NAT: network address translation

https://wikieducator.org/Aoraki_Digital_Technologies/Level_2/DT_2.50_AS91377/More_Advanced_Networking/Network_Address_Translation

8
NAT Motivation / Advantages
motivation: local network uses just one IP address
as far as outside world is concerned:
 range of addresses not needed from ISP: just one IP
address for all devices
 Made to save public IPv4 Addresses (2^32 = 4.3 Billion addresses)
 Partial solution for the IPv4 address space exhaustion problem
• Enhanced Security
 devices inside local net not explicitly addressable, visible by
outside world (a security plus)
 can change addresses of devices in local network without
notifying outside world
 can change ISP without changing addresses of devices in
local network 9
Public vs Private IP Address

17
Prepared by: Yee Jian Chew
Public vs Private IP address

Private IP Address is Source: https://ipwithease.com/public-ip-vs-private-ip/

also known as
Non-Routable
IP address in the
internet. 18
Classful IP Address
• In classful addressing, the address space is divided into five
classes: A, B, C, D, and E.
• IP addresses can be split into two sections:
• Network ID
• Used to identify network
• At the internet level, core routers only care about the network ID, use
network ID to sent to the appropriate gateway router
• Host ID
• Used to identify individual host/device
• E.g., University owns IP 11.0.0.0 ~ 11.255.255.255
• E.g., A device IP address = 11.3.2.2
• Network ID = 11 (first octet, 8 bit)
• Host ID = 3.2.2 (last three octet, 24bit)
• An example of class A address 19
Classful IP Address
• Destination IP = 11.3.2.2 (class A)
• Network ID = 11
• By looking at Network ID, Sender router will route to university router (gateway) via internet
(many core router)
• Host ID = 3.2.2
• By looking at Host ID, University router (gateway) will sent to the receiving host
• Gateway Router
• Serves as an entry or exit path to a certain network
Network
Many core routers 11.0.0.0~11.255.255.255
trying to reach
university router
network (11.0.0.0)

20
IPv4 Classful Address

multicast
Unassigned
(testing purpose)

Source: https://slideplayer.com/slide/12233447/ 21
Classful

In Practical,
 Classful is obsolete, has been replaced
by CIDR (Classless Interdomain Routing)
 large part of the addresses were wasted.
 But, address class system is still in place
in many ways, important to understand

Source: https://slideplayer.com/slide/12233447/ 22
Classful vs Classless

Classful Classless
• Only pass the network • Pass both network
address, e.g., address and subnet
192.168.1.1 mask, e.g.,
• In classful addressing, 192.168.1.1,
the address space is 255.255.255.0
divided into five classes:
A, B, C, D, and E.
23
Subnet and Subnetting

24
Prepared by: Yee Jian Chew
Subnetting
• Process of taking a large network and splitting it
up into many individual smaller subnetworks
(or subnets)
• Incorrect subnetting setups are a common problem
you might run into as an IT Support specialist,
• it’s important to have a strong understanding of how
subnetting works
• Subnetting is done by changing the default subnet
mask by borrowing some of the bits from the
host portion
25
Subnetting (Given network 11.0.0.0)
Classful Classless (subnetting)
• Entire IP address range
(11.0.0.0 ~ 11.255.255.255) is
belong to the same network
• 16.7 Million IP address in a
single network

• If the IP address is not used, it


will be wasted

Network 11.0.0.0~11.255.255.255

26
Subnetting (Given network 11.0.0.0)
Classful Classless (subnetting)
• Entire IP address range • Divide large network into smaller
(11.0.0.0 ~ 11.255.255.255) is Entire University Network: 11.0.0.0/8
belong to the same network Subnet Mask = 255.0.0.0
IP Range = 11.0.0.0 ~ 11.255.255.255
• 16.7 Million IP address in a
Network 1 : 11.0.0.0/10 Network 2 : 11.64.0.0/10
single network Subnet Mask = 255.192.0.0 Subnet Mask = 255.192.0.0
IP Range = 11.0.0.0~11.63.255.255 IP Range = 11.64.0.0~11.127.255.255
• If the IP address is not used, it
will be wasted

Network 11.0.0.0~11.255.255.255

Network 3 : 11.128.0.0/10 Network 4 : 11.192.0.0/10


Subnet Mask = 255.192.0.0 Subnet Mask = 255.192.0.0
IP Range = IP Range =
11.128.0.0~11.191.255.255 11.192.0.0~11.255.255.255
27
Subnetting (Given network 11.0.0.0)
Classful (without subnet) Classless (subnetting)
• 32 bit IP address, • Some bits in the “HOST
• Fixed (certain) ID” is used for Subnet ID
bits used for • Contain:
• Network ID • Network ID
• Host ID • Subnet ID
• Calculated via Subnet Mask
• Host ID
Subnet Masks
• 32-bit number that are normally written
out as four octets in decimal
• Easiest way to understand subnet mask is
to compare subnet masks to IP address

29
Subnet Mask - Explained

https://www.youtube.com/watch?v=s_Ntt6eTn94 30
CIDR (Classless Inter Domain Routing)
• Method to efficiently allocate IP addresses and
• enable IP routing
• Introduced by IETF (Internet Engineering Task
Force) in 1993
• Replaces former Classful IP addressing used in the
Internet
• Class A, B, C based subnet sizes were too large
• Many unused (wasted) IP addresses
• Makes the Internet more scalable, because
• networks can be assigned proper subnet sizes
35
CIDR (Classless Inter Domain Routing)
• CIDR is based on a concept called subnetting.
Subnetting allows you to take a class, or block
of IP addresses and further chop it up into
smaller blocks, or groups of IPs.
• CIDR and subnetting are virtually the same
thing. (both terms really refer to the same
concept.)
• Subnetting – used at organization level
• CIDR – generally used at the ISP level or
higher. Reference: https://www.itgeared.com/articles/1347-cidr-and-subnetting-tutorial/
36
IP addressing: CIDR / Subnetting
CIDR: Classless InterDomain Routing
• subnet portion of address of arbitrary length
• address format: a.b.c.d/x, where x is # bits in
subnet portion of address
192.168.1.0 / 24
Network host

IP:11000000 10101000 00000001 00000000

40
IP addressing: CIDR / Subnetting
192.168.1.0 / 24
WHAT DOES THIS REALLY MEAN??
Network host

IP:11000000 10101000 00000001 00000000


SubnetMask: 11111111 11111111 11111111 00000000

Network 192.168.1.0/24
Subnet Mask = 255.255.255.0
Network Address = 192.168.1.0
Before Subnetting Host IP = 192.168.1.1 ~ 192.168.1.254
Broadcast IP = 192.168.1.255

41
Before Subnetting
• IP = 192.168.1.0/24 Number of IP address

• Subnet Mask = 255.255.255.0 available = 256 (2^8)


(192.168.1.0~255)

42
Before Subnetting
• IP = 192.168.1.0/24 Number of Host IP
address = 254
• Subnet Mask = 255.255.255.0 (192.168.1.1~254

43
Before Subnetting
• IP = 192.168.1.0 / 24
• Subnet Mask = 255.255.255.0

Has 24 “1 bit” in subnet mask, short form /24

NETWORK ADDRESS
Number of available host address
BROADCAST ADDRESS

2^8 (host id) = 256 IP address OR [192.168.1.0 ~ 192.168.1.255]


2^8 - 2 = 254 IP address OR [192.168.1.1 ~ 192.168.1.254]

1 Network with 256 IP (254 Host IP) 44


After Subnetting (change subnet mask)

• IP = 192.168.1.0 / 26
• Subnet Mask = 255.255.255.192

4 Network with 64 IP (62 Host IP) 46


After Subnetting (change subnet mask)

• IP = 192.168.1.64 / 26
• Subnet Mask = 255.255.255.192

4 Network with 64 IP (62 Host IP) 47


After Subnetting (change subnet mask)

• IP = 192.168.1.128 / 26
• Subnet Mask = 255.255.255.192

4 Network with 64 IP (62 Host IP) 48


After Subnetting (change subnet mask)

• IP = 192.168.1.192 / 26
• Subnet Mask = 255.255.255.192

4 Network with 64 IP (62 Host IP) 49


After Subnetting (change subnet mask)

Source: https://www.youtube.com/watch?v=s_Ntt6eTn94

50
After Subnetting (change subnet mask)
Network 192.168.1.0/24
Subnet Mask = 255.255.255.0
Network Address = 192.168.1.0
Host IP = 192.168.1.0 ~ 192.168.1.254
Broadcast IP = 192.168.1.255

HOW?

Requirement:
3 Network

51
After Subnetting (change subnet mask)

Source: https://www.youtube.com/watch?v=s_Ntt6eTn94

52
IP addressing: CIDR / Subnetting
Given the ip address above, subnet the network with the following condition.
(i) Number of IP address required per subnet = 64

• To get 64 IP address per subnet,


• Retain at least 6 bit for HOST ID
• 2^6 = 64 IP address
Network host

53
IP addressing: CIDR / Subnetting
Given the ip address above, subnet the network with the following condition.
(i) Number of IP address required per subnet = 64

• To get 64 IP address per subnet,


• Retain at least 6 bit for HOST ID
• 2^6 = 64 IP address
Network host

Network host

Has 26 “1 bit” in subnet mask, short form /26

54
IP addressing: CIDR / Subnetting
Given the ip address above, subnet the network with the following condition.
(i) Number of IP address required per subnet = 64

• Network 1: 192.168.1.0/26
• Network Address = 192.168.1.0
• Host IP = 192.168.1.1 ~ 192.168.1.62
• Broadcast IP = 192.168.1.63
• Number of available IP address = 64 (2^6)
• Number of host IP address = 62 (2^6 – 2)

Has 26 “1 bit” in subnet mask, short form /26

55
IP addressing: CIDR / Subnetting
Given the ip address above, subnet the network with the following condition.
(i) Number of IP address required per subnet = 64

• Network 2: 192.168.1.64/26
• Network Address = 192.168.1.64
• Host IP = 192.168.1.65 ~ 192.168.1.126
• Broadcast IP = 192.168.1.127
• Number of available IP address = 64 (2^6)
• Number of host IP address = 62 (2^6 – 2)

56
IP addressing: CIDR / Subnetting
Given the ip address above, subnet the network with the following condition.
(i) Number of IP address required per subnet = 64

• Network 3: 192.168.1.128/26
• Network Address = 192.168.1.128
• Host IP = 192.168.1.128 ~ 192.168.1.190
• Broadcast IP = 192.168.1.191
• Number of available IP address = 64 (2^6)
• Number of host IP address = 62 (2^6 – 2)

57
IP addressing: CIDR / Subnetting
Given the ip address above, subnet the network with the following condition.
(i) Number of IP address required per subnet = 64

• Network 4: 192.168.1.192/26
• Network Address = 192.168.1.192
• Host IP = 192.168.1.193 ~ 192.168.1.254
• Broadcast IP = 192.168.1.255
• Number of available IP address = 64 (2^6)
• Number of host IP address = 62 (2^6 – 2)

58
After Subnetting (change subnet mask)

HOW?

Network 1 : 192.168.1.0/26 Network 2 : 192.168.1.64/26


Subnet Mask = 255.255.255.192 Subnet Mask = 255.255.255.192
Network Address = 192.168.1.0 Network Address = 192.168.1.64
Host IP = 192.168.1.1 ~ 62 Host IP = 192.168.1.64 ~ 126
Broadcast IP = 192.168.1.63 Broadcast IP = 192.168.1.127

Network 3 : 192.168.1.128 /26 Network 4 : 192.168.1.192 /26


Subnet Mask = 255.255.255.192 Subnet Mask = 255.255.255.192
Network Address = 192.168.1.128 Network Address = 192.168.1.192
Host IP = 192.168.1.129~190 Host IP = 192.168.1.192 ~ 254
Broadcast IP = 192.168.1.191 Broadcast IP = 192.168.1.255
59
More Materials for Subnetting
• Subnet Masks
• https://www.youtube.com/watch?v=s_Ntt6eTn94&feature=em
b_logo
• Subnetting Made Simple
• https://www.youtube.com/watch?v=nFYilGQ-p-8

• IPv4 Addressing Lesson 2: Network IDs and Subnet Masks


• https://www.youtube.com/watch?v=XQ3T14SIlV4

• IPv4 Addressing Lesson 1: Binary and the IP Address


• https://www.youtube.com/watch?v=ddM9AcreVqY
• Understanding IP address from the most basic binary format
76
Identifying the Network

77
Prepared by: Yee Jian Chew
Good Network
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.1.1
Switch
255.255.255.0
147.144.51.1

192.168.1.101 192.168.1.102 192.168.1.103


255.255.255.0 255.255.255.0 255.255.255.0
192.168.1.1 192.168.1.1 192.168.1.1 78
DUPLICATE IP ADDRESS
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.1.1
Switch
255.255.255.0
147.144.51.1

192.168.1.101 192.168.1.101 192.168.1.103


255.255.255.0 255.255.255.0 255.255.255.0
192.168.1.1 192.168.1.1 192.168.1.1 79
Wrong Subnet Mask
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.1.1
Switch
255.255.255.0
147.144.51.1

192.168.1.101 192.168.1.102 192.168.1.103


255.255.255.0 255.255.0.0 255.255.255.0
192.168.1.1 192.168.1.1 192.168.1.1 80
Wrong Default Gateway
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.1.1
Switch
255.255.255.0
147.144.51.1

192.168.1.101 192.168.1.102 192.168.1.103


255.255.255.0 255.255.255.0 255.255.255.0
192.168.1.1 192.168.1.101 192.168.1.1 81
#1 Find the problem
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.2.1
Switch
255.255.255.0
147.144.51.1

192.168.2.101 192.168.2.102 192.169.2.103


255.255.255.0 255.255.255.0 255.255.255.0
192.168.2.1 192.168.2.1 192.168.2.1 82
#2 Find the problem
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.1.1
Switch
255.255.255.0
147.144.51.1

192.168.1.101 192.168.1.102 192.168.1.103


255.255.255.255 255.255.255.0 255.255.255.0
192.168.1.1 192.168.1.1 192.168.1.1 83
#3 Find the problem
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.2.1
Switch
255.255.255.0
147.144.51.1

192.168.2.101 192.168.2.102 192.168.2.102


255.255.255.0 255.255.255.0 255.255.255.0
192.168.2.1 192.168.2.1 192.168.2.1 84
#4 Find the problem
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.0.1
Switch
255.255.255.0
147.144.51.1

192.168.0.101 192.168.0.102 192.168.0.103


255.255.255.0 255.255.255.0 255.255.255.0
192.168.2.1 192.168.0.1 192.168.0.1 85
#5 Find the problem
To the Internet
IP Address
Subnet Mask
Default Gateway

192.168.1.4
Switch
255.255.255.0
147.144.51.1

192.168.1.101 192.168.1.102 192.168.1.103


255.255.255.0 255.255.255.0 255.255.255.0
192.168.1.1 192.168.1.1 192.168.1.1 86
References
ADAPTED FROM:
• Joon-Moon Chung. Introduction to TCP/IP by Yonsei University. https://www.coursera.org/learn/tcpip
• Slides. Computer Networking: A Top Down Approach. 7th edition, Jim Kurose, Keith Ross, Pearson/Addison
Wesley, April 2016.
• William Stallings, Data and Computer Communications, 10th Ed. Prentice Hall, 2014.
• The Bits and Bytes of Computer Networking. Google, Coursera. https://www.coursera.org/learn/computer-
networking?specialization=google-it-support

REFERENCES:
• Forouzan, A. Behrouz. Data communications & networking (sie). Tata McGraw-Hill Education, 2007.
• tcp ip model updated:
https://www.computernetworkingnotes.com/ccna-study-guide/similarities-and-differences-between-osi-and-tcp-i
p-model.html

• Image source: flaticon.com


• Youtube: osi model explained: https://www.youtube.com/watch?v=vv4y_uOneC0
• Explain the difference between Hub and Switch. https://www.youtube.com/watch?v=1z0ULvg_pW8
• Explain the difference between Modem and Router. https://www.youtube.com/watch?v=Mad4kQ5835Y
• Subnetting (short): https://www.youtube.com/watch?v=nFYilGQ-p-8
87
• Subnetting (long): https://www.youtube.com/watch?v=XQ3T14SIlV4

You might also like