What is the difference between BGP and OSPF?

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 ?


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.