The OSPF (Open Shortest Path First) protocol is one of a family of IP Routing protocols, and is an Interior Gateway Protocol (IGP) for the Internet, used to distribute IP routing information throughout a single Autonomous System (AS) in an IP network.
The OSPF protocol is a link-state routing protocol, which means that the routers exchange topology information with their nearest neighbors. The topology information is flooded throughout the AS, so that every router within the AS has a complete picture of the topology of the AS. This picture is then used to calculate end-to-end paths through the AS, normally using a variant of the Dijkstra algorithm. Therefore, in a link-state routing protocol, the next hop address to which data is forwarded is determined by choosing the best end-to-end path to the eventual destination.
The main advantage of a link state routing protocol like OSPF is that the complete knowledge of topology allows routers to calculate routes that satisfy particular criteria. This can be useful for traffic engineering purposes, where routes can be constrained to meet particular quality of service requirements. The main disadvantage of a link state routing protocol is that it does not scale well as more routers are added to the routing domain. Increasing the number of routers increases the size and frequency of the topology updates, and also the length of time it takes to calculate end-to-end routes. This lack of scalability means that a link state routing protocol is unsuitable for routing across the Internet at large, which is the reason why IGPs only route traffic within a single AS.
Each OSPF router distributes information about its local state (usable interfaces and reachable neighbors, and the cost of using each interface) to other routers using a Link State Advertisement (LSA) message. Each router uses the received messages to build up an identical database that describes the topology of the AS.
From this database, each router calculates its own routing table using a Shortest Path First (SPF) or Dijkstra algorithm. This routing table contains all the destinations the routing protocol knows about, associated with a next hop IP address and outgoing interface.
- The protocol recalculates routes when network topology changes, using the Dijkstra algorithm, and minimises the routing protocol traffic that it generates.
- It provides support for multiple paths of equal cost.
- It provides a multi-level hierarchy (two-level for OSPF) called “area routing,” so that information about the topology within a defined area of the AS is hidden from routers outside this area. This enables an additional level of routing protection and a reduction in routing protocol traffic.
- All protocol exchanges can be authenticated so that only trusted routers can join in the routing exchanges for the AS.
OSPF Version 3 (OSPFv3)
OSPF version 2 (OSPFv2) is used with IPv4. OSPFv3 has been updated for compatibility with IPv6’s 128-bit address space. However, this is not the only difference between OSPFv2 and OSPFv3. Other changes in OSPFv3, as defined in RFC 2740, include
- protocol processing per-link not per-subnet
- addition of flooding scope, which may be link-local, area or AS-wide
- removal of opaque LSAs
- support for multiple instances of OSPF per link
- various packet and LSA format changes (including removal of addressing semantics).
Both OSPFv2 and OSPFv3 are fully supported by DC-OSPF.
BGP:
BGP (Border Gateway Protocol) is the protocol underlying the global routing system of the internet. It manages how packets get routed from network to network through the exchange of routing and reachability information among edge routers. BGP directs packets between autonomous systems (AS), which are networks managed by a single enterprise or service provider.
BGP creates network stability by guaranteeing routers can adapt to route failures: when one path goes down, a new path is quickly found. BGP makes routing decisions based on paths, defined by rules or network policies set by network administrators.
How does BGP work?
Each router maintains a routing table controlling how packets are directed. Routing table information is generated by the BGP process on the router, based on incoming information from other routers, and information in the BGP routing information base (RIB), which is a data table stored on a server on the BGP router. The RIB contains information both from directly connected external peers, as well as internal peers, and based on policies for what routes should be used and what information should be published, continually updates the routing table as changes occur.
What is BGP used for?
BGP offers network stability that guarantees routers can quickly adapt to send packets through another reconnection if one internet path goes down. BGP makes routing decisions based on paths, rules or network policies configured by a network administrator. Each BGP router maintains a standard routing table used to direct packets in transit. BGP uses client-server topology to communicate routing information, with the client-server initiating a BGP session by sending a request to the server.
BGP routing basics
BGP sends updated router table information only when something changes, and only the affected information. BGP has no automatic discovery mechanism, which means connections between peers must be set up manually, with peer addresses programmed in at both ends.
BGP makes best-path decisions based on current reachability, hop counts and other path characteristics. In situations where multiple paths are available — as within a major hosting facility — BGP policies communicate an organization’s preferences for what path traffic should follow in and out. BGP community tags can control route advertisement behavior among peers.
BGP in networking is based on TCP/IP. It operates on the OSI Transport Layer (Layer 4) to control the Network Layer (Layer 3). As described in RFC4271 and ratified in 2006, the current version of BGP-4 supports both IPv6 and Classless Inter-Domain Routing (CIDR), which enables the continued viability of IPv4. Use of the CIDR is a way to have more addresses within the network than with the current IP address assignment scheme.
Common BGP issues
Common issues with BGP include information exchange failures. Information exchanges don’t always succeed as information can be improperly formatted or contain incorrect data. Routers can run out of memory or storage, or be too slow to respond to updates. Routers send error codes and subcodes to communicate problems including timeouts, malformed requests and processing problems.
BGP security
BGP is also vulnerable to attacks based on misinformation. Malicious actors can flood a router with bad packets in a denial-of-service attack, for example. They can also claim to be the source of routing information for an AS, and (temporarily) control where traffic headed from that AS goes, a practice known as BGP hijacking.
Difference between internal and external BGP, OSPF
When BGP is used to route within a single AS, it is called internal BGP, or iBGP. When used to connect one AS to others, it is called external BGP, or eBGP.
The OSPF (Open Shortest Path First) protocol is used only in internal networks. OSPF is focused on finding the shortest route available between nodes, and on failing over to that shortest route as quickly as possible. BGP is slower to fail to a new route but is more scalable. OSPF is essentially hierarchical in structure, while BGP is a mesh. Some networks are replacing OSPF with iBGP.
Facebook outage
Social media applications Facebook, Instagram and WhatsApp went offline for six hours on Oct. 4, 2021. The outage was reportedly due to there being no working BGP routes into the social media sites and the DNS servers going offline. This essentially disconnected the social media apps from the internet.