Network Layer Packet and Packet Header Encapsulation, Study notes of Network Technologies and TCP/IP

The format of a packet header is part of the protocol. For the Internet, the network-layer protocol is the. Internet Protocol (IP). Encapsulation.

Typology: Study notes

2022/2023

Uploaded on 05/11/2023

paulina
paulina 🇺🇸

4.4

(13)

240 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer Networks!
Lecture'6:'IPv4,'CIDR,'ICMP'
Network'Layer'
Where'are'we'now?'
'
'
'
'
'
'
'
Previously'.'.'.'the'Internet'is'a'packet'switched'network:'
data'is'parceled'into'packets'
each'packet'carries'a'destination'address'
each'packet'is'routed'independently'
socket API
DNS
application
transport
network
link
physical
Packet'and'Packet'Header'
Protocols'are'rules'(“syntax”'and'“grammar”')'
governing'communication'between'nodes'
Just'as'with'the'postal'system,'the'“content”'you'want'
to'send'must'be'put'into'an'envelope'and'the'
envelope'must'be'addressed'
'
The'“envelope”'in'this'case'is'the'packet'header'
The'format'of'a'packet'header'is'part'of'the'protocol'
'
For'the'Internet,'the'network-layer'protocol'is'the'
Internet'Protocol'(IP)'
Encapsulation'
Each'protocol'has'its'own'“envelope”'
each'protocol'attaches'its'header'to'the'packet''
so'we'have'a'protocol'wrapped/encapsulated'inside'another'protocol'
each'layer'of'header'contains'a'protocol'de-multiplexing'field'to'
identify'the'“packet'handler”'
the'next'layer'up,'e.g.,'
protocol'number'
port'number'
message'
segment'
datagram/packet'
frame'
source'
application'
transport'
network'
link'
physical'
Ht
Hn
HlM
Ht
HnM
HtM
M
destination'
Ht
Hn
HlM
Ht
HnM
HtM
M
network'
link'
physical'
link'
physical'
Ht
Hn
HlM
Ht
HnM
Ht
Hn
HlM
Ht
HnM
Ht
Hn
HlMHt
Hn
HlM
router'
switch'
application'
transport'
network'
link'
physical'
packet'not'package'
pf3
pf4
pf5

Partial preview of the text

Download Network Layer Packet and Packet Header Encapsulation and more Study notes Network Technologies and TCP/IP in PDF only on Docsity!

Computer Networks

Lecture 6: IPv 4 , CIDR, ICMP

Network Layer

Where are we now?

Previously... the Internet is a packet switched network:

• data is parceled into packets

• each packet carries a destination address

• each packet is routed independently

socket API

DNS

application

transport

network

link

physical

Packet and Packet Header

Protocols are rules (“syntax” and “grammar” )

governing communication between nodes

Just as with the postal system, the “content” you want

to send must be put into an envelope and the

envelope must be addressed

The “envelope” in this case is the packet header

The format of a packet header is part of the protocol

For the Internet, the network-layer protocol is the

Internet Protocol (IP)

Encapsulation

Each protocol has its own “envelope”

• each protocol attaches its header to the packet

• so we have a protocol wrapped/encapsulated inside another protocol

• each layer of header contains a protocol de-multiplexing field to

identify the “packet handler”

the next layer up, e.g.,

  • protocol number
  • port number

message

segment

datagram/packet

frame

source

application

transport

network

link

physical

H t

H n

H l

M

H

t

H

n

M

H t

M

M

destination

H t

H n

H l

M

H t

H n

M

H

t

M

M

network

link

physical

link

physical

H t

H n

H l

M

H t

H n

M

H

t

H

n

H

l

M

H t

H n

M

H

t

H

n

H

l

M H t

H n

H l

M

router

switch

application

transport

network

link

physical

packet not package

IPv 4 Packet Header Format

version

hdr len

(bytes)

Type of Service

(TOS)

Total length (bytes)

Identification

3 -bit

flags

13 -bit Fragment Offset

Time to

Live (TTL)

Protocol Header Checksum

Source IP Address

Destination IP Address

Options (if any)

Payload (e.g., TCP/UDP packet, max size?)

20 -byte

Header

usually IPv 4

upper layer protocol

to whom payload is

delivered, e.g., ICMP

( 1 ), UDP ( 17 ), TCP ( 6 )

e.g. timestamp,

record route,

source route

4 bits

4 bits 8 bits 16 bits

Packet Forwarding

Goal: deliver packets through routers from source to

destination

• source node puts destination address in packet header

• each router node on the Internet:

• looks up destination address

in its routing/forwarding table

  • we’ll study several path selection

(i.e., routing) algorithms

• sends the packet to the next hop

towards the destination

  • routes may change during session
  • analogy: driving, asking directions

0111

destination

address in

packet’s

header

routing algorithm

local forwarding table

dest address

output link

IPv 4 Addressing: Introduction

IPv 4 address: 32 -bit

identifier for host/router

interface

interface (if): connection

between host/router and

physical link

• routers typically have

multiple interfaces

• host may have

multiple interfaces

Flat vs. Hierarchical Addressing

Flat addressing:

• each router needs 10 entries

in its routing table

Hierarchical addressing:

• hosts only need to know the

default router, usually its

border router

• each border router keeps in

its routing table:

• addresses of all hosts within its own

network

• next hop address of other networks

(Cf. forwarding table stores the

outgoing interface number)

Usually written as a.b.c.d/x, where x is number of

bits in the network portion of the address: 12.4.0.0/

Another example (not at octet boundary!):

Classless InterDomain Routing (CIDR)

11001000 00010111 0001000 0 00000000

network

prefix

host

part

IP address:

12.4.0.

prefix mask:

255.254.0.

network prefix for hosts

CIDR: Hierarchical Address Allocation

Prefixes are key to Internet routing scalability

• address allocation by ICANN, ARIN/RIPE/APNIC and by ISPs

• routing protocols and packet forwarding based on prefixes

• today, routing tables contain ~150,000-200,000 prefixes

CIDR: Route Aggregation

“Send me anything

with addresses

beginning

200.23.16.0/

200.23.18.0/

200.23.30.0/

Fly-By-Night-ISP

Organization 0

Organization 7

Internet

Organization 1

ISPs-R-Us

“Send me anything

with addresses

beginning

200.23.20.0/

Organization 2

Hierarchical addressing allows efficient

advertisement of routing information:

Longest Prefix Match:

More Specific Routes

ISPs-R-Us has a more specific route to Organization 1

“Send me anything

with addresses

beginning

200.23.16.0/

200.23.18.0/

200.23.30.0/

Fly-By-Night-ISP

Organization 0

Organization 7

Internet

Organization 1

ISPs-R-Us

“Send me anything

with addresses

beginning 199.31.0.0/

or 200.23.18.0/23”

200.23.20.0/

Organization 2

Packet Forwarding Summary

Forwarding is destination-based:

• packet has a destination address

• router identifies longest-matching prefix

Forwarding table:

• maps each IP prefix to next-hop link(s)

• entries can be statically configured

• e.g., “map 12.34.158.0/24 to Serial0/0.1”

But, this doesn’t adapt to

• failures

• new equipment

• the need to balance load

4.0.0.0/

4.83.128.0/

12.0.0.0/

12.34.158.0/

126.255.103.0/

destination

forwarding table

outgoing link

Serial0/0.

That is where routing

protocols come in…

[more on routing later

in the term]

Special IPv 4 Addresses

Network identification:

• 0 s on host part, e.g. ,141.212.0.0 (cannot be used to send packets)

Directed broadcast:

• 0xffff on host part, e.g., 141.212.255.

• broadcast to all hosts on a network (e.g., 141.212) (not implemented)

Limited broadcast:

• 0xffffffff, received by all hosts on LAN, not forwarded beyond LAN

This computer:

• 0.0.0.0 used at startup to solicit IP address with RARP (deprecated)

Loopback address:

• 127...* (usually 127.0.0.1), named localhost

• packets sent to localhost traverse down the kernel networking code

to the network layer and back up to the application without traversing

the network, useful for testing networking code

Internet Control Message Protocol

ICMP is used by hosts and routers to communicate

network-level information

• error reporting: unreachable host, network, port, protocol

• echo request/reply (used by ping)

• ICMP error message does not trigger another ICMP message

ICMP runs on network-layer, but “above” IP:

• ICMP messages are carried inside IP datagrams

ICMP message format:

type code

checksum

The first 8 bytes of IP datagram causing error

8 bits 8 bits 16 bits

Internet Control Message Protocol

Type Code Description

0 0 echo reply (ping)

3 0 dest network unreachable

3 1 dest host unreachable

3 2 dest protocol unreachable

3 3 dest port unreachable

3 4 frag needed but DF set

3 6 dest network unknown

3 7 dest host unknown

8 0 echo request (ping)

9 0 route advertisement

10 0 router discovery

11 0 TTL expired

12 0 bad IP header