Class 3 - Network Layer and Subnetting-B

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 51

CEWP MOD3 GRA

CLASS 3 – NETWORK LAYER AND


ROUTING

Instructor name
Housekeeping Items
• Today please close all laptops until the moment they will be
required for an activity

• The PPTs will be posted after class. Both slides and notes contain
material which will be in the mid-term and final exams

• Feel free to ask questions or intervene. We are a small class, let’s


make the most of it!

• WARNING: there may be a little quiz (with chocolate at stake) just


to check you’re paying attention.
Learning Targets for today’s lesson…
1. Understand the service model of the network layer and explain the
its three key functions
2. Understand IP address format, the differences between IPv4 and
IPv6 and how interworking is performed
3. Understand the basics of DHCP and NAT
4. Calculate Subnet addresses, identify and calculate subnet masks
and understand how they are used in IP routing
Reminder…
Away We
are
Pizza here application 5
Sausage
Throw
transport 4
Not
Do
Internet network 3
Please

link 2
Network
Access physical 1
Architectural Principles of the
Internet
RFC 1958
“Many members of the Internet community would argue that there is no architecture, but only a tradition,
which was not written down for the first 25 years (or at least not by the IAB). However, in very general terms,
the community believes that the goal is connectivity, the tool is the Internet
Protocol, and the intelligence is end to end rather than hidden in the
network.”

HTTP SMTP RTP …


QUIC DASH
Three cornerstone beliefs: TCP UDP
▪ simple connectivity IP
▪ intelligence, complexity at network edge Ethernet … PPP
WiFi
▪ IP protocol: that narrow waist
Bluetooth
copper radio fiber
Intro to the Network Layer

Computer Networking: a Top-Down Approach (8th ed.)


J.F. Kurose, K.W. Ross, Pearson, 2020
http://gaia.cs.umass.edu/kurose_ross
Network Layer Characteristics
The Network Layer
• Provides services to allow end devices to The Service Model:
exchange data
• IP version 4 and IP version 6 are the principal
network layer communication protocols.
◦ Connectionless
?
End-to-end delivery of
packets between
◦ Media Independent (establishes MTU from Link Layer sending and receiving
info)
hosts
◦ Best Effort
• Basic operations of the network layer:
1. Encapsulation and De-encapsulation
2. Addressing end devices (Network interfaces)
3. Forwarding and Routing (hop by hop)
Network service model
Q: What service model for datagram delivery from sender to
receiver?
Examples for individual datagrams: Examples for a flow of datagrams:
▪ guaranteed delivery ▪ in-order datagram delivery
▪ guaranteed delivery with less ▪ guaranteed minimum bandwidth
than 40 msec delay to flow
▪ restrictions on changes in inter-
packet spacing
Network-layer service model
Quality of Service (QoS) Guarantees ?
Network Service
Architecture Model Bandwidth Loss Order Timing

Internet best effort none no no no

ATM Constant Bit Rate Constant rate yes yes yes


Internet “best effort” service model
ATM Available Bit Rate
No guarantees on: Guaranteed min no yes no

Internet i. successful
Intserv Guaranteed datagram
yes deliveryyes
to destination
yes yes
ii.1633
(RFC )
timing or order of delivery
Internet Diffserv (RFC 2475) available
iii. bandwidth possibleto end-end flow possibly
possibly no
Reflections on best-effort service:
▪ simplicity of mechanism has allowed Internet to be widely deployed
adopted
▪ sufficient provisioning of bandwidth allows performance of real-time
applications (e.g., interactive voice, video) to be “good enough” for
“most of the time”
▪ replicated, application-layer distributed services (datacenters, content
distribution networks) connecting close to clients’ networks, allow
services to be provided from multiple locations
▪ congestion control of “elastic” services helps

It’s hard to argue with success of best-effort service model


Basic operations of the network layer:
1. Encapsulation and De-encapsulation
2. Addressing end devices
1. Addressing format
2. DHCP
3. Subnetting
4. NAT
3. Forwarding and Routing Tomorrow
IP addressing: introduction
223.1.1.1

▪ IP address: 32-bit identifier associated


with each host or router interface
223.1.2.1

223.1.1.2
▪ interface: connection between 223.1.1.4 223.1.2.9

host/router and physical link


▪ router’s typically have multiple 223.1.1.3
223.1.3.27

interfaces 223.1.2.2

▪ host typically has one or two interfaces


(e.g., wired Ethernet, wireless 802.11)
223.1.3.1 223.1.3.2
Example of IPv4 addresses:
▪ 192.168.0.1
▪ 10.20.5.7
▪ 255.255.255.0
Format and classes
▪ Format: dotted-decimal IP address notation
− 32 bits = ? bytes
− byte1.byte2.byte3.byte4
− Byte decimal values: ? - ?
▪ Classes – ClassFull Addresses:
− Class A: From 0.0.0.0 to 127.255.255.255
⚫ Subnet Mask: 255.0.0.0 or /8
− Class B: From 128.0.0.0 to 191.255.255.255
⚫ Subnet Mask: 255.255.0.0 or /16
− Class C: From 192.0.0.0 to 233.255.255.255
⚫ Subnet Mask: 255.255.255.0 or /24
− Class D: 224.0.0.0 to 239.255.255.255.255
− Class E: 240.0.0.0 to 255.255.255.255
Public & Private
▪ Public: Leased to corporation, public, globally unique on internet, REGISTERED

▪ Private: UNREGISTERED, locally significant, not routed on internet, overlap from one LAN to another LAN, for internal use only


Public & Private ACTIVITY

▪ Who is the RIR for IP addresses assignment for Europe Region ?


▪ Find the reserved private IP range for class A ?
▪ Find the reserved private IP range for class B ?
▪ Find the reserved private IP range for class C ?

▪ 0.0.0.0 is reserved for ?


▪ 127.x.x.x is reserved for ?
▪ 169.254.x.x is reserved for ?
IP addressing: introduction
▪ IP addresses have a hierarchy:
▪ A subnet part (higher order bits)
▪ A host part (lower order bits)
▪ A special IP Address: 255.255.255.255
Can you guess what it’s for?

dotted-decimal IP address notation:


223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1
IP Datagram format
32 bits
IP protocol version number total datagram
ver head. type of length length (bytes)
header length(bytes) len service
fragment fragmentation/
“type” of service: 16-bit identifier flgs
▪ diffserv (0:5) offset reassembly
time to upper header
▪ ECN (6:7) header checksum
live layer checksum
TTL: remaining max hops source IP address 32-bit source IP address
(decremented at each router)
destination IP address 32-bit destination IP address
upper layer protocol (e.g., TCP or UDP)
options (if any) e.g., timestamp, record
overhead route taken
▪ 20 bytes of TCP payload data
▪ 20 bytes of IP (variable length, Maximum length: 64K bytes
▪ = 40 bytes + app typically a TCP Typically: 1500 bytes or less
layer overhead for or UDP segment)
TCP+IP
IPv6: motivation
▪ initial motivation: 32-bit IPv4 address space would be completely
allocated
▪ additional motivation:
• speed processing/forwarding: 40-byte fixed length header
• enable different network-layer treatment of “flows”

"Who the hell knew how much address space we needed?" Vint Cerf (reflecting on
decision to make IPv4 address 32 bits long)
IPv6 datagram format
32 bits
(4 bits) set to 6 (20 bits) identify
for IPV6.. BUT datagrams in same
not 4 for IPV4!! "flow.” (concept of
“flow” not well defined).
128-bit
IPv6 addresses

What’s missing (compared with IPv4):


▪ no checksum (to speed processing at routers)
▪ no fragmentation/reassembly
▪ no options (available as upper-layer, next-header protocol at router)
Types of IPv6 addresses

Globally
routable
and
reachable
in the IPv6
internet

https://www.oreilly.com/library/view/ipv6-fundamentals-a/9780134670584/ch05.html
IPv6: adoption ACTIVITY

1. What is the global adoption of IPV6


connectivity of Google’s users today?

1. What is the adoption in Canada?

1. In the US?

1. In France?
https://www.google.com/intl/en/ipv6/statistics.html
Transitioning from IPv4 to IPv6…
September 3rd, 1967 – “H Day”
Transition from IPv4 to IPv6
▪not all routers can be upgraded simultaneously
- no “Day H”: how will network operate with mixed IPv4 and IPv6
routers?

▪ tunneling: IPv6 datagram carried as payload in IPv4 datagram among


IPv4 routers (“packet within a packet”)
IPv4 header fields IPv6 header fields
IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
UDP/TCP payload

IPv6 datagram
IPv4 datagram
Tunneling
A B IPv4 tunnel E F
connecting IPv6 routers
logical view:
IPv6 IPv6/v4 IPv6/v4 IPv6

A B C D E F
physical view:
IPv6 IPv6/v4 IPv4 IPv4 IPv6/v4 IPv6

flow: X src:B src:B src:B flow: X


src: A dest: E dest: E src: A
dest: F
dest: E
dest: F
Flow: X Flow: X Flow: X
Src: A Src: A Src: A
Note source and data Dest: F Dest: F Dest: F data
destination
addresses! data data data

A-to-B: E-to-F:
B-to-C: B-to-C: B-to-C:
IPv6 IPv6
IPv6 inside IPv6 inside IPv6 inside
IPv4 IPv4 IPv4
IP addressing...
Q: how does an ISP get block of Q: are there enough 32-bit IP
addresses? addresses?
A: ICANN: Internet Corporation for ▪ ICANN allocated last chunk of
Assigned Names and Numbers IPv4 addresses to RRs in 2011
http://www.icann.org/ ▪ NAT (next) helps IPv4 address
• allocates IP addresses, through 5 space exhaustion
regional registries (RRs) (who may
then allocate to local registries) ▪ IPv6 has 128-bit address space
• manages DNS root zone, including
delegation of individual TLD (.com,
.edu , …) management
IP addresses: how to get one?
That’s actually two questions:
1. Q: How does a host get IP address within its network (host part of
address)?
2. Q: How does a network get IP address for itself (network part of
address)
How does host get IP address?
▪ hard-coded by sysadmin in config file (e.g., /etc/rc.config in UNIX)
▪ DHCP: Dynamic Host Configuration Protocol: dynamically get address
from as server - “plug-and-play” = “zero-conf”
▪ IPV6 hosts – Stateless Address Autoconfiguration (SLAAC)
On PT: ACTIVITY

-create the following star topology


-assign hostnames and IP addresses
-ping different hosts
ACTIVITY

BREAK

Return at…
Basic operations of the network layer:
1. Encapsulation and De-encapsulation
2. Addressing end devices
1. Addressing format
2. DHCP
3. Subnetting
4. NAT
3. Forwarding and Routing
DHCP: Dynamic Host Configuration
Protocol
goal: host dynamically obtains IP address from network server when it “joins”
network
▪ can renew its lease on address in use
▪ allows reuse of addresses (only hold address while connected/on)
▪ support for mobile users who join/leave network

DHCP overview:
▪ host broadcasts DHCP discover msg [optional]
▪ DHCP server responds with DHCP offer msg [optional]
▪ host requests IP address: DHCP request msg
▪ DHCP server sends address: DHCP ack msg
Network Layer: 4-38
DHCP client-server scenario
Typically, DHCP server will be co-
DHCP server located in router, serving all subnets
223.1.1.1
223.1.2.1
to which router is attached

223.1.2.5
223.1.1.2
223.1.1.4 223.1.2.9

223.1.1.3
223.1.3.27 arriving DHCP client needs
223.1.2.2 address in this network

223.1.3.1 223.1.3.2
DHCP client-server scenario
DHCP server: 223.1.2.5 DHCP discover Arriving client
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server!
yiaddr:Here’s an IP
223.1.2.4
address you can use
transaction ID: 654
lifetime: 3600 secs
The two steps above can
DHCP request be skipped “if a client
src: 0.0.0.0, 68 remembers and wishes to
Broadcast: OK. I would
dest:: 255.255.255.255, 67 reuse a previously
yiaddr: 223.1.2.4 allocated network address”
like to transaction
use this ID:IP 655
address!
[RFC 2131]
lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
Broadcast: OK. You’ve
yiaddr: 223.1.2.4
yiaddr = your internet address got that IPID:address!
transaction 655
lifetime: 3600 secs
DHCP: more than IP addresses
DHCP can return more than just allocated IP address on
subnet:
▪ address of first-hop router for client
▪ name and IP address of DNS sever
▪ network mask (indicating network versus host portion of address)

Network Layer: 4-41


Basic operations of the network layer:
1. Encapsulation and De-encapsulation
2. Addressing end devices
1. Addressing format
2. DHCP
3. Subnetting
4. NAT
3. Forwarding and Routing
Subnets
223.1.1.1

▪ What’s a subnet ? 223.1.2.1

• device interfaces that can 223.1.1.2


223.1.1.4 223.1.2.9
physically reach each other
without passing through an 223.1.1.3
223.1.3.27

intervening router 223.1.2.2

▪ IP addresses have structure:


• subnet part: devices in same subnet 223.1.3.1 223.1.3.2

have common high order bits


• host part: remaining low order bits network consisting of 3 subnets
Subnets subnet 223.1.1.0/24
subnet 223.1.2.0/24
223.1.1.1
Recipe for defining subnets: 223.1.2.1

▪detach each interface from its 223.1.1.2


223.1.1.4 223.1.2.9

host or router, creating


“islands” of isolated networks 223.1.1.3 223.1.3.27
223.1.2.2

▪each isolated network is


subnet
called a subnet 223.1.3.0/24 223.1.3.1 223.1.3.2

subnet mask: /24


(high-order 24 bits: subnet part of IP address)
Subnets 223.1.1.2

subnet 223.1.1/24
223.1.1.1
▪ Not just for 223.1.1.4

Ethernet LANS with 223.1.1.3

hosts
223.1.9.2 223.1.7.0
▪ Interconnected subnet 223.1.9/24
subnet 223.1.7/24

routers can also


form subnets! 223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0

subnet 223.1.2/24 223.1.2.6 subnet 223.1.8/24 223.1.3.27


subnet 223.1.3/24
223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2
IP addressing: CIDR ACTIVITY

CIDR: Classless InterDomain Routing (pronounced “cider”)


• subnet portion of address of arbitrary length
• address format: a.b.c.d/x, where x is # bits in subnet portion
of address
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23

What is the Network Address? What is the mask length?


ACTIVITY

Subnet Mask and Wild card bits


subnet host
part part
11001010 10010111 00110000 00000000
?.?.?.0/?

What is the subnet mask address? 11111111 11111111 11111110 00000000


?.?.?.0

What is the wild card bits address? 00000000 00000000 00000001 11111111
?.?.?.?
ACTIVITY

Calculating a Network Address


The network address can be calculated with AND

IP address and prefix of host 207.59.22.34/28


IP Address
What is the IP address in binary? 11001111 00111011 00010110 00100010
AND
AND
What is the Subnet Mask? SUBNET11111111
11111111 MASK 11111111 11110000

What is the Network Address? =11001111


NETWORK00111011
ADDRESS00010110 00100000

….in decimal? 207.59.22.32


Number of Hosts, Broadcast address, Default Gateway
IP address and prefix of host 207.59.22.34/28
11001111 00111011 00010110 00100010
How many hosts can this subnet support?
Hint: keep room for the network address and the 24-2 = 14
broadcast address!
What is the Broadcast address of this subnet?
11001111 00111011 00010110 00101111

Hint: what do you remember about broadcast 207.59.22.47


addresses?
What is the Network address of this subnet?
Hint: what do you remember about network
addresses?
Subnet an IPv6 Network
IPv6 was designed with subnetting in mind.
• A separate subnet ID field in the IPv6 GUA is used to create subnets.
• The subnet ID field is the area between the Global Routing Prefix and the
interface ID.
Basic operations of the network layer:
1. Encapsulation and De-encapsulation
2. Addressing end devices
1. Addressing format
2. DHCP
3. Subnetting
4. NAT
3. Forwarding and Routing
NAT: network address translation
NAT: all devices in local network share just one IPv4 address as
far as outside world is concerned
rest of local network (e.g., home
Internet network) 10.0.0/24

10.0.0.1
138.76.29.7 10.0.0.4

10.0.0.2

10.0.0.3

all datagrams leaving local network have datagrams with source or destination in
same source NAT IP address: 138.76.29.7, this network have 10.0.0/24 address for
but different source port numbers source, destination (as usual)
NAT: network address translation
▪ all devices in local network have 32-bit addresses in a “private” IP
address space (10/8, 172.16/12, 192.168/16 prefixes) that can only
be used in local network
▪ advantages:
▪ just one IP address needed from provider ISP for all devices
▪ can change addresses of host in local network without notifying
outside world
▪ can change ISP without changing addresses of devices in local
network
▪ security: devices inside local net not directly addressable, visible
by outside world

Network Layer: 4-58


NAT: network address translation
implementation: NAT router must (transparently):
▪ outgoing datagrams: replace (source IP address, port #) of every
outgoing datagram to (NAT IP address, new port #)
• remote clients/servers will respond using (NAT IP address, new port
#) as destination address
▪ remember (in NAT translation table) every (source IP address, port #)
to (NAT IP address, new port #) translation pair
▪ incoming datagrams: replace (NAT IP address, new port #) in
destination fields of every incoming datagram with corresponding
(source IP address, port #) stored in NAT table
NAT: network address translation
NAT translation table
2: NAT router changes 1: host 10.0.0.1 sends
WAN side addr LAN side addr datagram to
datagram source address
138.76.29.7, 5001 10.0.0.1, 3345 128.119.40.186, 80
from 10.0.0.1, 3345 to
138.76.29.7, 5001, …… ……
updates table
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 128.119.40.186, 80 10.0.0.3
D: 138.76.29.7, 5001 3
3: reply arrives, destination
address: 138.76.29.7, 5001
NAT: network address translation
▪ NAT has been controversial:
• routers “should” only process up to layer 3
• address “shortage” should be solved by IPv6
• violates end-to-end argument (port # manipulation by network-layer device)
• NAT traversal: what if client wants to connect to server behind NAT?
▪ but NAT is here to stay:
• extensively used in home and institutional nets, 4G/5G cellular nets
Lesson Wrap up – what comes to mind?
1. Understand the service model of the network layer and explain
the its three key functions
2. Understand IP address format, the differences between IPv4 and
IPv6 and how interworking is performed
3. Understand the basics of DHCP and NAT
4. Calculate Subnet addresses, identify and calculate subnet masks
and understand how they are used in IP routing
NEXT WEEK: that third crucial function of the network layer: routing
LABs
◦ You have assigned 4 labs
◦ Due dates :
◦ Lab3 – tomorrow before 9am
◦ Lab4, 5 and 6 – saturday mid night

You might also like