You are on page 1of 23

Chapter 4

Network Layer

Network Layer 4-1


Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and  link state
datagram networks  distance vector
4.4 IP: Internet Protocol  hierarchical routing
 datagram format 4.6 routing in the Internet
 IPv4 addressing  RIP
 ICMP  OSPF
 IPv6  BGP
4.7 broadcast and multicast
routing

Network Layer 4-2


Network layer
application

 transport segment from transport


network

sending to receiving host data link


physical
network network

 on sending side network


data link
data link
physical
data link
physical

encapsulates segments physical network


data link
network
data link

into datagrams physical physical

 on receiving side, delivers network


data link
network
data link

segments to transport
physical physical
network
data link

layer network
physical
application
transport
 network layer protocols network
data link
physical
network
data link
network
data link

in every host, router data link


physical
physical physical

 router examines header


fields in all IP datagrams
passing through it
Network Layer 4-3
Two key network-layer functions
 forwarding: move packets analogy:
from router’s input to
appropriate router  routing: process of
output planning trip from source
to destination
 routing: determine route
taken by packets from  forwarding: process of
source to dest. getting through single
intersection
 routing algorithms

Network Layer 4-4


Interplay between routing and forwarding

routing algorithm routing algorithm determines


end-end-path through network

local forwarding table forwarding table determines


header value output link local forwarding at this router
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2

Network Layer 4-5


Connection setup
 important function in some network architectures:
 ATM, frame relay, X.25
 before datagrams flow, two end hosts and
intervening routers establish virtual connection
 routers get involved
 network vs transport layer connection service:
 network: between two hosts
 transport: between two processes

Network Layer 4-6


Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and  link state
datagram networks  distance vector
4.4 IP: Internet Protocol  hierarchical routing
 datagram format 4.6 routing in the Internet
 IPv4 addressing  RIP
 ICMP  OSPF
 IPv6  BGP
4.7 broadcast and multicast
routing

Network Layer 4-7


Datagram networks
 no call setup at network layer
 routers: no state about end-to-end connections
 no network-level concept of “connection”
 packets forwarded using destination host address

application application
transport transport
network 1. send datagrams 2. receive datagrams network
data link data link
physical physical

Network Layer 4-8


Datagram forwarding table
4 billion IP addresses, so
routing algorithm rather than list individual
destination address
local forwarding table
list range of addresses
dest address output link (aggregate table entries)
address-range 1 3
address-range 2 2
address-range 3 2
address-range 4 1

IP destination address in
arriving packet’s header
1
3 2

Network Layer 4-9


Longest prefix matching
longest prefix matching
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.

Destination Address Range Link interface


11001000 00010111 00010*** ********* 0
11001000 00010111 00011000 ********* 1

11001000 00010111 00011*** ********* 2

otherwise 3

examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
Network Layer 4-10
Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and  link state
datagram networks  distance vector
4.4 IP: Internet Protocol  hierarchical routing
 datagram format 4.6 routing in the Internet
 IPv4 addressing  RIP
 ICMP  OSPF
 IPv6  BGP
4.7 broadcast and multicast
routing

Network Layer 4-11


The Internet network layer
host, router network layer functions:

transport layer: TCP, UDP

routing protocols IP protocol


• path selection • addressing conventions
• RIP, OSPF, BGP • datagram format
network • packet handling conventions
layer forwarding
table
ICMP protocol
• error reporting
• router
“signaling”
link layer

physical layer

Network Layer 4-12


IP datagram format
IP protocol version 32 bits
number total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead? data taken, specify
(variable length, list of routers
 20 bytes of TCP
typically a TCP to visit.
 20 bytes of IP
or UDP segment)
 = 40 bytes + app
layer overhead

Network Layer 4-13


IP fragmentation and reassembly
 network links have MTU
(max. transfer size) -
largest possible link-level fragmentation:
frame


in: one large datagram
 different link types, out: 3 smaller datagrams
different MTUs
 large IP datagram divided
(“fragmented”) within net reassembly
 one datagram becomes
several datagrams
 “reassembled” at final …
destination
 IP header bits used to
identify, order related
fragments
Network Layer 4-14
IP fragmentation, reassembly
length ID fragflag offset
example: =4000 =x =0 =0
 4000 byte datagram
one large datagram becomes
 MTU = 1500 bytes several smaller datagrams

1480 bytes in length ID fragflag offset


data field =1500 =x =1 =0

offset = length ID fragflag offset


1480/8 =1500 =x =1 =185

length ID fragflag offset


=1040 =x =0 =370

Network Layer 4-15


Fragmentation and Reassembly

 Very important concepts


 More detailed explanation in the textbook

Network Layer 4-16


Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and  link state
datagram networks  distance vector
4.3 what’s inside a router  hierarchical routing
4.4 IP: Internet Protocol 4.6 routing in the Internet
 datagram format  RIP
 IPv4 addressing  OSPF
 ICMP  BGP
 IPv6 4.7 broadcast and multicast
routing

Network Layer 4-17


IP addressing: introduction
223.1.1.1
 IP address: 32-bit
identifier for host, router
223.1.2.1

interface 223.1.1.2
223.1.1.4 223.1.2.9
 interface: connection
between host/router and 223.1.3.27
physical link 223.1.1.3
223.1.2.2
 router’s typically have
multiple interfaces
 host typically has one or
two interfaces (e.g., wired 223.1.3.1 223.1.3.2

Ethernet, wireless 802.11)


 IP addresses associated
with each interface 223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1

Network Layer 4-18


IP addressing: introduction
223.1.1.1

223.1.2.1

223.1.1.2
223.1.1.4 223.1.2.9

223.1.3.27
223.1.1.3
223.1.2.2

wired Ethernet interfaces connected


by Ethernet switches
223.1.3.1 223.1.3.2

wireless WiFi interfaces connected


by WiFi base station

Network Layer 4-19


Subnets
 IP address: 223.1.1.1
subnet part - high order
bits 223.1.1.2 223.1.2.1
223.1.1.4 223.1.2.9
host part - low order
bits 223.1.2.2
 What is a subnet ? 223.1.1.3 223.1.3.27

device interfaces with subnet


same subnet part of IP
address 223.1.3.1 223.1.3.2

can physically reach


each other without
intervening router network consisting of 3 subnets

Network Layer 4-20


Subnets
223.1.1.0/24
223.1.2.0/24
223.1.1.1

 to determine the 223.1.1.2 223.1.2.1


subnets, detach each 223.1.1.4 223.1.2.9

interface from its host 223.1.2.2


or router, creating 223.1.1.3 223.1.3.27

islands of isolated subnet


networks
 each isolated network 223.1.3.1 223.1.3.2

is called a subnet
223.1.3.0/24

subnet mask: /24


Network Layer 4-21
IP addressing: Classful Routing
Type “A”, “B” and “C” networks
- corresponding to 8, 16 or 24 bit subnet
addresses
- often wasteful

subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/8

Network Layer 4-22


IP addressing: CIDR
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

subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23

Network Layer 4-23

You might also like