0% found this document useful (0 votes)
8 views95 pages

Protocol 145 239

The document provides an overview of routing concepts and algorithms in networking, detailing static and dynamic routing methods, including Distance Vector and Link-State algorithms. It discusses the importance of routing tables, protocols, and metrics in determining the best paths for packet forwarding. Additionally, it covers the implementation of connectionless and connection-oriented services, as well as the role of routers in managing network traffic.

Uploaded by

maxi milian
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)
8 views95 pages

Protocol 145 239

The document provides an overview of routing concepts and algorithms in networking, detailing static and dynamic routing methods, including Distance Vector and Link-State algorithms. It discusses the importance of routing tables, protocols, and metrics in determining the best paths for packet forwarding. Additionally, it covers the implementation of connectionless and connection-oriented services, as well as the role of routers in managing network traffic.

Uploaded by

maxi milian
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/ 95

7 Application

6 Presentation

5 Session

4 Transport Lecture IX
3.NETWORK LAYER
3 Network

2 Data Link

1 Physical

Asst.Prof.Dr.Mohmed Shujaa 145


7 Application OVERVIEW

6 Presentation 1. Routing Algorithms


• Shortest Path
• Flooding
• Flow-based
5 Session • Distance Vector
• Link State
• Hierarchical
4 Transport • Broadcast
• Multicast
• Routing in the internet, mobile host
3 Network 2. Congestion control
3. IP Addressing IP: Internet Protocol . datagram format
2 Data Link IPv4 addressing , ICMP , IPv6
4. Routers protocols: RIP OSPF BGP
5. Implementation of connectionless service
1 Physical Implementation of connection-oriented service

Asst.Prof.Dr.Mohmed Shujaa 146


Routing Concept
• ROUTING is forwarding of packets from one network to
another network choosing the best path from the routing table.

• Routing table consist of only the best routes for every


destinations.
• Types of routing:

1- Static

2- Default

3- Dynamic

Asst.Prof.Dr.Mohmed Shujaa 147


Static Algorithm

• Flooding routing.

• Shortest path routing.

• Flow based routing.

Asst.Prof.Dr.Mohmed Shujaa 148


Dynamic Routing Algorithm

• Distance Vector Routing.

• Link state routing.

Asst.Prof.Dr.Mohmed Shujaa 149


Routing protocol
• A routing protocol is a combination of rules and

procedures that lets routers in the internet inform each

other of changes.

• Routing metric: a method by which routing algorithms

determines that one route is better than another route

Metric may be(hop count, bandwidth ,delay, load)

Asst.Prof.Dr.Mohmed Shujaa 150


Popular routing protocols

Asst.Prof.Dr.Mohmed Shujaa 151


Two key network-layer functions

• forwarding: move
packets from router’s
input to appropriate
router output

• routing: determine route


taken by packets from
source to destination.
- routing algorithms
Asst.Prof.Dr.Mohmed Shujaa 4-152
Interplay between routing and forwarding

routing algorithm routing algorithm


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

value in arriving
packet’s header
0111

2
1
3

Asst.Prof.Dr.Mohmed Shujaa 4-153


Routing algorithm classification
static or dynamic?
General:
• all routers have complete topology, static:
link cost info  routes change slowly over
• “link state” algorithms time
decentralized:
dynamic:
• router knows physically-connected
neighbors, link costs to neighbors  routes change more
• process of computation, exchange quickly
info with neighbors  periodic update
• “distance vector” algorithms
 in response to link cost
changes

Asst.Prof.Dr.Mohmed Shujaa 4-154


Lecture X

Algorithems

Asst.Prof.Dr.Mohmed Shujaa 155


7 Application STATIC ROUTING ALGORITHMS

6 Presentation 1. Shortest Path : Developed by E.W.Dijkstra Algorithem

B(A,2) C(B,3)
5 Session B 1 C
2
4 Transport A(-,-) 3 2 3
D(E,3)
2
A F(E,4)
3 Network D
1
1 F
E(A,2) 2
2 Data Link 2
E
1 Physical
A– E–D –F
A – E – F is the answer. (hops& cost)
Asst.Prof.Dr.Mohmed Shujaa 156
Example:Find the shortest path from a specified
source to all other destinations in the network.

Asst.Prof.Dr.Mohmed Shujaa 157


7 Application STATIC ROUTING ALGORITHMS

6 Presentation 2. Flooding :

Packet to IMP C
5 Session Packet IMP Packet to IMP D
4 Transport B Packet to IMP E
To prevent packets from circulating indefinitely, a
3 Network packet has a hop counter. Every time a packet arrives
at an IMP, the hop counter is decrease by 1. Once the
hop counter of a packet reaches 0, the packet is
2 Data Link
discarded.
every incoming packet is sent out on every outgoing line
1 Physical except the one it arrived on.

Asst.Prof.Dr.Mohmed Shujaa 158


7 Application NETWORK DEVICE /ROUTERS

6 Presentation A layer 3 device that is used to interconnect 2 or more


logical networks.

5 Session Can filter broadcast traffic, preventing broadcast traffic


from one network from reaching another network.
4 Transport

3 Network 180.200.0.0 202.5.3.0

2 Data Link

1 Physical

Asst.Prof.Dr.Mohmed Shujaa 159


Routing Graph abstraction

5
v 3 w
u 2 5z
2 3 1
graph: G = (N,E)
1 x y 2
1
N = set of routers = { u, v, w, x, y, z }

E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
graph abstraction is useful in other network contexts, e.g.,
P2P, where N is set of peers and E is set of TCP connections

Asst.Prof.Dr.Mohmed Shujaa 4-160


Graph abstraction: costs

5 c(x,x’) = cost of link (x,x’)


e.g., c(w,z) = 5
v 3 w
u 2 5z
2 3 1 cost could always be 1, or
1 x y 2 inversely related to bandwidth,
1 or inversely related to
congestion
cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)

key question: what is the least-cost path between u and z ?


routing algorithm: algorithm that finds that least cost path
Asst.Prof.Dr.Mohmed Shujaa 4-161
Lecture XI

LS. Algorithem

Asst.Prof.Dr.Mohmed Shujaa 162


A Link-State Routing Algorithm
(Dynamic Algorithm)

Dijkstra’s algorithm
• net topology, link costs known notation:
to all nodes
• c(x,y): link cost from
– accomplished via “link state node x to y; = ∞ if not
broadcast” direct neighbors
– all nodes have same info • D(v): current value of
• computes least cost paths from cost of path from source to
one node (‘source”) to all dest. v
other nodes • p(v): predecessor node
– gives forwarding table for along path from source to
that node v
• iterative: after k iterations, • N': set of nodes whose
know least cost path to k dest.’s least cost path definitively
known
Asst.Prof.Dr.Mohmed Shujaa 4-163
Link State Routing
1. Discover neighbors, learn network addresses.
2. Set distance/cost metric to each neighbor.
3. Construct packet telling all learned.
4. Send packet to, receive packets from other routers.
5. Compute shortest path to every other router.

Asst.Prof.Dr.Mohmed Shujaa 164


Dijkstra’s algorithm: example
resulting shortest-path tree from u:

v w
u z
x y

resulting forwarding table in u:


destination link

v (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x) Asst.Prof.Dr.Mohmed Shujaa 4-165
Dijkstra’s algorithm: example
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz

5
v 3 w
u 2 5z
2 3 1
1 x y 2
1 Asst.Prof.Dr.Mohmed Shujaa 4-166
Dijkstra’s algorithm, discussion
algorithm complexity: n nodes
 each iteration: need to check all nodes, w, not in N
 n(n+1)/2 comparisons
oscillations possible:
 e.g., support link cost equals amount of carried traffic:
given these costs, find new routing resulting in new costs

1
A 1+e A A A
2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0
C 0 1 1+e 0
C C C
1 1
e
initially
Asst.Prof.Dr.Mohmed Shujaa 4-167
Building Link State Packets

(a) A network. (b) The link state packets for this network.
Asst.Prof.Dr.Mohmed Shujaa 168
Lecture XII

D.V. Algorithm

Asst.Prof.Dr.Mohmed Shujaa 169


Distance Vector Routing algorithm
• Distance Vector routing is intra-domain protocols,
inside Autonomous system, but not between Autonomous
system.( inside one region)
• distance-vector routing are based on the least-cost goal.
• Distance Vector developed by Bellman-Ford algorithm.
• Bellman equation is used to find the least cost (shortest
distance) between a source to destination.
• Base on RIP protocol.

Asst.Prof.Dr.Mohmed Shujaa 170


How Does D.V Works
• A distance vector routing algorithm operates by
having each router maintain a table (i.e., a vector)
giving the best known distance to each destination
and which link to use to get there.

• These tables are updated by exchanging information


with the neighbors router. Every router knows the
best link to reach each destination.
Asst.Prof.Dr.Mohmed Shujaa 171
Distance vector algorithm
Bellman-Ford equation (dynamic programming)
let
dx(y) := cost of least-cost path from x to y
Then
dx(y) = min {c(x,v) + dv(y) }
v
cost from neighbor v to destination y
cost to neighbor v
min taken over all neighbors v of x
Note: v,x are the neighbors' of source

Asst.Prof.Dr.Mohmed Shujaa 4-172


Distance vector algorithm
key idea:
 from time-to-time, each node sends its own distance vector
estimate to neighbors
 when x receives new DV estimate from neighbor, it
updates its own DV using B-F equation:

Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

 under minor, natural conditions, the estimate Dx(y)


converge to the actual least cost dx(y)

Asst.Prof.Dr.Mohmed Shujaa 4-173


Bellman-Ford example
clearly Distance V of sources to destination
5 dv(z) = 5, dx(z) = 3, dw(z) = 3
v 3 w ( neighbors' of source)
u 2 5z then B-F equation says:
2 3 1 du(z) = min { c(u,v) + dv(z),
1 x y 2 c(u,x) + dx(z),
1 c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
node achieving minimum is next
hop in shortest path, used in forwarding table
Asst.Prof.Dr.Mohmed Shujaa 4-174
Distance vector algorithm

Asst.Prof.Dr.Mohmed Shujaa 175


Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to cost to
table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3

from
from

y ∞ ∞ ∞ y 2 0 1

from
y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0
node y cost to cost to cost to
table x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
from

from

y 2 0 1 y 7

from
2 0 1 y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0

node z cost to cost to cost to


table x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
from

from
from

y y 2 0 1 y 2 0 1
∞ ∞ ∞
z z 3 1 0 z 3 1 0
7 1 0
time

Asst.Prof.Dr.Mohmed Shujaa 4-176


Asst.Prof.Dr.Mohmed Shujaa Technical college of
Electrical Eng.
Asst.Prof.Dr.Mohmed Shujaa Technical college of
Electrical Eng.
Asst.Prof.Dr.Mohmed Shujaa Technical college of
Electrical Eng.
Asst.Prof.Dr.Mohmed Shujaa Technical college of
Electrical Eng.
Asst.Prof.Dr.Mohmed Shujaa 181
Asst.Prof.Dr.Mohmed
Shujaa
182
Comparison of LS and DV algorithms
message complexity Robustness (Failure): what
• LS: with n nodes, E links, O(nE) happens if router malfunctions?
msgs sent LS:
• DV: exchange between neighbors – node can advertise incorrect
only link cost
– convergence time varies – each node computes only its
own table
speed of convergence DV:
• LS: O(n2)
algorithm requires
– DV node can advertise
O(nE) msgs
incorrect path cost
– may have oscillations
– each node’s table used by
• DV: convergence time varies others
– may be routing loops – error propagate thru network
– count-to-infinity problem
Asst.Prof.Dr.Mohmed Shujaa 4-183
Lecture XIII

Hieratical routing Algorithm

Asst.Prof.Dr.Mohmed Shujaa 184


Hierarchical Routing
• As networks grow in size, the router routing
tables grow proportionally.
• Not only the router memory consumed by
ever-increasing tables, but more CPU time
is needed to scan them and more bandwidth
is needed to send status reports about them.
• So router can not have table about the entire
network.

Asst.Prof.Dr.Mohmed Shujaa 185


Hierarchical Routing
• When hierarchical routing is used, the routers
are divided into what we will call regions.

• Each router knows all the details about how to


route packets to destinations within its own
region but knows nothing about the internal
structure of other regions.(ie EGRP protocol IGRP)
Asst.Prof.Dr.Mohmed Shujaa 186
Hierarchical routing
• routers into regions,
“autonomous systems” (AS)
• routers in same AS run same
routing protocol called: IGBP
( Interior Gate Way Protocol)
• routers in different AS can run
different intra-AS routing protocol
called:EGBP ( Exterior Gate Way
Protocol.)
this will be studied next lecture.

Asst.Prof.Dr.Mohmed Shujaa 4-187


Inter-AS tasks Example:
 suppose router in AS1 AS1 must:
receives datagram 1. learn which dests are
destined outside of AS1: reachable through
 router should forward AS2,and which through
packet to gateway AS3
router, but which one? 2. propagate this reach
ability info to all routers
in AS1
3c job of inter-AS routing!
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Asst.Prof.Dr.Mohmed Shujaa 4-188
Hierarchical routing.

189
Asst.Prof.Dr.Mohmed
Shujaa
Lecture XIV

Network Protocols

Asst.Prof.Dr.Mohmed Shujaa 190


RIP ( Routing Information Protocol)
• It is a very simple protocol based on distance vector routing.
• distance vector algorithm
– distance metric: # hops (max = 15 hops), each link has cost 1
– DVs exchanged with neighbors every 30 sec in response message (aka
advertisement)
– each advertisement: list of up to 25 destination subnets (in IP addressing
sense)
from router A to destination subnets:
u v subnet hops
A B w u 1
v 2
z x w 2
C D x 3
y y 3
Asst.Prof.Dr.Mohmed Shujaa z 2 4-191
RIP Characteristics
• Distance vector routing protocol.

• Uses hop count as a path selection metric.

• Three types of timers.

• Multiple stability features.

Asst.Prof.Dr.Mohmed Shujaa 192


Timers in RIP

Asst.Prof.Dr.Mohmed Shujaa 193


Rip timer
• The periodic timer controls the advertising of regular update

messages.

• Expiration Timer if there is a problem on an internet and no update

is received within the allotted 180 s, the route is considered expired

and the hop count of the route is set to 16, which means the

destination is unreachable.( Because 15 hop max)

• Garbage Collection Timer When the information about a route

becomes invalid.

Asst.Prof.Dr.Mohmed Shujaa 194


Hop Count -- 15 Hop Limit

Note: After 15 hop the


destination unreachable

195 Asst.Prof.Dr.Mohmed Shujaa


RIP: example

z
w x y
A D B

C
routing table in router D
destination subnet next router # hops to dest
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Asst.Prof.Dr.Mohmed Shujaa 4-196
RIP: example

z
w x y
A D B

C
routing table in router D
destination subnet next router # hops to dest
w A 2
y B 2
A 5
z B 7
x -- 1
…. …. ....
Asst.Prof.Dr.Mohmed Shujaa 4-197
OSPF (Open Shortest Path First)
• “open”: publicly available
• uses link state algorithm
– LS packet dissemination
– topology map at each node
– route computation using Dijkstra’s algorithm
• OSPF advertisement carries one entry per neighbor
• advertisements flooded to entire AS
– carried in OSPF messages directly over IP (rather than TCP
or UDP
• security: all OSPF messages authenticated (to prevent
malicious intrusion)
• multiple same-cost paths allowed (only one path in RIP)
Asst.Prof.Dr.Mohmed Shujaa 4-198
Hierarchical OSPF
boundary router
backbone router

backbone
area
border
routers

area 3
internal
routers
area 1
area 2
Asst.Prof.Dr.Mohmed Shujaa 4-199
Hierarchical OSPF
• two-level hierarchy: local area, backbone.
– link-state advertisements only in area
– each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.
• area border routers: “summarize” distances to nets
in own area, advertise to other Area Border routers.
• backbone routers: run OSPF routing limited to
backbone.
• boundary routers: connect to other AS’s.

Asst.Prof.Dr.Mohmed Shujaa 4-200


OSPF—An Interior Gateway
Routing Protocol

An autonomous system
Asst.Prof.Dr.Mohmed Shujaa 201
OSPF—An Interior Gateway
Routing Protocol

The relation between ASes, backbones, and


Asst.Prof.Dr.Mohmed Shujaa 202
areas in OSPF.
OSPF—An Interior Gateway
Routing Protocol

The five types of OSPF messages


Asst.Prof.Dr.Mohmed Shujaa 203
Lecture XV
protocols

Asst.Prof.Dr.Mohmed Shujaa 204


Internet inter-AS routing: BGP

• BGP (Border Gateway Protocol): inter-domain routing


protocol
– “ holds the Internet together”
• BGP provides :
– eBGP: obtain subnet reach ability information from
neighboring ASs.
– iBGP: propagate reach ability information to all AS-
internal routers.
• allows subnet to advertise its existence to rest of Internet:

Asst.Prof.Dr.Mohmed Shujaa 4-205


BGP basics
 BGP session: two BGP routers (“peers”) exchange BGP
messages:
 advertising paths to different destination network prefixes (“path vector”
protocol)
 exchanged over semi-permanent TCP connections

• The IBGP used to connect different routers have same AS(same company)
• The EBGP used to connect different routers have different AS(different company)

3c
BGP
3a message
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Asst.Prof.Dr.Mohmed Shujaa 4-206
BGP basics: distributing path information
 using eBGP session between 3a and 1c, AS3 sends prefix
reachability info to AS1.
 1c can then use iBGP do distribute new prefix info to all routers in
AS1
 1b can then re-advertise new reachability info to AS2 over 1b-to-
2a eBGP session
 when router learns of new prefix, it creates entry for prefix
in its forwarding table.

eBGP session
3a iBGP session
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Asst.Prof.Dr.Mohmed Shujaa 4-207
BGP messages

• BGP messages exchanged between peers over TCP connection


• BGP messages:
– OPEN: opens TCP connection to peer and
authenticates sender
– UPDATE: advertises new path (or withdraws old)
– KEEP ALIVE: keeps connection alive in absence
of UPDATES; also ACKs OPEN request
– NOTIFICATION: reports errors in previous msg;
also used to close connection

Asst.Prof.Dr.Mohmed Shujaa 4-208


DHCP &IP addresses: how to get one
Q: How does a host get IP address?
• hard-coded by system admin in a file
– Windows: control-panel->network-
>configuration->tcp/ip->properties
– UNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol:
dynamically get address from as server
– “plug-and-play”

Asst.Prof.Dr.Mohmed Shujaa 4-209


DHCP: Dynamic Host Configuration Protocol
goal: allow host to dynamically obtain its IP address from
network server when it joins network
DHCP overview: (pool operation)
– 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

Asst.Prof.Dr.Mohmed Shujaa 4-210


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
DHCP yiaddr:
server 0.0.0.0
out there?

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP server!
dest: 255.255.255.255, 68
Here’s an IP address
yiaddrr: you can
223.1.2.4
use ID: 654
transaction
lifetime:
DHCP request
src: 0.0.0.0, 68
Broadcast: OK. I’ll take
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
that IP address!
transaction ID: 655
lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
Broadcast: OK. You’ve
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
gottransaction
that IPID:address!
655
lifetime: 3600 secs
Asst.Prof.Dr.Mohmed Shujaa 4-211
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

Asst.Prof.Dr.Mohmed Shujaa 4-212


DHCP: example • DCP server formulates
DHCP ACK containing
DHCP DHCP client’s IP address, IP
DHCP UDP address of first-hop
DHCP IP router for client, name &
DHCP Eth
Phy IP address of DNS server

 encapsulation of DHCP
DHCP DHCP server, frame forwarded
DHCP UDP to client, demuxing up to
DHCP IP DHCP at client
DHCP Eth router with DHCP
DHCP
Phy server built into  client now knows its IP
router address, name and IP
address of DNS server, IP
address of its first-hop
router

Asst.Prof.Dr.Mohmed Shujaa 4-213


ICMP: internet control message protocol
• used by hosts & routers to Type Code description
communicate network- 0 0 echo reply (ping)
level information 3 0 dest. network unreachable
– error reporting: unreachable 3 1 dest host unreachable
host, network, port, 3 2 dest protocol unreachable
protocol 3 3 dest port unreachable
3 6 dest network unknown
– echo request/reply (used by
3 7 dest host unknown
ping)
4 0 source quench (congestion
– ICMP msgs carried in IP control - not used)
datagrams 8 0 echo request (ping)
• ICMP message: type, code 9 0 route advertisement
plus first 8 bytes of IP 10 0 router discovery
11 0 TTL expired
datagram causing error 12 0 bad IP header

Asst.Prof.Dr.Mohmed Shujaa 4-214


ICMP Applications

 PING: The ping checks whether a host is alive & reachable or


not. This is done by sending an ICMP Echo Request packet to the host,
and waiting for an ICMP Echo Reply from the host.

 TRACE ROUTE: Trace route is a used to records the route

through the Internet between your computer and a specified

destination computer. It also calculates and displays the amount of

time each hop took.

Asst.Prof.Dr.Mohmed Shujaa 215


Trace route and ICMP
 source sends series of UDP  when ICMP messages
segments to dest arrives, source records
 first set has TTL =1 RTTs
 second set has TTL=2, etc. stopping criteria:
 unlikely port number  UDP segment eventually
 when nth set of datagrams arrives at destination host
arrives to nth router:  destination returns ICMP
 router discards datagrams “port unreachable”
 and sends source ICMP message (type 3, code 3)
messages (type 11, code 0)  source stops

 ICMP messages includes


name of router & IP address
3 probes 3 probes

3 probes Asst.Prof.Dr.Mohmed Shujaa 4-216


ICMP
• ICMP messages carried on IP packet.

Asst.Prof.Dr.Mohmed Shujaa 217


Lecture XVI
IP Protocols

Asst.Prof.Dr.Mohmed Shujaa 218


IPV4 datagram format

Asst.Prof.Dr.Mohmed Shujaa 219


IPV4 datagram format

• Version: The 4-bit field defines the version of


the ipv4 protocol.

• Header Length : 4-bit field defines total


length of datagram header in 4-bit words
When the option filed is at the maximum size
,the value of this filed is 15 ⇒HLEN=60 .

Asst.Prof.Dr.Mohmed Shujaa 220


IPV4 datagram format
Total Length
• 16-bit field defines total datagram length in bytes,
including header .
• 16 bits ⇒ maximum size = 65,535 bytes (class
depends)
• some physical networks are not able to encapsulate a
datagram of 65,535 bytes, so datagram must be
fragmented to be able to pass through those networks.

Asst.Prof.Dr.Mohmed Shujaa 221


IPV4 datagram format
• Identification :16-bit field – uniquely identifies
datagram originating from source host.

• N.B. when datagram is fragmented identification field is


copied into all fragments.

Asst.Prof.Dr.Mohmed Shujaa 222


IPV4 datagram format
Flags :
• 3-bit field .
• 1st bit is reserved .
• 2nd bit is called “do not fragment” bit , if its
value is 1, machine must NOT fragment
datagram , if its value is 0,the datagram can be
fragment if necessary.
• 3rd bit is called “more fragment” bit ,if its value is 1,
datagram is not last fragment – there are more
fragments after this one , if its value is 0, this is last or
only fragment.
Asst.Prof.Dr.Mohmed Shujaa 223
IP fragmentation,
• network links have MTU
(max transfer unit (size) -
largest possible link-level fragmentation:


in: one large datagram
frame out: 3 smaller datagrams
• large IP datagram divided
(“fragmented”) within net
– IP header bits used to reassembly
identify, order related
fragments

Asst.Prof.Dr.Mohmed Shujaa 4-224


IP fragmentation, reassembly
length ID Flag flag offset
example: =4000 =x =0 =0

 4000 byte datagram


one large datagram becomes
 MTU = 1500 bytes
several smaller datagram's

1480 bytes in length ID Flag flag offset


data field =1500 =x =1 =0

offset = length ID Flag flag offset


1480/8 =1500 =x =1 =185

length ID Frag flag offset


=1040 =x =0 =370

Asst.Prof.Dr.Mohmed Shujaa 4-225


Fragment Bytes ID Offset Flag
1st fragment 1,480 bytes in
the data field of
the IP datagram
identification 777 offset 0 (meaning the data should be inserted beginning at byte 0)
2nd fragment 1,480 bytes
of data
identification 777 offset 185 (meaning the data should be inserted beginning at byte 1,480. Note
that 185 · 8 1,480)
3rd fragment 1,020 bytes
( 3,980–1,480–1,480) of data
identification 777 offset 370 (meaning the data should be inserted beginning at byte 2,960. Note
that 370 · 8 2,960)
flag 1 (meaning there is more)
flag 1 (meaning there is more)
flag 0 (meaning this is the last fragment)

Asst.Prof.Dr.Mohmed Shujaa 226


IPV4 datagram format

Time-To-Live protocol (TTL) :


• 8-bit field controls max number of hops visited by
datagram and/or time spend in the network .

• field is decremented by one each time datagram is


processed by a router – when TTL reaches 0,
datagram must be dropped .

Asst.Prof.Dr.Mohmed Shujaa 227


IPV4 datagram format
– Protocol : 8-bit Identifies the higher-level
protocol.
– protocol number is glue that binds network &
transport layer, while port number is glue that
binds transport & application layer.
– values: 1 = ICMP , 2 = IGMP , 6 = TCP ,
– 17 = UDP , 89 = OSPF.
– Header Checksum : 16-bit field – aids in
detecting errors in header only .

Asst.Prof.Dr.Mohmed Shujaa 228


IPV4 datagram format
• Source and Destination IP Addresses : 32-bit
fields must remain unchanged until IP datagram
reaches its final destination.

• Options : 32-bit field(s) not required for every


datagram allows expansion of IP header .

Asst.Prof.Dr.Mohmed Shujaa 229


IP Security (IPSec) protocol

• IP Security (IPSec) is a collection of

protocols to provide security for a packet at

the network level.

Asst.Prof.Dr.Mohmed Shujaa 230


IPSec protocol mode
IP Security operates in one of two different modes:
the transport mode or tunnel mode.
.

Transport Mode

Router Router

Tunnel Mode

Asst.Prof.Dr.Mohmed Shujaa 231


Lecture XVII

IP protocols

Asst.Prof.Dr.Mohmed Shujaa 232


IPv6
• initial motivation: 32-bit IPv4 address space soon
to be completely allocated.
• additional motivation:
– header format -speed processing/forwarding
– header changes to facilitate QoS, billions of hosts
– checksum: removed entirely to reduce processing time at
each hop, Reduce routing table size
– Aid multicasting
IPv6 datagram format:
– fixed-length 40 byte header
– no fragmentation allowed
Asst.Prof.Dr.Mohmed Shujaa 4-233
IPv6 datagram format
Priority or Diff.serv: identify priority among datagram in flow
flow Label: identify datagram in same “flow.”
next header: identify upper layer protocol for data
Source add: 16byte = 128 bit
Destination add: 128 bit

Asst.Prof.Dr.Mohmed 4-234
Shujaa
IP Version 6
IPV6 is written in hexadecimal and
consists of 8 groups, consists 4 hex digits

Asst.Prof.Dr.Mohmed Shujaa 235


IPv6

Asst.Prof.Dr.Mohmed Shujaa 236


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 ICMP protocol
table • error reporting
• router “signaling”

Data link layer


physical layer

Asst.Prof.Dr.Mohmed Shujaa 4-237


Switches vs. routers
both are store-and-forward:
 routers: network-layer devices (examine network-layer
headers)
 switches: link-layer devices (examine link-layer headers)
both have forwarding tables:
 routers: compute tables using routing algorithms, IP
addresses
 switches: learn forwarding table using flooding, learning,
MAC addresses

Asst.Prof.Dr.Mohmed Shujaa 5-238


Lecture XVIII

Transport Protocols

Asst.Prof.Dr.Mohmed Shujaa 239

You might also like