IP Routing Protocols
IP Routing Protocols
• RIP
• OSPF
BGP
• What is Routing ?
• Routing is the process for forwarding a
packet between the source and destination
networks (or subnets)
• Routing devices perform two main tasks
– Routing –
» Topology discovery
» Path (or route) discovery
– Switching
» Process of forwarding the packet between the inbound and
outbound interface
» Finding path to the destination
• In IP the switching is done on the per
packet basis (L3 forwarding)
– Connectionless mode: routers forward traffic on the basis of the
address contained in the packet header
» Each packet is switched independently from others
• Routing Information
• Each router maintains routing table that
contains the routing information necessary
to find path to the destination
• Routing table contains paths to all known
destination in the network
• Classless Routing
• In the classless routing the subnet’s masks
are propagated together with the subnet’s
addresses
• More detailed information about network
topology is possible
– Subnets may not be continuous
• Efficient use of address space
– e.g. Only two addresses can be used on point-to-point links
• Route summarisation possible at any bit
position (VLSM)
– Small routing tables
• CIDR - Classless Interdomain Routing
• Routing Information Protocol (RIP)
• RFC 2453 – RIP-2
• Routing Information Protocol (RIP)
• RIP is an IGP protocol based on the
Bellman-Ford (or distance vector)
algorithm
– Distances between networks are exchange between routers
– The information is exchange only between adjacent routers
• RIP was first developed for the Xerox
Network Systems (XNS) architecture
• In 1969 RIP was adopted for ARPANET
(with modification for IP addressing
support)
– The RIP is intended to be used within IP-based Internet
• RIP is developed for medium-size networks
(AS) and have the following limitations
– The longest path is limited to 15 hopes
– Counting to infinity for loop resolution
– Fixed (hop) metrics
• Routing Information Protocol (RIP)
• Each router or host that participates in the
routing protocol maintains routing table
• Routing entry
– Standard routing information
» Destination network address
» Next hope router address
» Interface
» Metrics
– Protocol specific information
» Timers – the amount of time since the entry was last updated
» Flags (new route, withdrown route etc.)
• Routing Information Protocol (RIP)
• The destination on the same network can
be represented by single entry that
describes routing to the given network
– The details of routing within a given network are not visible to the
IP layer
• The routers/hosts exchange information
about known paths in periodical fashion
• The routers/hosts are initialised with the
networks directly connected to them
• Each router/host builds its routing table
from information provided from its
neighbours
• RIP Specification
• RIP uses UDP protocol to send routing
messages
– RIP port: UDP port 520
– All communications destined for RIP is sent for port 520
– All update messages are sent from port 520
– Update messages send in response to the request are sent to the
source port of that request
• Command: request or response
• Version: RIP-1 or RIP-2
• RIP Entry (RIP-1)
• Address family identifier (AFI) – type of
address
• IPv4 address – the IP address of the
destination network or host (or default
route)
• Metrics – the value of metrics for path to
the given destination
• Addressing
• Each router knows the IP address and
subnet mask for directly connected
networks
• The router sends outside given network
only the IP address of this network
– The routers not directly connected to the network know nothing
about its subnetting
– Without subnet mask it is not possible to distinguish the address of
subnet from the address of node in that subnet
– All addresses that are not network address are treated as node
addresses
• The subnet/host addresses are sent only to
the routers that are directly connected to
given network
• Routing Table
• The RIP routing table can contain the
following information:
– Addresses of directly connected network
– Addresses learnt from neighbours
– Addresses configured statically
– Addresses learnt from other protocol either EGP or IGP
– Default route (0.0.0.0)
• The creation of default routes in RIP is
implementation specific
– For example the BGP routers (the gateways to other AS) can
generate default route
» The outside traffic will be sent to the closest border router
• Timers
• Update timer - every 30 seconds the RIP
process sends response message to its
neighbours
– To prevent from message synchronisation (especially on broadcast
networks) the timer must be independent of the system load or
small offset +-5 seconds used
• Timeout timer – the timeout is initialised
when the route is established, the route
timeout is 180 seconds
• Garbage collection timer – after the route
is declared to be deleted it is kept in the
routing table and included in the update
messages for 120 second
– If new update for the deleted route comes before the garbage
timer expires the route is updated and the timer is cancelled
• Request Message
• A request message is used to obtain whole
or part of the routing table of the router
• Normally this message is sent by new
router that boot up and need to fill its
routing table
• The request message can be sent by other
entity than RIP router (for monitoring
purposes)
– In this case the request message is sent from other port than the
RIP port, the answer is sent back to this port
• If the request message contains one RIP
entry with AFI field zero and metric 16 it is
treated as the request for the whole
routing table
– Split horizon is done
• In other case the RIP entry are evaluated
one by one and interpreted as an update
request for the specific address (given in
the address field)
– Split horizon is not done
• Response Message
• The response message is sent in the
following cases
– Response to the specific query
– Normal update
– Triggered update
• Message validation
– Response was sent from the RIP port
– The source IP address must be checked against valid neighbour
and it must be in the directly connected network
– The message must be check if it was not generated by itself (on
broadcast network router can receive its own messages)
• RIP entry validation
– Correct destination address
– Correct metric (between 1 and 16)
• Protocol Extension (RIP-2)
• New RIP entries
– Allows to pass subnet information (classless routing)
– Allows to explicitly declare the next hop router
– Route Tag distinguishes RIP routes from other routes (e.g. from
BGP)
• Authentication
– Simple password
– MD5 as specified in RFC1997
• Multicast support
• Open Shortest Path First (OSPF)
• RFC 2328
• Open Shortest Path First
• OSPF is an IGP protocol based on the
Dijnkstra algorithm
– Link state information LSA (Link State Advertisement) is
exchanged between routers
– The LSA are exchange only when the link state changes
• OSPF addresses the scalability issues of
traditional distance vector protocols like
RIP
– Fast convergence
– Reduced routing traffic
– Support for large networks
• OSPF uses IP as its transport protocol
– OSPF is protocol number 89
• Open Shortest Path First
• Link state routing protocols
– Each router maintains the topology database derived from other
routers
– The routing table is build from the topological database
» The router runs SPF algorithm to construct tree of shortest
paths to all destination with itself as root
– Only changes in network topology are advertised between routers
• OSPF main characteristics
– Hierarchical routing - area definition
– VLSM support (subnet and mask propagation)
– No network topological limits
– Single value metrics - link cost
» Links costs are usually set in proportion to the bandwidth
– Load balancing over equal cost paths (up to 6 paths)
• OSPF Terminology
• Interface – the connection between router
and the network (represented as link in the
topology database)
• LSA – data describing the status of the
router links and networks
• Cost – weight assigned to the link
• Area – a collection of routers that have the
same are identification
• Neighbour – two routers on the same
network
• Adjacency - relationship between
neighbour routers established for the
purpose of exchanging routing information
• Designated router - the router that
generates LSA for given broadcast or NBMA
network
• Hello protocol - protocol used to detect
neighbours
• OSPF Topology Database
• All routers and network are represented as
vertices
• All interfaces are represented as edges
• Point to point links are represented as
edges
• OSPF Topologies
• Types of topologies
– Broadcast multi-access networks
» Ethernet
» Token Ring
– Point-to-point links
» Serial lines
– Non-broadcast Multi-access Networks (NBMA)
» X.25
» Frame Relay
» ATM
• Hello Protocol
• Hello protocol is used for establishing
neighbour relationship on broadcast
network
– Designated Router (DR) and Backup Designated Router (BDR) are
elected on broadcast networks
– Adjacency between routers is established
• Hello protocol is used for keep alive
procedure
– Hello packets are periodically send out from each router interface
with the broadcast IP address 224.0.0.5 (allOSPFRouters)
– typically the hello packets are sent every 10 seconds
• Hello protocol is used to discover changes
in the network topology
– Link failures/deletion
– Link addition
• Hello Packet
• Hello packets contain the following
information
– Router ID - the highest IP number on the active interface
– Hello and dead intervals - the time between consecutive hello
messages and the timeout value for detecting link or neighbour
failure
– Neighbours - the list of routers IDs with which the bi-directional
relation was established
– Area ID - the router must be on the same subnet and in the same
are to communicate
– Router priority - 8 bit number denoting router priority in the DR
and BDR designation process
– DR and BDR router addresses
– Authentication password
– Stub are flags
• Designated Router
• DR router represents the network to other
routers
– Routers on broadcast network must elect the DR and BDR routers
during the hello procedure
– The router with the highest priority becomes DR router
– The router with the second priority in order becomes the BDR
router
• The BDR router becomes active when the
DR router goes out of service
• Each router on the network establishes
adjacency with the DR router
• Only the DR router sends LSA for given
network
– This decreases the routing traffic
• Hello protocol
• Exchange process is performed at router
startup
– Newly started router sends out hello packets on all interfaces
– All routers that received the hello packets add the new router to
neighbour list
– The routers send unicast replay to the new router
» Including their IDs
– The new router updates its neighbour list (when it sees its ID in
the received relay) - the routers establishes bi-directional
communication
• The routers on the network determined
who the DR and BDR is (exstart state)
• After the exchange process routers
periodically exchange hello packets
• Hello Protocol
• Exchange Protocol
• Exchange Protocol is used to synchronise
the neighbour routers databases
• After the DR and BDR election, routers that
are not DR or BDR establishes the
adjacency with the DR and BDR routers
– The master-slave relationship is established
– The router with the higher ID becomes the master
• The adjacent routers exchange the DBD
packets
– When the slave router receives DBD it send ack to the master
router with its own LSAs
– Next each router compares the received LSA sequence numbers
with these it has, if some LSAs in the router are older it sends the
LSR (Link State Request) packet for these LSAs
– The other router responses with the LSU (Link State Update)
packet that contains full LSAs information
– The router acks the LSU packet
• After the exchange protocol each router
pre-computes its routing table entries
• Exchange Protocol
• Exchange Protocol
• Maintaining Routing Table
• If router notices the change in the link
state the flooding process is initiated to
populate this information with all routers in
the network (synchronise link databases)
– The router sends LSU packet (with new LSA) to all its DRs using
broadcast 224.0.0.6 address (allOSPFDRs)
– DR acknowledge the packet and sends LSU packet to all adjacent
routers using broadcast address 224.0.0.5
– All adjacent router acknowledge the LSU do DR
– If a Router is on other network it forwards the LSU to appropriate
DR (or DRs)
• After router receives LSU it re-computes its
routing table
• Usually some delay in routing table re-
computation is used to cope with route
flapping
• Maintaining Routing Table
• Each LSA is associated with some timer
usually 30 minutes
• When the LSA timer expires the router that
originates the LSA sends LSU to verify that
the link is still active
• When a router receives the LSU packets it
does the following
– it checks if the LSA is in its database if so it compares the
sequence numbers if are the same the LSU is ignored
– if the LSA is not in the database the database is updated and the
flooding process is started
– if the sequence number higher start flooding process if not
propagate the LSU
– after the flooding process pre-compute new routing table
• Operation on Point-to-Point Links
• The neighbours are discovered by hello
protocol using 224.0.0.5 address
• No DR and BDR router election is done
– the adjacency on point-to-point links is automatic
• All LSA information is propagated to the
other router
• AS Path Attribute
• List of AS identifiers on the path toward
the destination
– Whenever route passes through AS its identifier is pre-penned to it
by the BGP router
• Allows to detect and eliminate route loops
• Next-hop Attribute
• Address of the next router on the path
towards the destination
• For eBGP it is the address of the router
that sent the path information (neighbour
address)
– Router A advertises the network 172.16.0.0 to B with next hop
172.15.10.1
• For iBGP the next hop advertised by the
EBGP should be curried into the IBGP
– Router B will advertise network 172.16.0.0 to C with next hop
172.15.10.1
– Router C has to know how to reach 172.15.10.1
• Origin Attribute
• Origin of the path information
– IGP – the route is internal to the AS
» Explicitly configured in BGP to be advertised
» Redistributed from IGP
– EGP – the route was learned from other AS via EGP protocol
– Incomplete – the origin is unknown e.g. In case of static routes
redistributed from IGP
• EGP and IGP maintains separate routing
tables
– The routing information can be exchange between tables
• While making route redistribution from IGP
to BGP careful filtering should be done i.e.
the routes that were previously
redistributed from BGP to IGP should not
be considered again
– Some IGP protocols tag external routes
• Local Preference Attribute
• Local preference is an attribute configured
on the router and exchange only inside the
AS
• The route from router with higher local
precedence value will be preferred
• Atomic Aggregate Attribute
• When the router receives overlapping
routes from its peers and selects less
specific route it should include the Atomic
Aggregate attribute in the update message
• Atomic Aggregate attribute informs the
receiving BGP speaker that the less specific
route is advertised without more specific
one
– the AS path attribute may not contain all AS numbers
• A BGP speaker that receives the route with
atomic attribute shall not remove it
– Such route cannot be de-aggregated
• MED Attribute
• The MED attribute is configured on the
router and exchanged between adjacent
ASs
• The MED attribute is an indication to
external peers about the preferred path
into given AS
• Aggregator Attribute
• The AS number and Router ID of the router
that made path summarisation
• Community Attribute
• Community attributes are a means to tag
paths
– The routes can be tagged on incoming or outgoing interface
– Community is a list of values
• The tagging is used for route filtering and
selection
• Community attributes are used to
implement consistent BGP policy routing
rules
• The routers that understand community
attribute must be configured to use it
otherwise the attribute is dropped
• Known communities
– No-export – do not advertised the route to external peers
– No-advertised – do not advertised the route to any peer
– Internet – advertise the route to the Internet
– Local AS – used in confederation to prevent sending packets
outside AS
• BGP Synchronisation
• BGP requires that the route learned via
iBGP is not advertised to external peer
unless the IGP has propagated given
routing information inside the AS
• Synchronisation ensures that the path via
AS is operational
– avoids black holes
• BGP message types
• Open
– Sent after the TCP connection is established
– Includes
» hold time - the maximum time between consecutive keep
alive messages
» router ID - highest IP interface address
• Keep alive
– Sent periodically
• Update
– Contains information about one path (networks list and attributes)
• Notification
– Sent in case of error condition