The Routing &the IP
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
application
transportnetworkdata linkphysical
The network layer moves transport layer segments from host to host in the network, to deliver them to their destination. This layer involves each and every host and router in the network.
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
Network layer functions
transport packet from sending to receiving hosts
network layer protocols in every host, router
three important functions: path determination: route
taken by packets from source to destination - routing algorithms
switching: move packets from router’s input to appropriate router output
call setup: some network architectures require router call setup along path before data flows (connection oriented networks)
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
Datagram networks: the Internet model no call setup at network layer routers: do not maintain state for the end-to-end
connections no network-level concept of a “connection”
packets are typically routed using only destination host ID which is carried in the packet packets between same source-destination pair may take
different paths
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Send data 2. Receive data
Routing
Graph abstraction for routing algorithms:
graph nodes are routers
graph edges are physical links link cost: delay,
distance, # of hops, rate structure or congestion level = $$
Other costs??
Goal: determine a “good” path
(sequence of routers) thru the network from the
source to the destination
Routing protocol
A
ED
CB
F
2
2
13
1
1
2
53
5
“good” path: typically means
minimum cost path other definitions also
possible
Hierarchical Routing
scale: with 55 million+ destination hosts:
can’t store all destinations in routing tables!
routing table exchange would swamp links!
administrative autonomy
internet = network of networks
each network admin may want to control routing in its own network
Our routing study thus far – an idealization
all routers are identical the network is “flat”
… not true in practice
Why?
Hierarchical Architecture of the Internet
Legend
router
border router
connection
host
LAN
intra domain network (AS)
inter AS network
Inter-AS level
Intra Domainlevel (AS)
LAN level
Hierarchical Routing
aggregate routers into regions, called “autonomous systems” (AS)
routers in same AS run same routing protocol “intra-AS” routing
protocol routers in different AS
can run different intra-AS routing protocol
special routers in AS run intra-AS routing
protocol with all other routers in AS
also responsible for routing to destinations outside AS run inter-AS routing
protocol with other gateway routers
gateway routers
Internet AS HierarchyInter-AS border (exterior gateway) routers
Intra-AS interior (gateway) routers
Internet inter-AS routing: BGP
BGP (Border Gateway Protocol): the de facto standard
Path Vector protocol: similar to Distance Vector protocol each Border Gateway broadcasts to
neighbors (peers) the entire path (I.e, sequence of ASs) to destination
Intra-AS and Inter-AS routing
Gateways:• perform inter-AS
routing amongst themselves
• perform intra-AS routers with other routers in their AS
inter-AS, intra-AS routing in
gateway A.c
network layer
data link layerphysical layer
a
b
b
aaC
A
Bd
A.a
A.c
C.bB.a
cb
c
Intra-AS and Inter-AS routing
Host h2
a
b
b
aaC
A
Bd c
A.a
A.c
C.bB.a
cb
Hosth1
Intra-AS routingwithin AS A
Inter-AS routingbetween A and B
Intra-AS routingwithin AS B
We’ll examine specific inter-AS and intra-AS Internet routing protocols shortly
IP Addressing: introduction IP address: 32-bit
identifier for host or router interface
interface: connection between host or router and the physical link routers typically
have multiple interfaces
hosts typically have only one
IP addresses are associated with the interface, not the host or the router
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 11
dotted-decimal notation:
IP Addressing IP address:
network part (high order bits)
host part (low order bits)
What’s a network ? (from the IP address perspective) device interfaces
with the same network part of their IP address
hosts can physically reach each other without an intervening router
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
Example: network consisting of 3 IP networks (for IP addresses starting with 223, the first 24 bits are the network address – more later)
LAN
IP Addresses
1.0.0.0 to127.255.255.255
128.0.0.0 to191.255.255.255
192.0.0.0 to223.255.255.255
224.0.0.0 to239.255.255.255
32 bits
Given the notion of a “network”, let’s look closer at IP addresses:
“classful” addressing -
What is the address space size (number of hosts) for each class?
0network
10 network host (16 bits)
110 network host (8 bits)
1110 multicast address (28 bits)
A
B
C
D
class
host (24 bits)27 = 127 networks 224 = 16.8 million+ hosts
214 = 16,384 networks 216 = 65,536 hosts
221 = 2 million+ networks 28 = 256 hosts
228 = 268.4 million+ hosts
Map ofthe Internet
The minimum & maximum values of the range: 11100000.00000000.00000000.000000002
11101111.11111111.11111111.111111112
E0.00.00.0016 … EF.FF.FF.FF16
The first part of the abbreviation is the common byte(s) in the range
The second part of the abbreviation is the number of bits, which are common for the all members of the range
Abbreviated Format of the Address Ranges
224/4224.0.0.0 - 239.255.255.255
The private address ranges
Name Start of the range End of the range Subnet mask
Class A 10.0.0.0 10.255.255.255 255.0.0.0
Class B 172.16.0.0 172.31.255.255 255.255.0.0
Class C 192.168.0.0 192.168.255.255 255.255.255.0
Used locally Never used in the Internet Gateways do not forward the packets
addressed to private addresses The network, which uses the private
address range can be connected to the Internet by the NAT (Network Address Translation)
IP addressing: CIDR classful addressing:
inefficient use of address space, address space exhaustion
e.g., class B network is allocated enough addresses for 65K hosts, even if only 2K hosts exist in that network
CIDR: Classless InterDomain Routing network portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in the
network portion of an address
11001000 00010111 00010000 00000000
networkpart
hostpart
200.23.16.0/23
IP addresses: how to get one?
Hosts (host portion): hard-coded by system admin in a file DHCP: Dynamic Host Configuration
Protocol: dynamically get address (RFC 2131): “plug-and-play” host broadcasts “DHCP discover” msg DHCP server responds with “DHCP offer” msg host requests IP address: “DHCP request”
msg DHCP server sends address: “DHCP ack” msg
Why different Intra- and Inter-AS routing ?
Policy: Inter-AS: admin wants control over how its traffic
is routed, who routes through its net. Intra-AS: single admin, so no policy decisions
needed
Scale: hierarchical routing saves table size, reduces
update traffic
Performance: Intra-AS: can focus on performance Inter-AS: policy may dominate over performance
Intra-AS Routing
Also known as Interior Gateway Protocols (IGP) Most common IGPs:
RIP: Routing Information Protocol (legacy)
OSPF: Open Shortest Path First (common)
EIGRP: Enhanced Interior Gateway Routing Protocol (proprietary – Cisco Systems)
Distance-vector routing algorithm (DVR)
The different names of the background mathematical algorithm: Backward search algorithm Bellman-Ford algorithm
Goal: search the smallest delay paths for the traffic
For this reason in each router a table is created, which contains: The interface to the smallest delay path to every
node The estimated delay of each path
This table is called distance vector
Legend
router
physical link
1 2 5
4
3 1
1 6
4
D
A
B
C
F E
G
1
1
The link state tables of an example network
A B C D E F G
A 0 2 5 1
B 2 0 4
C 5 4 0 3 1 6 1
D 1 3 0 1
E 1 1 0 4
F 6 4 0 1
G 1 1 0
Routing tables (Step 1)
Modified entry
Unmodified entry
Router A B C D E F G
Destination CA,j Interface CB,j
Interface CC,j
Interface CD,j
Interface CE,j
Interface CF,j
Interface CG,j
Interface
A 2 A 5 A 1 A - - -
B 2 B 4 B - - - -
C 5 C 4 C 3 C 1 C 6 C 1 C
D 1 D - 3 D 1 D - -
E - - 1 E 1 E 4 E -
F - - 6 F - 4 F 1 F
G - - 1 G - - 1 G
Distance vector
Bellman-Ford algorithm
Legend
Router
Physical link
Temporarily step of the algorithm
Least cost path
CA,G =
CA,B=2
CA,D=1
CA,C =5
D
A
B C
h=1
F E
G CA,F=
CA,E=
Step 1
h CA,B Path CA,C Path CA,D Path CA,E Path CA,F Path CA,G Path
0 - - - - - -
1 2 A-B 5 A-C 1 A-D - - -
2 2 A-B 4 A-D-C 1 A-D 2 A-D-E 11 A-C-F 6 A-C-G
3 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 6 A-D-E-F 5 A-D-C-G
4 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E C-G-F 4 A-D-E-C-
G
5 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E-C-G-F 4 A-D-E-C-
G
Shortest paths in the routing table of
the router A
Bellman-Ford algorithm
Router A B C D E F G
Destination CA,j Path CB,j Path CC,j Path CD,j Path CE,j Path CF,j Path CG,j Path
A 2 A 4 D 1 A 2 D 11 C 6 C
B 2 B 4 B 3 A 5 C 10 C 5 C
C 4 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 5 E 4 C
E 2 D 5 C 1 E 1 E 4 E 2 C
F 11 C 10 C 5 E 5 E 4 F 1 F
G 6 C 5 C 1 G 4 C 2 C 1 G
Routing tables (Step 2)
Routing tables resulted from the previous
step
Bellman-Ford algorithm
Router A B C D E F G
Destination CA,j Interface CB,j
Interface CC,j
Interface CD,j
Interface CE,j
Interface CF,j
Interface CG,j
Interface
A 2 A 5 A 1 A - - -
B 2 B 4 B - - - -
C 5 C 4 C 3 C 1 C 6 C 1 C
D 1 D - 3 D 1 D - -
E - - 1 E 1 E 4 E -
F - - 6 F - 4 F 1 F
G - - 1 G - - 1 G
CA,F=11
E
CA,B=2
CA,D=1
CA,G =6
CA,E=2
D
A
B C
h=2
F G
CA,C =4
Step 2Bellman-Ford algorithm
Shortest paths in the routing table of
the router A
h CA,B Path CA,C Path CA,D Path CA,E Path CA,F Path CA,G Path
0 - - - - - -
1 2 A-B 5 A-C 1 A-D - - -
2 2 A-B 4 A-D-C 1 A-D 2 A-D-E 11 A-C-F 6 A-C-G
3 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 6 A-D-E-F 5 A-D-C-G
4 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E C-G-F 4 A-D-E-C-
G
5 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E-C-G-F 4 A-D-E-C-
G
Router A B C D E F G
Destination CA,j Path CB,j Path CC,j Path CD,j Path CE,j Path CF,j Path CG,j Path
A 2 A 3 E 1 A 2 D 6 G 5 C
B 2 B 4 B 3 A 4 D 6 G 5 C
C 3 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 4 G 3 C
E 2 D 4 A 1 E 1 E 3 G 2 C
F 6 D 9 C 2 G 5 E 3 C 1 F
G 5 D 5 C 1 G 3 E 2 C 1 G
Routing tables (Step 3)Bellman-Ford algorithm
Routing tables resulted from the previous
step
Router A B C D E F G
Destination CA,j Path CB,j Path CC,j Path CD,j Path CE,j Path CF,j Path CG,j Path
A 2 A 4 D 1 A 2 D 11 C 6 C
B 2 B 4 B 3 A 5 C 10 C 5 C
C 4 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 5 E 4 C
E 2 D 5 C 1 E 1 E 4 E 2 C
F 11 C 10 C 5 E 5 E 4 F 1 F
G 6 C 5 C 1 G 4 C 2 C 1 G
Router A B C D E F G
Destination CA,j Path CB,j Path CC,j Path CD,j Path CE,j Path CF,j Path CG,j Path
A 2 A 3 E 1 A 2 D 5 G 4 C
B 2 B 4 B 3 A 4 D 6 G 5 C
C 3 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 4 G 3 C
E 2 D 4 A 1 E 1 E 3 G 2 C
F 5 D 6 C 2 G 4 E 3 C 1 F
G 4 D 5 C 1 G 3 E 2 C 1 G
Routing tables (Step 4)Bellman-Ford algorithm
Routing tables resulted from the previous
step
Router A B C D E F G
Destination CA,j Path CB,j Path CC,j Path CD,j Path CE,j Path CF,j Path CG,j Path
A 2 A 3 E 1 A 2 D 6 G 5 C
B 2 B 4 B 3 A 4 D 6 G 5 C
C 3 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 4 G 3 C
E 2 D 4 A 1 E 1 E 3 G 2 C
F 6 D 9 C 2 G 5 E 3 C 1 F
G 5 D 5 C 1 G 3 E 2 C 1 G
CA,C =5
E
CA,B =2
CA,D =1
CA,C =3
CA,E=2
CA,F =6
D
B
C
h=3
F G
A
CA,C =4 E
CA,B =2
CA,D =1
CA,C =3
CA,E=2 CA,F =5
D
B
C
h=4
F G
A
Step 3-4Bellman-Ford algorithm
Shortest paths in the routing table of
the router A
h CA,B Path CA,C Path CA,D Path CA,E Path CA,F Path CA,G Path
0 - - - - - -
1 2 A-B 5 A-C 1 A-D - - -
2 2 A-B 4 A-D-C 1 A-D 2 A-D-E 11 A-C-F 6 A-C-G
3 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 6 A-D-E-F 5 A-D-C-G
4 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E C-G-F 4 A-D-E-C-
G
5 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E-C-G-F 4 A-D-E-C-
G
Router A B C D E F G
Destination CA,j Interface CB,j
Interface CC,j
Interface CD,j
Interface CE,j
Interface CF,j
Interface CG,j
Interface
A 2 A 3 E 1 A 2 D 5 G 4 C
B 2 B 4 B 3 A 4 D 6 G 5 C
C 3 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 4 G 3 C
E 2 D 4 A 1 E 1 E 3 G 2 C
F 5 D 6 C 2 G 4 E 3 C 1 F
G 4 D 5 C 1 G 3 E 2 C 1 G
Routing tables (Step 5)Bellman-Ford algorithm
Routing tables resulted from the previous
step
Router A B C D E F G
Destination CA,j Path CB,j Path CC,j Path CD,j Path CE,j Path CF,j Path CG,j Path
A 2 A 3 E 1 A 2 D 5 G 4 C
B 2 B 4 B 3 A 4 D 6 G 5 C
C 3 D 4 C 2 E 1 C 2 G 1 C
D 1 D 3 A 2 E 1 D 4 G 3 C
E 2 D 4 A 1 E 1 E 3 G 2 C
F 5 D 6 C 2 G 4 E 3 C 1 F
G 4 D 5 C 1 G 3 E 2 C 1 G
G
E
CA,B =2
CA,D =1
CA,C =3
CA,E =2
CA,F =5
D
A
B
C
h=6
F CA,G =4 CA,G =4
E
CA,B =2
CA,D =1
CA,C =3
CA,E=2
CA,F =5
D
B
C
h=5
F G
A
Step 5 and the final resultBellman-Ford algorithm
Shortest paths in the routing table of
the router A
h CA,B Path CA,C Path CA,D Path CA,E Path CA,F Path CA,G Path
0 - - - - - -
1 2 A-B 5 A-C 1 A-D - - -
2 2 A-B 4 A-D-C 1 A-D 2 A-D-E 11 A-C-F 6 A-C-G
3 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 6 A-D-E-F 5 A-D-C-G
4 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E C-G-F 4 A-D-E-C-
G
5 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 5 A-D-E-C-G-F 4 A-D-E-C-
G
Link-state routing algorithm The different names of the background
mathematical algorithm: Forward search Dijkstra algorithm Shortest path (SP)
The SP is the optimal path, however, this is not obviously the geometrically shortest path
Other factor, which can be taken into account: Number of routers in the path delay cost Average traffic Reliability of the links in a certain path
Dijkstra’s algorithm
Dijkstra's algorithm, named after its inventor the Dutch computer scientist Edsger Dijkstra , solves a shortest path problem for a directed and connected graph G(V,E) which has nonnegative (>=0) edge weights
Dijkstra's algorithm is known to be a good algorithm to find a shortest path
The method…
Finds the shortest path between a source node and the rest
Finds routes between nodes by cost precedence
Assumes every cost is a positive number Supports directed or bidirectional
communication
Dijkstra’s algorithm
CA,D=1 CA,B=2
CA,C=5
D
A
B
C
M={A}
F E
G
Initialisation – Example network
Dijkstra’s algorithm
CA,D=1
CA,E=2
CA,B=2 CA,C=4
D
A
B
M={A,D}
C F
E G
Step 1Least cost new node: D
Node B C D E F G
Cost of the least cost path 2 5 1
Path A-B A-C A-D - - -
Node Expression Value Evaluation Resulted action
B CA,D+LD,B 1+= >2 No change
C CA,D+LD,C 1+3=4 4<5 New path
E CA,D+LD,E 1+1=2 2< New path
F CA,D+LD,F 1+= = No change
G CA,D+LD,G 1+= = No change
Dijkstra’s algorithm
CA,C=4
CA,D=1
CA,E=2
CA,B=2
D
A
B
M={A,B,D}
C
F E
G E
CA,C=3
CA,D=1
CA,E=2 CA,F=6
CA,B=2
D
A
B
M={A,B,D,E}
C
F
G
Step 2Node B C D E F G
Cost of the least cost path 2 4 1 2
Path A-B A-D-C A-D A-D-E - -
Node Expression Value Evaluation Resulted action
C CA,B+LB,C 2+4=6 6>4 No change
E CA,B+LB,E 2+= >2 No change
F CA,B+LB,F 2+= = No change
G CA,B+LB,G 2+= = No change
Dijkstra’s algorithm
Least cost new node (with smaller IP address) : B
CA,C=4
CA,D=1
CA,E=2
CA,B=2
D
A
B
M={A,B,D}
C
F E
G E
CA,C=3
CA,D=1
CA,E=2 CA,F=6
CA,B=2
D
A
B
M={A,B,D,E}
C
F
G
Step 3Node B C D E F G
Cost of the least cost path 2 4 1 2
Path A-B A-D-C A-D A-D-E - -
Node Expression Value Evaluation Resulted action
C CA,E+LE,C 2+1=3 3<4 New path
F CA,E+LE,F 2+4=6 6< New path
G CA,E+LE,G 2+= = No change
Dijkstra’s algorithm
Least cost new node: E
G E
CA,C=3
CA,D=1
CA,E=2 CA,F=4
CA,B=2
D
A
B
M={A,B,C,D,E,G}
C
F
E
CA,C=3 CA,D=1
CA,E=2 CA,F=4
CA,B=2
D
A
B
M={A,B,C,D,E}
C
F
G
Step 4Node B C D E F G
Cost of the least cost path 2 3 1 2 6
Path A-B A-D-E-C A-D A-D-E A-D-E-F -
Node Expression Value Evaluation Resulted action
F CA,C+LC,F 3+6=9 9>6 No change
G CA,C+LC,G 3+1=4 4< New path
Dijkstra’s algorithm
Least cost new node: C
Least cost new node: G
Node B C D E F G
Cost of the least cost path 2 3 1 2 6 4
Path A-B A-D-E-C A-D A-D-E A-D-E-F A-D-E-C-G
Step 5
G E
CA,C=3
CA,D=1
CA,E=2 CA,F=4
CA,B=2
D
A
B
M={A,B,C,D,E,G}
C
F
E
CA,C=3 CA,D=1
CA,E=2 CA,F=4
CA,B=2
D
A
B
M={A,B,C,D,E}
C
F
G
Node Expression Value Evaluation Resulted action
F CA,G+LF,G 4+1=5 5<6 New path
Dijkstra’s algorithm
G E
CA,C=3
CA,D=1
CA,E=2 CA,F=4
CA,B=2
D
A
B
M={A,B,C,D,E,F,G}
C
F
Step 6 (final result)Node B C D E F G
Cost of the least cost path
2 3 1 2 5 4
Path A-B A-D-E-C A-D A-D-E A-D-E-C-G-F A-D-E-C-G
Dijkstra’s algorithm
Second exampleStep 1
Dijkstra’s algorithm
Dijkstra’s algorithmSecond exampleStep 2
Dijkstra’s algorithmSecond exampleStep 3
Dijkstra’s algorithmSecond exampleStep 4
Dijkstra’s algorithmSecond exampleStep 5
Dijkstra’s algorithmSecond exampleStep 6
Dijkstra’s algorithmSecond exampleStep 7
Dijkstra’s algorithmSecond exampleStep 8
Dijkstra’s algorithmSecond exampleStep 9
Dijkstra’s algorithmSecond exampleStep 10
Dijkstra’s algorithmSecond exampleStep 11
Dijkstra’s algorithmSecond exampleStep 12
Differences between the forward and the backward search algorithms
Forward search (Dijkstra algorithm) It increases the scope of the search in each
step with including new node Backward search (Bellman-Ford
algorithm) It increases the scope of the search in each
step with including new hop
Comparison of the distance-vector and the link-state algorithms
Distance vector: Each router sends distance-vector, but to its neighbours The distance-vector contains the estimated distance to all
other nodes Older method Problem of the ”count-to-infinity” due to the fact, that the bad
news are distributed too slowly Link-state:
Each router sends link-state distance-vector to all others The link-state distance-vector contains the distance to the
neighbours, only The distance value to the neighbour (called link-state) is
accurate Recent method