Starting BGP on a router is similar to starting any other routing process, such as RIP or IGRP. The command to start BGP is:
router bgp AutonomousSystemNumber
where AutonomousSystemNumber is the AS number of the local router.
This is where the similarity with other routing protocols stops. When configured under BGP, the following network statement:
network IPAddress
[mask A.B.C.D]
specifies the prefix to announce to BGP peers. Compare this with the configuration of IGPs, where the network-number statement has very different semantics: it specifies the attached networks on which to discover neighbors or peers.
Speaking of peers, there are no mechanisms in BGP-4 to automatically discover neighbors. BGP-4 requires that peers must be specified by IP address. The command to specify a peer is:
neighborIPAddress
remote-asAutonomousSystemNumber
where IPAddress specifies the peer with an AS number of AutonomousSystemNumber.
Let’s look at TraderMary’s
configuration for its connection to ISP-A, as shown in Figure 7-3. Line 1 in the following code block starts BGP
with a local AS number of 100. Line 3 specifies that the prefix
192.200.200.0/26
be announced to
TrdrMary-1’s BGP peers. Line 4
specifies that the network number 30.0.0.0
be
announced as well, with an 8-bit mask (the natural classful mask is
used when a mask is not specified). Line 5 specifies that all static
routes should also be announced. (There are two static routes known
to TrdrMary-1, as shown in lines 7 and 8). Line
6 specifies that TrdrMary-1’s
BGP peer (ISP-A) has an IP address of
192.100.100.254
and an AS number of 192. This is
the only neighbor statement, so in this example TrdrMary-1
has only one peer: ISP-A.
Here’s what the configuration looks like:
hostname TrdrMary-1 ! interface Loopback0 ip address 192.168.1.10 255.255.255.255 ! interface Ethernet0 description * External Network * ip address 192.200.200.1 255.255.255.192 ! interface Ethernet1 ip address 172.16.1.3 255.255.255.0 ! interface Serial1 description * to ISP-A * ip address 192.100.100.253 255.255.255.252 ... 1router bgp 100
2no synchronization
3network 192.200.200.0 mask 255.255.255.192
4network 30.0.0.0
5redistribute static
6neighbor 192.100.100.254 remote-as 192
! ip classless 7ip route 160.160.1.0 255.255.255.0 Ethernet1
8ip route 192.168.3.0 255.255.255.0 Ethernet1
The configuration on ISP-A-1 is very similar.
Line 9 starts BGP on ISP-A-1 with the AS number
192. Line 10 specifies the default route being announced to
TraderMary. Line 11 specifies that
ISP-A-1’s BGP peer
(TrdrMary-1) has an IP address of
192.100.100.253
and an AS number of 100:
hostname ISP-A-1 ! interface Loopback9 ip address 98.2.0.1 255.255.0.0 ! interface Serial0 ip address 192.100.100.254 255.255.255.252 ! 9router bgp 192
10network 0.0.0.0
11neighbor 192.100.100.253 remote-as 100
! no ip classless 12ip route 0.0.0.0 0.0.0.0 Null0
The first question to ask after both peers have been configured is whether the peers see each other. The following command checks the status of the neighbor relationship between TrdrMary-1 and ISP-A-1:
TrdrMary-1#sh ip bgp neighbor 192.100.100.254 13BGP neighbor is 192.100.100.254, remote AS 192, external link
Index 1, Offset 0, Mask 0x2 14BGP version 4, remote router ID 98.2.0.1
15BGP state = Established, table version = 5, up for 00:00:42
...
Line 15 indicates that the BGP state is Established, which implies that the peers see each other.
The configuration in lines 3, 4, and 5 suggests that TrdrMary-1 intends to announce the following prefixes to ISP-A-1:
192.200.200.0/26 30.0.0.0/8 160.160.0.0/16 192.168.3.0/24
and the configuration in line 10 suggests that ISP-A-1 intends to announce the following prefix to TrdrMary-1:
0.0.0.0/0
Let’s check the routing tables for these prefixes:
TrdrMary-1#sh ip route Codes: C - connected, S - static, I - IGRP, 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, * - candidate default Gateway of last resort is 192.100.100.254 to network 0.0.0.0 192.200.200.0/26 is subnetted, 1 subnets C 192.200.200.0 is directly connected, Ethernet0 172.16.0.0/24 is subnetted, 1 subnets C 172.16.1.0 is directly connected, Ethernet1 192.168.1.0/32 is subnetted, 1 subnets C 192.168.1.10 is directly connected, Loopback0 S 192.168.3.0/24 is directly connected, Null0 192.100.100.0/30 is subnetted, 1 subnets C 192.100.100.252 is directly connected, Serial1 160.160.0.0/24 is subnetted, 1 subnets S 160.160.1.0 is directly connected, Ethernet1 B* 0.0.0.0/0 [20/0] via 192.100.100.254, 00:00:46
TrdrMary-1 does receive the default route (as
expected) and modifies its gateway of last resort to
192.100.100.254
(the IP address of
ISP-A-1).
ISP-A-1 receives three routes from TrdrMary-1, as shown in lines 16, 17, and 18:
ISP-A-1#sh ip route ... Gateway of last resort is 0.0.0.0 to network 0.0.0.0 192.200.200.0/26 is subnetted, 1 subnets 16B 192.200.200.0 [20/0] via 192.100.100.253, 00:00:23
17B 160.160.0.0/16 [20/0] via 192.100.100.253, 00:00:23
S* 0.0.0.0/0 is directly connected, Null0 18B 192.168.3.0/24 [20/0] via 192.100.100.253, 00:20:51
...
However, if you look carefully at
ISP-A-1’s routing table,
you’ll see that 30.0.0.0/8
(which
TrdrMary-1 attempted to announce on line 4) is
missing. Why is 30.0.0.0/8
not in
ISP-A-1’s routing table? Think
on this. We will get back to this question in the next
section.