BGP (Border Gateway Protocol) is a routing protocol used between Autonomous Systems.
BGP selects a path with the smallest counts of ASes to the destination.
Initially, it was designed for connections between External Autonomous Systems; however, it has since evolved to include both iBGP (Internal BGP) and eBGP (External BGP).
Since Internal BGP (iBGP) is not currently supported in Packet Tracer (see screenshot below), the topology should only consist of different ASes.
To cofigure BGP, it takes three steps.
The entire BGP configuration is included in the running-config
. Therefore, we will just examine the completed setup on each routers to understand BGP configuration set in this topology.
!
interface GigabitEthernet0/0/0
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/0/1
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/0/2
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/1/0
bandwidth 4000000
ip address 156.12.1.6 255.255.255.252
clock rate 4000000
!
interface Serial0/1/1
bandwidth 1200
ip address 8.8.8.2 255.255.255.0
!
interface Vlan1
no ip address
shutdown
!
router bgp 65000
bgp log-neighbor-changes
no synchronization
neighbor 156.12.1.5 remote-as 10000
neighbor 8.8.8.1 remote-as 20000
!
!
interface Loopback0
ip address 156.100.1.1 255.255.255.0
!
interface Loopback1
ip address 156.100.2.1 255.255.255.0
!
interface Loopback2
ip address 156.100.4.1 255.255.254.0
!
interface GigabitEthernet0/0/0
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/0/1
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/0/2
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/1/0
bandwidth 4000000
ip address 156.12.1.5 255.255.255.252
!
interface Serial0/1/1
bandwidth 4000000
ip address 10.1.1.1 255.255.255.0
clock rate 4000000
!
interface Vlan1
no ip address
shutdown
!
router bgp 10000
bgp log-neighbor-changes
no synchronization
neighbor 156.12.1.6 remote-as 65000
neighbor 10.1.1.2 remote-as 20000
network 156.100.4.0 mask 255.255.254.0
network 156.100.2.0 mask 255.255.255.0
network 156.100.1.0 mask 255.255.255.0
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Loopback1
ip address 1.1.2.1 255.255.255.0
!
interface Loopback2
ip address 1.1.3.1 255.255.255.0
!
interface GigabitEthernet0/0/0
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/0/1
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/0/2
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/1/0
bandwidth 4000000
ip address 10.1.1.2 255.255.255.0
!
interface Serial0/1/1
bandwidth 1200
ip address 8.8.8.1 255.255.255.0
clock rate 1200
!
interface Vlan1
no ip address
shutdown
!
router bgp 20000
bgp log-neighbor-changes
no synchronization
neighbor 10.1.1.1 remote-as 10000
neighbor 8.8.8.2 remote-as 65000
network 124.243.1.0 mask 255.255.255.0
network 124.243.2.0 mask 255.255.255.0
network 124.243.3.0 mask 255.255.255.0
network 1.1.1.0 mask 255.255.255.0
network 1.1.2.0 mask 255.255.255.0
network 1.1.3.0 mask 255.255.255.0
!
Just display the routes table on WAN - BGP 65000
:
WAN1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 3 subnets
B 1.1.1.0/24 [20/0] via 8.8.8.1, 00:00:00
B 1.1.2.0/24 [20/0] via 8.8.8.1, 00:00:00
B 1.1.3.0/24 [20/0] via 8.8.8.1, 00:00:00
8.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 8.8.8.0/24 is directly connected, Serial0/1/1
L 8.8.8.2/32 is directly connected, Serial0/1/1
156.12.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 156.12.1.4/30 is directly connected, Serial0/1/0
L 156.12.1.6/32 is directly connected, Serial0/1/0
156.100.0.0/16 is variably subnetted, 3 subnets, 2 masks
B 156.100.1.0/24 [20/0] via 156.12.1.5, 00:00:00
B 156.100.2.0/24 [20/0] via 156.12.1.5, 00:00:00
B 156.100.4.0/23 [20/0] via 156.12.1.5, 00:00:00
Notice that there are three destination addresses 1.1.X.0/24
routed through 8.8.8.1
on the WAN2
router, not through 156.12.1.5
on the ISP
router.
This is because the path through 8.8.8.1
has fewerAS counts than the path through 156.12.1.5
.
Also notice that there are three destination addresses 156.100.1,2.0/24
, 156.100.4.0/23
routed through 156.12.1.5
on the ISP
router, not through 8.8.8.1
on the WAN2
router.
This is because the calculation for this path was completed before connecting with 8.8.8.1
. Updates for BGP synchronization are done at regular intervals, not on live.