BGP Configuration in Cisco Packet Tracer

Aisyah Aldina

Suspension bridge illustration for a guide on BGP in Cisco Packet Tracer

Hi everyone, RIP, OSPF, and EIGRP, which we have already tried, all work inside a single organization. To connect networks that belong to different organizations, for example an office and its ISP, or one ISP and another, we use BGP (Border Gateway Protocol). Every organization has its own number called an AS (Autonomous System), and BGP’s job is to exchange lists of networks between those AS numbers. BGP is the protocol that holds the whole internet together.

In this article I practice eBGP with three AS numbers in Cisco Packet Tracer 8.2.1: two office networks that reach each other through one ISP AS in the middle. If you are not used to dynamic routing yet, read my guide on OSPF configuration in Cisco Packet Tracer first.

Download the Packet Tracer lab file
Open with Cisco Packet Tracer 8.2.1 or later · 3 routers in 3 AS, 2 PCs · eBGP already active
Download .pkt

The Topology and Cables Used

Three different AS numbers

Cisco Packet Tracer window with a BGP topology of three routers in three AS

The topology has 3 Cisco 1941 routers and 2 PCs. Each router sits in a different AS: AS 65001 on the left, AS 65002 at the top in the middle acting as the ISP, and AS 65003 on the right.

Green box AS 65001, orange box AS 65002, and purple box AS 65003

The green box is AS 65001 with LAN 192.168.10.0/24, the orange box is AS 65002 labeled ISP / transit, and the purple box is AS 65003 with LAN 192.168.20.0/24. The note in the middle lists the two eBGP links: 10.0.1.0/30 between Router0 (.1) and Router1 (.2), and 10.0.2.0/30 between Router1 (.1) and Router2 (.2). AS numbers 64512 to 65534 are private, so they are safe to use in a lab, just like private IP addresses.

PC0 Fa0          ->  Router0 Gig0/0   (cross-over)
Router0 Gig0/1   ->  Router1 Gig0/0   (cross-over)
Router1 Gig0/1   ->  Router2 Gig0/1   (cross-over)
Router2 Gig0/0   ->  PC1 Fa0          (cross-over)

Every cable is Copper Cross-Over because every connection is direct with no switch in between: router to router, and PC to router.

Router0 Gig0/0  192.168.10.1/24     Router0 Gig0/1  10.0.1.1/30
Router1 Gig0/0  10.0.1.2/30         Router1 Gig0/1  10.0.2.1/30
Router2 Gig0/1  10.0.2.2/30         Router2 Gig0/0  192.168.20.1/24
PC0  192.168.10.10  gateway 192.168.10.1
PC1  192.168.20.10  gateway 192.168.20.1

Configuring BGP in AS 65001

Open the Router0 CLI

Router0 in AS 65001 marked with a red circle

Click Router0 inside the green box.

CLI tab marked in the Router0 window

Click the CLI tab, then answer no to the initial configuration dialog.

IP addresses, neighbor, and network

Configuring router bgp 65001, neighbor, and network on Router0
enable
configure terminal
hostname R-AS65001
interface gigabitEthernet0/0
ip address 192.168.10.1 255.255.255.0
no shutdown
exit
interface gigabitEthernet0/1
ip address 10.0.1.1 255.255.255.252
no shutdown
exit
router bgp 65001
neighbor 10.0.1.2 remote-as 65002
network 192.168.10.0 mask 255.255.255.0
end
write memory

The router bgp 65001 command starts BGP using this router’s own AS number. Unlike OSPF and EIGRP, BGP does not discover neighbors on its own. You have to type every neighbor by hand, including its IP address and AS number. The network command advertises LAN 192.168.10.0/24 to the neighbor. Notice that the format uses the word mask followed by a subnet mask, not a wildcard mask.

Configuring BGP in AS 65002 (ISP)

Open the Router1 CLI

Router1 in AS 65002 marked with a red circle

Close the Router0 window, then click Router1 in the orange box and open the CLI tab.

Two neighbors, no network

Configuring router bgp 65002 with two neighbors on the ISP router
enable
configure terminal
hostname R-AS65002
interface gigabitEthernet0/0
ip address 10.0.1.2 255.255.255.252
no shutdown
exit
interface gigabitEthernet0/1
ip address 10.0.2.1 255.255.255.252
no shutdown
exit
router bgp 65002
neighbor 10.0.1.1 remote-as 65001
neighbor 10.0.2.2 remote-as 65003
end
write memory

The ISP router has two neighbors, one for each customer. It has no LAN of its own to advertise, so its only job is to pass routing information from one AS to the other. As soon as you type the neighbor 10.0.1.1 line, the message BGP-5-ADJCHANGE: neighbor 10.0.1.1 Up pops up.

Configuring BGP in AS 65003

Open the Router2 CLI

Router2 in AS 65003 marked with a red circle

Close the Router1 window, then click Router2 in the purple box and open the CLI tab.

A neighbor to the ISP and the LAN advertisement

Configuring router bgp 65003, neighbor, and network on Router2
enable
configure terminal
hostname R-AS65003
interface gigabitEthernet0/0
ip address 192.168.20.1 255.255.255.0
no shutdown
exit
interface gigabitEthernet0/1
ip address 10.0.2.2 255.255.255.252
no shutdown
exit
router bgp 65003
neighbor 10.0.2.1 remote-as 65002
network 192.168.20.0 mask 255.255.255.0
end
write memory

Checking the BGP Results

The BGP table and AS path

Output of show ip bgp with AS path 65002 65001

Wait about 20 seconds, then run the following command on Router2.

show ip bgp

There are two networks in the BGP table. The 192.168.10.0/24 line has Next Hop 10.0.2.1 and Path 65002 65001, which means the network comes from AS 65001 and reached this router through AS 65002. This AS path is what makes BGP special: a router can see every AS a route has passed through. The *> mark means the route is valid and is the best one.

The B route in the routing table

B route 192.168.10.0/24 via 10.0.2.1 in the routing table
show ip route bgp

Routes learned from BGP are marked with the letter B, here 192.168.10.0/24 via 10.0.2.1. The [20/0] means the administrative distance of eBGP is 20, so the router trusts it more than OSPF or EIGRP.

Neighbor status

Output of show ip bgp summary with neighbor 10.0.2.1 in AS 65002
show ip bgp summary

Neighbor 10.0.2.1 in AS 65002 shows up with an Up/Down timer that keeps counting. If the State/PfxRcd column shows a number, the session is established and prefixes have been received. If it shows Idle or Active, the session has not formed yet.

Testing the Connection Between AS Numbers

Ping and tracert from PC0 to PC1

PC0 Desktop tab with IP Configuration and Command Prompt marked

Set PC0 to 192.168.10.10 with gateway 192.168.10.1, and PC1 to 192.168.20.10 with gateway 192.168.20.1. Then open the Command Prompt on PC0.

Ping and tracert from PC0 to PC1 passing through three AS
ping 192.168.20.10
tracert 192.168.20.10

The ping succeeds after one timeout caused by ARP. Tracert shows the path going through 192.168.10.1 in AS 65001, 10.0.1.2 in AS 65002, and 10.0.2.2 in AS 65003 before it reaches PC1.

Common Problems and How to Fix Them

The neighbor stays Idle or Active

Check the IP address and AS number in the neighbor command on both sides. The neighbor IP must be the IP of the directly connected interface on the other router, and remote-as must be the other router’s AS number. Also make sure a ping between the routers on the /30 link works.

The network does not show up in show ip bgp on the other routers

The network command has to match a network in the routing table exactly, including its subnet mask. If you type a different mask, BGP will not advertise it.

The route shows up but the ping fails

The router on the other end also needs a route back. Make sure the LANs at both ends are advertised with the network command.

At this point the three AS numbers are exchanging routes with BGP, and the Cisco Packet Tracer series on mamangdigital.com is complete, from basic cabling all the way to routing between AS numbers. If you want to go back to how networks are laid out, I also cover the basic topologies, starting with the star topology in Cisco Packet Tracer. If you run into any other error while trying this, just leave a comment below.

Leave a Comment