slide 1 2008/2009comm3380 brief review of last lecture routing algorithms –distance vector e.g....
TRANSCRIPT
2008/2009 COMM3380 Slide 1
Brief Review of Last Lecture
• Routing Algorithms– Distance vector
• e.g. RIP
– Link State / Shortest Path First• e.g. OSPF
2008/2009 COMM3380 Slide 2
Routing AlgorithmsDistance Vector Routing • Each node knows the distance (=cost) to its directly connected
neighbours• A node sends periodically a list of routing updates to its
neighbours.• If all nodes update their distances, the routing tables eventually
converge• New nodes advertise themselves to their neighbours
Link State Routing • Each node knows the distance to its neighbours• The distance information (=link state) is broadcast to all nodes
in the network• Each node calculates the routing tables independently
2008/2009 COMM3380 Slide 3
Bellman-FordAlgorithm
Hops dA(B) Vector
(Next Hop)
dA(C) Vector
(Next Hop)
dA(D) Vector
(Next Hop)
dA(E) Vector
(Next Hop)
dA(F) Vector
(Next Hop)
0 ∞ -- ∞ -- ∞ -- ∞ -- ∞ --
1 2 B 5 C 1 D ∞ -- ∞ --
2 2 B 4 D 1 D 2 D 10 C
3 2 B 3 D 1 D 2 D 4 D
4 2 B 3 D 1 D 2 D 4 D
A
B
D E
C
F
2
53
2 3
1
1
2
5
1
dx(y) = min { c(x,v) + dv(y) }
2008/2009 COMM3380 Slide 4
Dijsktra’sAlgorithm
A
B
D E
Step N’ D(B), path D(C), path D(D), path D(E), path D(F), path
0 A 2, A-B 5, A-C 1, A-D ∞ -- ∞ --
1 A,D 2, A-B 4, A-D-C 1, A-D 2, A-D-E ∞ --
2 A,B,D 2, A-B 4, A-D-C 1, A-D 2, A-D-E ∞ --
3 A,B,D,E 2, A-B 3, A-D-E-C 1, A-D 2, A-D-E 4, A-D-E-F
4 A,B,C,D,E 2, A-B 3, A-D-E-C 1, A-D 2, A-D-E 4, A-D-E-F
5 A,B,C,D,E,F 2, A-B 3, A-D-E-C 1, A-D 2, A-D-E 4, A-D-E-F
C
F
2
53
2 3
1
1
2
5
1
D(v) = min{ D(v), D(w) + c(w,v) }
Shortest Path First (SPF)
2008/2009 COMM3380 Slide 5
Node A’s View of Network
A
B
D
E
C F
1
1
12
2Dest Cost Next Hop
B 2 B
C 3 D
D 1 D
E 2 D
F 4 D
Routing Table Node A
2008/2009 COMM3380 Slide 6
Network 192.168.19.0
Node A
Router3(Node E )
Router2(Node C )
[192.168.14.10]
Router1(Node B )
[192.168.14.1]
Serial1192.168.15.2
FE0/0[192.168.18.1]
Serial0192.168.17.2
FE0/1192.168.19.1
FE0/1192.168.19.2
FE0/0
Serial0192.168.15.1
FE0/1192.168.16.1
Serial0192.168.17.1
Network 192.168.14.
0
Node F
Network 192.168.18.
0
[192.168.18.30]
Network 192.168.15.
0
Network 192.168.17.
0
Network 192.168.16.
0
Hub
[192.168.16.101]
Node D
2008/2009 COMM3380 Slide 7
Network Graph
A D
B E1
1
C1
F
1
1 1
Dest Cost Next Hop
B 1 B
C 2 B
D 3 B
E 2 B
F 3 B
Routing Table Node A
Dest Cost Next Hop
A 1 A
C 1 C
D 2 C
E 1 E
F 2 E
Routing Table Node B
2008/2009 COMM3380 Slide 8
Network Graph
A D
B E1
1
C1
F
∞
1 1
Dest Cost Next Hop
B 1 B
C 2 B
D 3 B
E 3 B
F 4 B
Routing Table Node A
Dest Cost Next Hop
A 1 A
C 1 C
D 2 C
E 2 C
F 3 C
Routing Table Node B
2008/2009 COMM3380 Slide 9
Configure RIP on Cisco RouterRouter1#configure terminalRouter1(config)#interface fastethernet0/0Router1(config-if)#ip address 192.168.14.1 255.255.255.0Router1(config-if)#no shutdownRouter1(config-if)#interface fastethernet0/1Router1(config-if)#ip address 192.168.15.1 255.255.255.0Router1(config-if)#no shutdownRouter1(config-if)#interface serial0/1/0Router1(config-if)#ip address 192.168.19.1 255.255.255.0Router1(config-if)#no shutdownRouter1(config-if)#router ripRouter1(config-router)#network 192.168.14.0Router1(config-router)#network 192.168.15.0Router1(config-router)#network 192.168.19.0
2008/2009 COMM3380 Slide 10
RIP Example – Router 1
C 192.168.14.0/24 is directly connected, FE0/0C 192.168.15.0/24 is directly connected, S0C 192.168.19.0/24 is directly connected, FE0/1 R 192.168.16.0/24 via 192.168.15.2, S0R 192.168.17.0/24 via 192.168.19.2, FE0/1 via 192.168.15.2, S0R 192.168.18.0/24 via 192.168.19.2, FE0/1
Network 192.168.19.0
Node A
Router3(Node E )
Router2(Node C )
[192.168.14.10]
Router1(Node B )
[192.168.14.1]
Serial1192.168.15.2
FE0/0[192.168.18.1]
Serial0192.168.17.2
FE0/1192.168.19.1
FE0/1192.168.19.2
FE0/0
Serial0192.168.15.1
FE0/1192.168.16.1
Serial0192.168.17.1
Network 192.168.14.0
Node F
Network 192.168.18.0
[192.168.18.30]
Network 192.168.15.0
Network 192.168.17.0
Network 192.168.16.0
Hub
[192.168.16.101]Node D
2008/2009 COMM3380 Slide 12
Routing Information Protocol (RIP)
• RIP is an IGP for use within an autonomous system• Designed for small networks with same speed links• Uses UDP port 520• Request and Response messages - requests update
and responds with update • Broadcasts request out every RIP configured
interface on start up of routing protocol.• Upon receipt of response message, routes are
checked in current routing table, if absent, routes are added, if existing, route only updated if it has a lower hop count
2008/2009 COMM3380 Slide 13
RIP broadcast from a neighbouring router
• If the destination is not in the table, then create a new table entry for it.
• If the destination is already in the table via a different route but the received list gives a shorter distance to it, then change the table entry.
• If the destination is already in the table via the same route, but the received list gives a distance that is different then change the table entry.
• Otherwise do nothing with this destination/distance pair of values.
2008/2009 COMM3380 Slide 14
RIP : Count to infinity problem• B – X -> distance = 0• A – X -> distance = 1• If connection from B to X
fails -> B – X marked unreachable
• A broadcasts DV list• B sees A-X at distance 1
-> thinks link B-A-X exists with distance 2 -> updates table -> routing loop between A and B for traffic destined for X
2008/2009 COMM3380 Slide 15
RIP : Count to infinity problem• Now B broadcast its DV list
with X reachable via A at distance = 2
• A sees distance B-X has changed from distance 0 to 2 -> A updates A-X to distance = 3
• A broadcasts -> B see A-X with distance=3 -> B updates entry B-X to distance=4
• Continues until distance = 16 reached -> unreachable
2008/2009 COMM3380 Slide 16
Split Horizon
• Solves trivial count-to-infinity problem
• Routers never advertise the cost of a destination back to its next hop, i.e. where it learned it from
• Poison Reverse -> advertise back infinity
2008/2009 COMM3380 Slide 17
Routing Loop Avoidance
• Routing loops can still occur in any network due to router configuration errors.
• To prevent -> IP packet has a time to live (TTL) value in its header-> decremented by each router as it receives the packet. If the TTL of a packet becomes zero, the router discards it.
2008/2009 COMM3380 Slide 18
IP header UDP header RIP Message
Command Version Set to 00...0
32-bit address
Unused (Set to 00...0)
address family Set to 00.00
Unused (Set to 00...0)
metric (1-16)
one
rout
e en
try(2
0 by
tes)
Up to 24 more routes (each 20 bytes)
32 bits
One RIP message can have up to 25 route entries
1: request2: response
2: for IP0…0: request full rou-ting table
Address of destination
Cost (measured in hops)
1: RIPv1
RIPv1 Packet Format
Ref: Leibeherr
2008/2009 COMM3380 Slide 19
RIPv2 Packet Format
Ref: Leibeherr
IP header UDP header RIPv2 Message
Command Version Set to 00.00
IP address
Subnet Mask
address family route tag
Next-Hop IP address
metric (1-16)
one
rout
e en
try(2
0 by
tes)
Up to 24 more routes (each 20 bytes)
32 bits
Used to carry information from other routing protocols (e.g., autonomous system number)
Identifies a better next-hop address on the same subnet than the advertising router, if one exists (otherwise 0….0)
2: RIPv2
Subnet mask for IP address
2008/2009 COMM3380 Slide 20
RIP Version 2 Changes
• Classless routing and subnet masks in routing updates
• Routing update authentication• Next-hop addresses for each route• External route tags• Multicast route updates, instead of broadcast• Same procedures, timers & functions of v1
2008/2009 COMM3380 Slide 21
RIP v1 & v2• Metric of hop count only allowable of 1-15. At 16, destination is
considered unreachable, to prevent routing loops. This limits the depth of a network to run RIP.
• Timers– Update timer - Router sends gratuitous Response message out
each interface every 30 seconds with full routing table.– Expiration timer - initialized to 180 seconds for a new route and
reset upon update of that route. If timer expires, hop count set to 16, unreachable, but still advertised.
– Flush timer - set to 240 seconds upon initialization, once expired, route is removed from routing table and no longer advertise.
– Holddown timer - Cisco only - set for 180 seconds when updated route has a higher hop count than previous advertisement.
2008/2009 COMM3380 Slide 23
Open Shortest Path First (OSPF)
• Interior Gateway Protocol (IGP)• Most widely used Link State protocol
– Link State packet dissemination– Topology map at each router– Route computation using Shortest Path First
(SPF) algorithm (Dijkstra’ algorithm)
• Link state information flooded to all nodes• Fast convergence• OSPF messages sent directly over IP
2008/2009 COMM3380 Slide 24
OSPF Router Operation
• Link State -> status of link between two routers, relationship to neighbour router• Cost - metric assigned to link (cisco -> based on media speed (10^8/ link bandwidth))• LSA - Link-State Advertisements - includes interfaces, associated cost and
network information.• Link-State Database (Topology Database)
– listing of link-state entries from all other routers in area,– same database for each router in an area, generated from LSAs received
ReceivedLSAs
IP Routing Table
Dijkstra’s
Algorithm
Link StateDatabase
LSAs are flooded to other interfaces
Ref: Leibeherr
2008/2009 COMM3380 Slide 25
OSPF Operation1. OSPF enabled routers send hello packets out all OSPF
enabled interfaces2. Some neighbours form adjacencies based on matching
hello packet parameters.3. Routers send Link State Advertisements (LSA) over its
adjacencies., LSA = (link id, state of the link, cost, neighbours of the link)
4. Routers receives other LSAs and records it in its Link State Database. Then it forwards the LSA out its enabled interfaces.
5. LSAs flood the OSPF area and each router has same LSA database.
6. Router uses SPF Algorithm to build a SPF tree describing the shortest path to every destination.
7. Router uses the SPF tree to build its routing table..
Ref: Leibeherr
2008/2009 COMM3380 Slide 26
Hierarchical OSPF
ASBR: Autonomous System Border RouterABR: Area Border RouterIA: Intra-area Router
(ASBR)
(ABR)
(IA)
Ref: Kurose
Ref: Leibeherr
2008/2009 COMM3380 Slide 30
Configuring Router Priority
The priorities can be set to any value from 0 to 255. A value of 0 prevents that router from being elected. A router with the highest OSPF priority will win the election for DR.
Ref: CISCO
2008/2009 COMM3380 Slide 32
Verifying OSPF Configuration
• show ip protocol• show ip route• show ip ospf interface• shop ip ospf• show ip ospf neighbour detail• show ip ospf database
2008/2009 COMM3380 Slide 33
Autonomous System (AS)
R R
R R
R
R
R
R R
R
R
AS
AS AS
AS – Autonomous SystemR - Router
Interior Gateway Protocols
Exterior Gateway Protocols
Interior Gateway Protocols
2008/2009 COMM3380 Slide 35
BGP• BGP = Border Gateway Protocol • Currently in version 4• Interdomain routing protocol for routing
between autonomous systems• Uses TCP to send routing messages• BGP is neither a link state, nor a distance
vector protocol – often called path-vector protocol as BGP routing message contain complete AS-paths.
• Network administrators can specify routing policies
2008/2009 COMM3380 Slide 36
Internet inter-AS routing: BGP
• BGP provides each AS a means to:1. Obtain subnet reachability information from neighbouring
ASs.2. Propagate the reachability information to all routers internal
to the AS.3. Determine “good” routes to subnets based on reachability
information and policy.
• Allows a subnet to advertise its existence to rest of the Internet: “I am here”
• BGP’s goal is to find any path (not an optimal one). Since the internals of the AS are never revealed, finding an optimal path is not feasible.
2008/2009 COMM3380 Slide 37
BGP basics• Pairs of routers (BGP peers) exchange routing info over semi-
permanent TCP connections: BGP sessions• When AS2 advertises a network prefix to AS1, AS2 is
“promising” it will forward any datagrams destined to that prefix towards the prefix.
• When advertising a prefix, advert includes BGP attributes. – prefix + attributes = “route”
• Two important attributes:– AS-PATH: contains the ASs through which the advert for the prefix
passed: AS 67 AS 17 – NEXT-HOP: Indicates the specific internal-AS router to next-hop
AS. (There may be multiple links from current AS to next-hop-AS.)• When gateway router receives route advert, uses import policy
to accept/decline.
2008/2009 COMM3380 Slide 38
BGP route selection
• Router may learn about more than 1 route to same prefix. Router must select route.
• Elimination rules:1. Local preference value attribute: policy decision
2. Shortest AS-PATH
3. Closest NEXT-HOP router: hot potato routing
4. Additional criteria
2008/2009 COMM3380 Slide 39
BGP Messages
• BGP uses a 16-byte marker format to delimit BGP messages.– Length field contains the length of the entire BGP
message, including the common message header– Type field specifies the type of BGP message.
2008/2009 COMM3380 Slide 40
BGP messages• BGP messages exchanged using TCP.• BGP messages:
– OPEN: opens TCP connection to peer and authenticates sender
– UPDATE: advertises new path (or withdraws old)– KEEPALIVE keeps connection alive in absence of
UPDATES; also ACKs OPEN request– NOTIFICATION: reports errors in previous msg; also
used to close connection– ROUTE-REFRESH request messages
2008/2009 COMM3380 Slide 41
TCP/IP Protocol SuiteNetwork Layer• IP
– addressing conventions
– datagram format– packet handling
conventions• ICMP
– error reporting– router “signaling”
• Routing protocols– path selection– RIP, OSPF, BGP
ARP Hardware Interface RARP
TCP UDP
PING FTP tracert BOOTP
Physical Media
Telnet DNS TFTPSMTPApplicationLayer
TransportLayer
Link Layer
ICMP
IPIGMP
Network LayerRouting Protocols
e.g. RIP, OSPF, BGP
routingtable
2008/2009 COMM3380 Slide 42
TCP/IP Protocol Suite
• Network Layer– IP, ICMP
• Routing protocolsRIP, OSPF, BGP
• Transport Layer– UDP, TCP
ARP
Hardware Interface
RARP
ICMP
IP
IGMP
TCP UDP
PING FTP tracert BOOTP
Physical Media
TransportLayer
NetworkLayer
Link Layer
ApplicationLayer
Telnet DNS TFTPSMTP
2008/2009 COMM3380 Slide 43
TCP/IP – Transport Layer
• Responsible for end-to-end delivery of entire message– Port Numbers– Segmentation and Reassemble– Connection Control– End-to-End Flow Control– End-to-End Error Control
2008/2009 COMM3380 Slide 44
Transport Layer Protocols
• User Datagram Protocol (UDP)– Connectionless
unreliable service
• Transmission Control Protocol (TCP)– Connection-oriented
reliable stream service
ARP
Hardware Interface
RARP
ICMP
IP
IGMP
TCP UDP
PING FTP tracert BOOTP
Physical Media
TransportLayer
NetworkLayer
Link Layer
ApplicationLayer
Telnet DNS TFTPSMTP
TCP/IP Protocol Suite