routing - depaul university · c is lowest path cost in tent, place c in path, exame c's lsp,...

38
TDC375 Autumn 03/04 John Kristoff - DePaul University 1 Network Protocols Routing

Upload: vuhanh

Post on 21-Nov-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

TDC375 Autumn 03/04 John Kristoff - DePaul University 1

Network Protocols

Routing

TDC375 Autumn 03/04 John Kristoff - DePaul University 2

IPv4 unicast routing

� All Internet hosts perform basic routing

� for local net destinations, forward to local host

� for non-local nets, forward to default router

� Dedicated routers often used between networks

� Routing tables maintain next hop information

� Forwarding decision based on destination address

� routers can use other info to influence decision

� Routers forward to next-hop if not locally attached

TDC375 Autumn 03/04 John Kristoff - DePaul University 3

Basic IPv4 forwarding process

� For an IP datagram received on an interface...

� remove layer 2 information,

� extract destination IP address (D),

� find best match for (D) in routing table,

� extract forwarding address (F) for next hop,

� create layer 2 info on outgoing interface,

� send datagram to (F).

TDC375 Autumn 03/04 John Kristoff - DePaul University 4

IP routing tables

Since each row in a routing table represents an entry associated with one IP network, the size of

the routing table is directly proportional to the number of IP networks known throughout the

entire internetwork.

TDC375 Autumn 03/04 John Kristoff - DePaul University 5

IP routing table illustrated

TDC375 Autumn 03/04 John Kristoff - DePaul University 6

Populating the routing table

� Statically (through manual configuration)

� Simple for small sites with few links/routers

� Lacks scalability and flexibility

� Useful for permanent route entries

� Automatically (with distributed routing protocols)

� Allows quick re-route around failures/changes

� Useful for large networks with redundant paths

� Failures in protocol can be catastrophic

TDC375 Autumn 03/04 John Kristoff - DePaul University 7

IP routing illustrated

TDC375 Autumn 03/04 John Kristoff - DePaul University 8

IP routing illustrated (continued)

TDC375 Autumn 03/04 John Kristoff - DePaul University 9

Routing metrics

� Shortest/longest hop path

� Lowest/highest cost path

� Lowest/highest reliable path

� Best/worst latency/delay

� Site specific path policy decision

TDC375 Autumn 03/04 John Kristoff - DePaul University 10

Some routing terminology

� Autonomous system (AS)

� Network(s) set administered by a single entity

� Interior gateway protocol (IGP)

� distributed routing protocol used within an AS

� Exterior gateway protocol (EGP)

� distributed routing protocol used between ASes

TDC375 Autumn 03/04 John Kristoff - DePaul University 11

Distance vector routing

� Each node maintains a distance to destination

� e.g. 4 hops to network XYZ, 2 hops to ABC

� Periodically advertise attached nets out each link

� Learn other nets from other router advertisements

� Advertise learned routes (add 1 to hop count)

� Also known as Bellman-Ford after the inventors

TDC375 Autumn 03/04 John Kristoff - DePaul University 12

Distance vector illustrated

TDC375 Autumn 03/04 John Kristoff - DePaul University 13

Distance vector illustrated [cont]

TDC375 Autumn 03/04 John Kristoff - DePaul University 14

Distance vector illustrated [cont]coverged

TDC375 Autumn 03/04 John Kristoff - DePaul University 15

Problems with distance vector

� Convergence time can be slow

� Also known as the count to infinity problem

� What happens when link to A fails?

TDC375 Autumn 03/04 John Kristoff - DePaul University 16

Solving count to infinity

� Hold down

� advertise infinity for a route and wait before switching paths. hope that news of the change propagates before timer expires. Kludge.

� Report the entire path

� guarantees no loops, but resource expensive

� Split horizon

� Do not advertise route to neighbor if it was received from that neighbor. Not foolpoof.

TDC375 Autumn 03/04 John Kristoff - DePaul University 17

Other distance vector tricks

� Triggered updates

� advertise changes immediately, may cause route flapping, but generally a good thing to do

� Poison reverse

� this is used with split horizon, advertise infinity rather than nothing at all

� DUAL

� like hold down, but can switch paths if a new distance is lower, sufficiently complex

TDC375 Autumn 03/04 John Kristoff - DePaul University 18

Routing information protocol (RIP)

� RFC 1058 (RIPv1) and RFC 2453 (RIPv2)

� Very simple distance vector protocol

� Slow convergence time

� UDP broadcast every 30 seconds (by default)

� Route times out after 180 seconds (by default)

� Widely used as an IGP (RIPv2 in particular)

� 15 hop limit (anything greater equals infinity)

TDC375 Autumn 03/04 John Kristoff - DePaul University 19

RIPv2

� Mainly updated to support subnet masks

� Supports simple authentication

� Uses IP multicast group for destination address

� Route tag option for interaction with EGPs

� Next-hop option to associated with advertisement

TDC375 Autumn 03/04 John Kristoff - DePaul University 20

RIPv1 packet formatPacket format:

0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| command (1) | version (1) | must be zero (2) |+---------------+---------------+-------------------------------+| |~ RIP Entry (20) ~| |+---------------+---------------+---------------+---------------+

A RIPv1 entry has the following format:

0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| address family identifier (2) | must be zero (2) |+-------------------------------+-------------------------------+| IPv4 address (4) |+---------------------------------------------------------------+| must be zero (4) |+---------------------------------------------------------------+| must be zero (4) |+---------------------------------------------------------------+| metric (4) |+---------------------------------------------------------------+

TDC375 Autumn 03/04 John Kristoff - DePaul University 21

RIPv2 packet formatPacket format is the same, RIPv2 entry format is:

0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Address Family Identifier (2) | Route Tag (2) |+-------------------------------+-------------------------------+| IP Address (4) |+---------------------------------------------------------------+| Subnet Mask (4) |+---------------------------------------------------------------+| Next Hop (4) |+---------------------------------------------------------------+| Metric (4) |+---------------------------------------------------------------+

Authentication uses one entry of the format:

0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Command (1) | Version (1) | unused |+---------------+---------------+-------------------------------+| 0xFFFF | Authentication Type (2) |+-------------------------------+-------------------------------+~ Authentication (16) ~+---------------------------------------------------------------+

TDC375 Autumn 03/04 John Kristoff - DePaul University 22

Link state routing

� All routes have complete network topology information (database within their area)

� link state packets are flooded to all area routers

� Each router computes its own optimal path

� Convergence time is very short

� Protocol complexity is higher than distance vector

� Ensures a loop free environment

TDC375 Autumn 03/04 John Kristoff - DePaul University 23

Link state routing illustrated

TDC375 Autumn 03/04 John Kristoff - DePaul University 24

Link state routing databases

� Link state database

� contains latest link state packet from each router

� PATH (permanent) database

� (router id / path cost / forwarding direction) tuple

� TENT (tenative) database

� same format as PATH, candidate PATH entries

� Forwarding database (aka FIB)

� contains ID and forwarding direction

TDC375 Autumn 03/04 John Kristoff - DePaul University 25

Dijkstra's algorithm

� Start with self as root of the tree

� (my ID / cost 0 / forwarding direction 0) in PATH

� For each node in PATH, examine its LSP and place those neighbors in TENT if not already in PATH or TENT (with lower cost)

� If TENT is empty, exit, otherwise find ID with lowest cost in TENT and move it to PATH

TDC375 Autumn 03/04 John Kristoff - DePaul University 26

Dijkstra's algorithm illustrated1. Start with A, put A in PATH, examine A's LSP, add B and D to TENT

2. B is lowest path cost in TENT, place B in PATH, examine B's LSP, put C,E in TENT

3. D is lowest path cost in TENT, place D in PATH, examine D's LSP, found better E path

4. C is lowest path cost in TENT, place C in PATH, exame C's LSP, found better E path again

5. E is lowest path cost in TENT, place E in PATH, examine E's LSP (no better paths)

6. TENT is empty, terminate

TDC375 Autumn 03/04 John Kristoff - DePaul University 27

Open shortest path first (OSPF)

� Standardized as RFC 2328 (OSPFv2)

� Relatively complex

� Supports multiple route metrics (no one does this)

� Allows 2-tier area hierarchy for scaling

� Relatively efficient

� Good convergence properties

� Runs directly over IP

� Recommended IGP by the IETF

TDC375 Autumn 03/04 John Kristoff - DePaul University 28

OSPF packets

� Hello

� link maintenance

� Exchange

� initial exchange of routing tables

� Flooding

� incremental routing updates

TDC375 Autumn 03/04 John Kristoff - DePaul University 29

OSPF database records

� Router links

� summarizes links from advertising router

� Network links

� transit networks (broadcast and non-broadcast)

� Summary links

� summary info advertised by area border routers

� External links

� imported routes, typically from EGP

TDC375 Autumn 03/04 John Kristoff - DePaul University 30

Common OSPF header

0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Version # | Type | Packet length |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Router ID |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Area ID |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Checksum | AuType |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Authentication |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Authentication |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

TDC375 Autumn 03/04 John Kristoff - DePaul University 31

Interdomain routing

� Routing domains are independently funded

� Routing domains do not trust each other

� Different routing domains have different policies

� Static routing

� EGP – first interdomain routing protocol

� BGP – current path vector routing protocol

TDC375 Autumn 03/04 John Kristoff - DePaul University 32

Border gateway protocol (BGP)

� Current version 4 standardized in RFC 1771

� Runs over TCP

� List of AS numbers comprise a full path to network

� Announcements can be edited (paths padded)

� Can selectively filter or preference received routes

� Route can be selected on path or a preference

� external BGP versus internal BGP

TDC375 Autumn 03/04 John Kristoff - DePaul University 33

BGP attributes

� Describes routes in BGP updates

� Confusing descriptions of attributes

� e.g. well known must be supported

� e.g. mandatory must be present in updates

� Examples

� AS path

� community

� unreachable

TDC375 Autumn 03/04 John Kristoff - DePaul University 34

Confederations

� Group of ASes that appear as a single AS

� A form of aggregation

� May simplify routing policies

� “Don't route through confed X” as opposed to “don't go through AS A, AS B, AS C, etc...”

� Sub-optimal routing may result

� multiple ASes in path vector appear as a loop

TDC375 Autumn 03/04 John Kristoff - DePaul University 35

BGP message types

� Open

� first message when neighbors come up

� Update

� contains routing information

� Notification

� final message before session is disconnected

� Keepalive

� reassures reachability in absence of updates

TDC375 Autumn 03/04 John Kristoff - DePaul University 36

Route dampening

� Routes that oscillate ripple through the Internet

� consumes CPU and causes instability (churn)

� Unstable (flapping) routes are penalized

� for some period of time, the flap is suppressed

� suppression time can increase to a maximum

� suppression of routes results in lost connectivity

� Dampen big/important netblocks more cautiously

� Dampening may introduce stabilities of its own

TDC375 Autumn 03/04 John Kristoff - DePaul University 37

Sample Cisco configRouter bgp 12345 bgp log-neighbor-changes network 128.160.0.0 mask 255.255.0.0 neighbor 36.5.1.1 remote-as 54321 neighbor 36.5.1.1 description E-BGP peer with XYZ corp. neighbor 36.5.1.1 password as54321password neighbor 36.5.1.1 version 4 neighbor 36.5.1.1 prefix-list invalid in neighbor 36.5.1.1 prefix-list announce out

ip prefix-list invalid seq 10 deny 0.0.0.0/8 le 32ip prefix-list invalid seq 20 deny 10.0.0.0/8 le 32ip prefix-list invalid seq 30 deny 127.0.0.0/8 le 32...

ip prefix-list announce seq 10 permit 128.160.0.0/16ip prefix-list announce seq 20 deny 0.0.0.0/0 le 32

TDC375 Autumn 03/04 John Kristoff - DePaul University 38

Final thoughts

� Routing protocols tend to work 99.99% of the time

� But when failures occur, they tend to be catastrphic

� This is probably the most network intelligence needed for basic Internet operation

� Internet peering

� Route filtering, protection and policy issues