What is the difference between BGP and OSPF?

Solution 1:

OSPF is an IGP (internal gateway protocol), while BGP is the only real EGP (exterior gateway protocol) currently.

If you are doing internal routing, i.e. routing within a site, company, or campus, you will want to use OSPF. Typically BGP is needed at a site edge, where you route out to the public internet. In small and medium size networks, static routes to the outside will usually be preferable to setting up BGP. If you have a complicated multi-homed site, regardless of size, you might consider BGP.

You really won't want to use IGRP -- it's the deprecated, older verson of Cisco's proprietary EIGRP (also proprietary). EIGRP is reliable, fairly intuitive, and comparable in performance to OSPF, but runs only on Cisco equipment.

I would not recommend IS-IS for most projects. IS-IS is a link-state protocol like OSPF, but is used rarely, typically only at ISP's these days (though some would call it a widespread, but niche, routing protocol). You can certainly use it if it's available on your platform, but you will find troubleshooting resources harder to come by.

RIP is adequate for and most suitable for a small site, though you on Linux (and most modern platforms), you'll actually be using RIPv2. It is easier to set up than the others mentioned, though it isn't used outside of small network deployments any more because of its limitations. If you're trying to gain knowledge, it makes a good starting point.

OSPF is the vendor-neutral IGP standard (i.e., not Cisco-proprietary), and can be easy to complex, depending on your needs.

I'm assuming you are talking about IPv4 instead of IPv6. Your requirements in this respect (as in others) will have a direct bearing on what routing protocol you use. OSPFv3 is the IPv6 capable version of OSPF ; OSPFv2 is the most common now, but is IPv4 only.

*nix-wise, bsd systems are also good choices for running production-level bsd or ospf deployments, if the hardware can handle the throughput.

Solution 2:

Based on your question, I'm guessing that you are new to networking and just require a high-level answer.

To oversimplify:

  1. BGP (Border Gateway Protocol) is used at the edge of your network to connect your network to the Internet
  2. OSPF (Open Shortest Path First) is used internally inside your network

At the edge of your network, you would use routers to map BGP to OSPF and vice-versa.

Routing is not a simple topic - you should plan to spend a lot of time studying and designing your solution. There are also other protocols available such as RIP, IS-IS and IGRP which may be more suitable for your requirements.


Solution 3:

You do realise that to use IBGP you must create peering relationships between edge routers, and for those edge routers to be able to establish that peering they must also run an IGP such as OSPF, RIP or ISIS. No one runs IBGP on it's own without a proper IGP. IBGP typically only runs on the edge routers and any route reflectors in an AS...not on all the routers, whereas OSPF and the like run on all routers.

I've never seen a network that only runs IBGP. In fact it is virtually impossible since BGP relies on the existing underlying routing table to figure out how to route to the next IBGP peer. The only time it is really used is if a single autonomous system is connected to other ASs by more than one link. For example one router in AS 100 peers with one ISP and another router, also in AS 100, peers with a backup or second ISP. In this case, IBGP is used between those 2 routers. Outside this scenario IBGP should not be used.

For the record IBGP exchanges much more information than OSPF meaning there is more overhead. Also it typically cannot converge as quick since it sits a level above an IGP on the protocol stack.

IGPs are routing protocols (i.e. OSPF, ISIS, EIGRP, RIP).
BGP is a topology protocol that was extended for multihoming scenarios. The "I" in IBGP does not imply it is an IGP.

https://supportforums.cisco.com/thread/2032739