OSPF and BGP with Packet Tracer (NET 330) - Chromosom3/TechNotes GitHub Wiki

OSPF Setup

When setting up OSPF on a router you will need to do the standard interface setup.

enable
config t
interface gig 0/0 
ip address 10.16.1.1 255.255.255.248
no shutdodwn 
exit
exit
copy run start

Next, you will need to configure OSPF

enable
config t
router ospf 1
network 10.16.1.0 0.0.0.7 area 0
exit
exit
copy run start

Note:

The 1 after OSPF is the process ID. That doesn't matter. The 0 after area specifies the area ID. This must be the same across all the routers in the area. Also with OSPF you are setting up a wildcard mask so the subnet section is inversed.

You can also secure OSPF. To do this run the following commands.

ip ospf message-digest-key 1 md5 GoodPassw0rd
ip ospf authentication message-digest

This will make OSPF use md5 authentication. This means the hash of the password will be used instead of the clear text password.

To check OSPF's status you can use the following commands.

show ip route
show ip ospf
show ip ospf interface gig 0/0

BGP Setup

Since BGP is an exterior protocol you may already have internal routes configured. If so you can use the default-information originate command to share the internal routes with the external routers. You can also run ip default network 192.168.2.0 and ip route 0.0.0.0 0.0.0.0 192.168.2.1 to set up your gateway of last resort. Change the network and the router IP to the correct one for your network.

Now that we have the border router setup we can start setting up communication between BGP routers. You will need to run the following commands to set up BGP neighbors on a device. This will need to be done on each router in the BGP environment.

enable
config t
router bgp 1010
neighbor 192.168.1.2 remote-as 2054
network 192.168.2.0 mask 255.255.255.252

Note that 1010 is the AS for the current router and 2054 is the AS for the neighbor router. The network and mask sections need to be repeated for each network the current router is connected to. This is what the router shares with its BGP neighbors.