The routers main function is to move an IP packet from one network to another.
The router learns of these networks through a direct connection to them, being statically configured to know of them but a network administrator, and learned automatically through dynamic routing protocols.
There a number of common routing protocols used across LANs and the Internet:
RIPv2 – Routing Information Protocol Version 2
EIGRP – Enhanced Interior Gateway Routing
OSPF – Open Shortest Path First
IS-IS – Intermediate System to Intermediate System
BGP – Border Gateway Protocol
With the exception of BGP, all of the protocols are designed for use in an internally owned network and are known as Interior Gateway Protocols, or IGPs.
Exterior Gateway Protocols such as BGP can route between different organisational networks or autonomous systems.
Whilst BGP is an Exterior Gateway Protocol it can be used as an IGP, known as interior BGP or iBGP.