14

I want to setup a dynamic routing network, I want to know, What is the difference between BGP and OSPF ? Does both two need to be used together commonly ?

1
  • 1
    Broadly,OSPF is an Intranetwork protocol that is, it is used with in an AS(Autonomous System) while BGP is an inter network protocol and hence used between two different AS.Definitely they can be used simultaneously depending upon your Network design Jan 5, 2012 at 5:26

6 Answers 6

19

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.

24

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.

3
  • 1
    +1, RIP for small sites; OSPF for medium; BGP for large/complex networks. Also, OpenBSD and FreeBSD make great router platforms.
    – Chris S
    Sep 30, 2010 at 3:43
  • RIP is evil!! Mar 27, 2011 at 0:00
  • @Jed Well, I'm not a big fan, but has it become evil as well?
    – belacqua
    Apr 4, 2011 at 4:45
4

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

0

Based on the tags on your question - are you interested in having your ubuntu-server acting as a router? If this is the case, Ubuntu does appear to have a port of the OSPF protocol in the nemesis-ospf project. For BGP the Vyatta distro (how-to) would be the best choice and can also do OSPF (both are not necessary btw) as well as DNS, DHCP and other services.

More generally, OSPF is going to be a much simpler routing protocol to setup, configure and understand quickly. BGP is much more involved and is likely overkill for a small simple network. OSPF is considered a link-state protocol while BGP is path-vector. The links above will go into much greater detail, but my suggestion is to look into OSPF.

I would, however, suggest using a dedicated box to do your routing and not run it on a box doing other services unless this is only for educational/learning/lab purposes only.

2
  • Any reason you prefer nemesis over quagga?
    – Joris
    Sep 29, 2010 at 6:04
  • No preference - I'm not very familiar with either.
    – Peter
    Sep 29, 2010 at 11:36
0
  1. ospf is internal gateway ,whereas bgp is external gateway.

  2. convergence fast in ospf , slow in bgp.

  3. design - hierarchical network possible in ospf , fully meshed in bgp.

  4. Algorithm - ospf uses Dijkstra Algorithm , bgp uses best path algorithm.

  5. Protocol - ospf has IP protocol , bgp has TCP protocol.

  6. Port - ospf has port 89 , bgp has port 179.

  7. type - Link state in ospf , Path vector in bgp.

  8. Need of device resources - Memory & CPU intensive in ospf , Depends on the size of the routing table but scales better than ospf.

-3

I would say that if you are new to dynamic routing protocols you should look into BGP, it is after all the protocol used for route sharing/discovery on the Internet itself. OSPF is great for certain setups, but even internally BGP makes a great choice, OSPF has too much "magic" for my taste.

4
  • 5
    OSPF uses Dijkstra's algorithm to navigate the routes automatically. It's no "magic" at all; and a lack of understanding is a poor reason to discourage it's use.
    – Chris S
    Sep 30, 2010 at 3:36
  • I put magic in quotes, i.e I wasn't defining OSPF as literally magic. You did understand that right? Did you just flame me on serverfault, give me a break dude. I personally prefer BGP, if your network is complex enough, or you do integrations with many third parties it is often a better choice. OSPF can make it easier to inject routes by mistake for novice users. CHILL OUT Chris.
    – MattyB
    Sep 30, 2010 at 4:25
  • 1
    OSPF or IS-IS to distribute your loopback addresses, BGP to carry all other routing info. Makes the bulk nice and simple. Saying that, OSPF is surprisingly simple, if your network has a topology suited for OSPF. Imposing OSPF on a network can be a nightmare.
    – Vatine
    Sep 30, 2010 at 9:39
  • BGP has a lot more knobs to tune and 'magic' in that different companies can use it differently. (see the various implementations of bgp communities for example) I find BGP overly complex to use if you're not connected to two upstream ISPs.
    – Joel K
    Nov 5, 2010 at 6:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .