comm3380-slides-week08_PA1

Download Report

Transcript comm3380-slides-week08_PA1

Brief Review of Last Lecture
• Routing Algorithms
– Distance vector
• e.g. RIP
– Link State / Shortest Path First
• e.g. OSPF
2008/2009
COMM3380
Slide 1
Routing Algorithms
Distance 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 2
5
Bellman-Ford
Algorithm
B
2
2
A
dx(y) = min { c(x,v) + dv(y) }
dA(B)
0
∞
--
∞
--
∞
1
2
B
5
C
1
2
2
B
4
D
3
2
B
3
4
2
B
3
2008/2009
Vector
(Next Hop)
dA(C)
Vector
(Next Hop)
dA(D)
Vector
(Next Hop)
C
3
D
1
Hops
3
dA(E)
5
1
2
1
Vector
(Next Hop)
F
E
dA(F)
Vector
(Next Hop)
∞
--
∞
--
D
∞
--
∞
--
1
D
2
D
10
C
D
1
D
2
D
4
D
D
1
D
2
D
4
D
--
COMM3380
Slide 3
5
Dijsktra’s
Algorithm
B
2
2
A
D(v) = min{ D(v), D(w) + c(w,v) }
D
1
Shortest Path First (SPF)
3
3
C
5
1
1
F
2
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
2008/2009
COMM3380
Slide 4
Node A’s View of Network
A
Routing Table Node A
Dest
Cost
Next
Hop
B
2
B
C
3
D
D
1
D
E
2
D
F
4
D
2008/2009
1
2
D
1
B
E
2
1
C
COMM3380
F
Slide 5
Hub
Network 192.168.19.0
FE0/1
192.168.19.2
FE0/1
192.168.19.1
Router1
(Node
B)
FE0/
[192.168.14.1]
0
Serial0
192.168.17.2
Serial0
192.168.15.1
Network
192.168.15.
0
Network
192.168.17.
0
Serial1
192.168.15.2
Network
192.168.14.
0
(Node
E)
FE0/0
[192.168.18.1]
Serial0
192.168.17.1
Router2
(Node
Router3
Network
192.168.18.
0
C)
FE0/1
192.168.16.1
[192.168.14.10]
Node A
[192.168.18.30]
Network
192.168.16.
0
Node F
[192.168.16.101]
Node D
2008/2009
COMM3380
Slide 6
Network Graph
1
1
B
1
C
1
1
A
1
D
Dest
Cost
Next Hop
F
Dest
Cost
Next Hop
B
1
B
A
1
A
C
2
B
C
1
C
D
3
B
D
2
C
E
2
B
E
1
E
F
3
B
F
2
E
Routing Table Node A
2008/2009
E
Routing Table Node B
COMM3380
Slide 7
Network Graph
∞
1
B
C
E
1
1
A
Dest
1
1
D
Cost
Next Hop
F
Dest
Cost
Next Hop
B
1
B
A
1
A
C
2
B
C
1
C
D
3
B
D
2
C
E
3
B
E
2
C
F
4
B
F
3
C
Routing Table Node A
2008/2009
Routing Table Node B
COMM3380
Slide 8
Configure RIP on Cisco Router
Router1#configure terminal
Router1(config)#interface fastethernet0/0
Router1(config-if)#ip address 192.168.14.1 255.255.255.0
Router1(config-if)#no shutdown
Router1(config-if)#interface fastethernet0/1
Router1(config-if)#ip address 192.168.15.1 255.255.255.0
Router1(config-if)#no shutdown
Router1(config-if)#interface serial0/1/0
Router1(config-if)#ip address 192.168.19.1 255.255.255.0
Router1(config-if)#no shutdown
Router1(config-if)#router rip
Router1(config-router)#network 192.168.14.0
Router1(config-router)#network 192.168.15.0
Router1(config-router)#network 192.168.19.0
2008/2009
COMM3380
Slide 9
RIP Example – Router 1
C
C
C
R
R
R
192.168.14.0/24
192.168.15.0/24
192.168.19.0/24
192.168.16.0/24
192.168.17.0/24
is directly connected, FE0/0
is directly connected, S0
is directly connected, FE0/1
via 192.168.15.2, S0
via 192.168.19.2, FE0/1
via 192.168.15.2, S0
192.168.18.0/24 via 192.168.19.2, FE0/1
Hub
Network 192.168.19.0
FE0/1
192.168.19.2
FE0/1
192.168.19.1
Router1
(Node
B)
Serial0
192.168.17.2
Serial0
192.168.15.1
Network
192.168.15.0
Network
192.168.17.0
Router3
(Node
E)
FE0/0
[192.168.18.1]
FE0/0
[192.168.14.1]
Serial1
192.168.15.2
Network
192.168.14.0
Serial0
192.168.17.1
Router2
(Node
Network
192.168.18.0
C)
FE0/1
192.168.16.1
[192.168.14.10]
[192.168.18.30]
Node A
Network
192.168.16.0
Node F
[192.168.16.101]
Node D
2008/2009
COMM3380
Slide 10
Distance Vector Protocol
Example
Routing Information Protocol (RIP)
2008/2009
COMM3380
Slide 11
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 12
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 13
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 14
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 15
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 16
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 17
Ref: Leibeherr
RIPv1 Packet Format
IP header UDP header
RIP Message
1: RIPv1
2: for IP
0…0: request full routing table
Command Version
Set to 00...0
address family
Set to 00.00
32-bit address
Unused (Set to 00...0)
Address of destination
Unused (Set to 00...0)
metric (1-16)
Cost (measured in hops)
One RIP message can have
up to 25 route entries
one route entry
(20 bytes)
1: request
2: response
Up to 24 more routes (each 20 bytes)
32 bits
2008/2009
COMM3380
Slide 18
Ref: Leibeherr
RIPv2 Packet Format
Used to carry information
from other routing protocols
(e.g., autonomous system
number)
RIPv2 Message
Command Version
Set to 00.00
address family
route tag
IP address
Subnet mask for IP address
Subnet Mask
Next-Hop IP address
Identifies a better next-hop
address on the same subnet
than the advertising router, if
one exists (otherwise 0….0)
metric (1-16)
2: RIPv2
one route entry
(20 bytes)
IP header UDP header
Up to 24 more routes (each 20 bytes)
32 bits
2008/2009
COMM3380
Slide 19
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 20
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 21
Link State Protocol Example
Open Shortest Path First (OSPF)
2008/2009
COMM3380
Slide 22
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 23
Ref: Leibeherr
OSPF Router Operation
Received
LSAs
Link State
Database
Dijkstra’s
IP Routing
Table
Algorithm
LSAs are flooded
to other interfaces
•
•
•
•
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
2008/2009
COMM3380
Slide 24
Ref: Leibeherr
OSPF Operation
1.
2.
3.
4.
5.
6.
7.
OSPF enabled routers send hello packets out all OSPF
enabled interfaces
Some neighbours form adjacencies based on matching
hello packet parameters.
Routers send Link State Advertisements (LSA) over its
adjacencies., LSA = (link id, state of the link, cost, neighbours of the link)
Routers receives other LSAs and records it in its Link State
Database. Then it forwards the LSA out its enabled
interfaces.
LSAs flood the OSPF area and each router has same LSA
database.
Router uses SPF Algorithm to build a SPF tree describing the
shortest path to every destination.
Router uses the SPF tree to build its routing table..
2008/2009
COMM3380
Slide 25
Ref: Leibeherr
Hierarchical OSPF
(ASBR)
(ABR)
(IA)
ASBR:
ABR:
IA:
Autonomous System Border Router
Area Border Router
Intra-area Router
2008/2009
Ref: Kurose
COMM3380
Slide 26
Cisco Router Example
Single-Area OSPF Configuration
2008/2009
COMM3380
Slide 27
Ref: CISCO
Configuring the OSPF Routing Process
2008/2009
COMM3380
Slide 28
Ref: CISCO
Configuring OSPF Loopback
Address and Router Priority
2008/2009
COMM3380
Slide 29
Ref: CISCO
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.
2008/2009
COMM3380
Slide 30
Ref: CISCO
Modifying OSPF Cost Metric
2008/2009
COMM3380
Slide 31
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 32
Autonomous System (AS)
Interior Gateway
Protocols
AS
R
R
R
R
Interior Gateway
Protocols
Exterior Gateway
Protocols
R
R
R
AS
R
R
R
R
AS
AS – Autonomous System
R - Router
2008/2009
COMM3380
Slide 33
2008/2009
COMM3380
Slide 34
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 35
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 36
BGP basics
• Pairs of routers (BGP peers) exchange routing info over semipermanent 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 37
BGP route selection
•
•
Router may learn about more than 1 route to
same prefix. Router must select route.
Elimination rules:
1.
2.
3.
4.
2008/2009
Local preference value attribute: policy decision
Shortest AS-PATH
Closest NEXT-HOP router: hot potato routing
Additional criteria
COMM3380
Slide 38
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 39
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 40
TCP/IP Protocol Suite
Network Layer
• IP
– addressing
conventions
– datagram format
– packet handling
conventions
• ICMP
PING Telnet
FTP
Application
SMTP
Layer tracert BOOTP DNS
TFTP
Transport
TCP Layer
UDP
Network Layer
Routing Protocols
e.g.
RIP, OSPF, BGP
– error reporting
– router “signaling”
IGMP
IP
routing
table
ICMP
• Routing protocols
– path selection
– RIP, OSPF, BGP
ARP
Hardware
Interface
Link Layer
RARP
Physical Media
2008/2009
COMM3380
Slide 41
TCP/IP Protocol Suite
• Network Layer
PING Telnet
FTP
SMTP tracert BOOTP DNS
– IP, ICMP
Application
Layer
• Routing
protocols
TCP
Transport
Layer
UDP
RIP, OSPF, BGP
• Transport Layer
TFTP
ICMP
IGMP
IP
Network
Layer
– UDP, TCP
ARP
RARP
Hardware Interface
Link Layer
Physical Media
2008/2009
COMM3380
Slide 42
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 43
Transport Layer Protocols
TCP/IP Protocol Suite
• User Datagram
Protocol (UDP)
PING
Telnet
FTP
SMTP tracert BOOTP DNS
– Connectionless
unreliable service
• Transmission Control
Protocol (TCP)
– Connection-oriented
reliable stream service
TFTP
Application
Layer
TCP
Transport
Layer
UDP
ICMP
IGMP
IP
ARP
Network
Layer
RARP
Hardware Interface
Link Layer
Physical Media
2008/2009
COMM3380
Slide 44