Lab 3-6 BGP Troubleshooting
Lab 3-6 BGP Troubleshooting
return
Learning Objectives
Topology
Scenario
You are a network administrator of a company. The company's network uses BGP as
the routing protocol. This network consists of multiple ASs, and different branches
use different AS numbers. You have finished building the company's network. During
BGP configurations, you encountered many problems and have rectified all network
failures.
Tasks
Configure IP addresses and masks for physical interfaces and loopback interfaces of
all the routers. Each Loopback0 uses the 32-bit mask.
<R1>system-view
[R1-Serial1/0/0]quit
[R1]interface LoopBack 0
[R1-LoopBack0]quit
[R2-Serial1/0/0]quit
[R2-Serial2/0/0]quit
[R2]interface LoopBack 0
[R2-LoopBack0]quit
[R3-Serial2/0/0]quit
[R3]interface LoopBack 0
[R3-LoopBack0]quit
[R2]ping -c 1 10.0.12.1
1 packet(s) transmitted
1 packet(s) received
[R2]ping -c 1 10.0.23.3
1 packet(s) transmitted
1 packet(s) received
The preceding command output shows that direct link connectivity is normal.
Configure OSPF in AS 64512 and configure all devices to belong to Area 0. Configure
each router to use Loopback0 address as its router ID. Run OSPF on the network
segments connected to S1/0/0 and Loopback0 of R1.
[R1]router-id 10.0.1.1
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]quit
Run OSPF on the network segments connected to S1/0/0 and Loopback0 of R2.
[R2]router id 10.0.2.2
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]quit
[R2-ospf-1]quit
1 packet(s) transmitted
1 packet(s) received
Configure IBGP between R1 and R2, configure EBGP between R2 and R3, and
configure these routers to establish BGP peer relationships using loopback interface
addresses. To ensure normal transmission of routing information, configure
next-hop-local on R2 and specify R1’s address as the peer address and incorrectly
set the AS number of the peer 10.0.2.2 to 64514 on R3.
[R1]bgp 64512
[R1-bgp]quit
[R2]bgp 64512
[R2-bgp]quit
[R3]router id 10.0.3.3
[R3]bgp 64513
[R3-bgp]quit
After the configurations are complete, you can see that BGP peer relationships
between routers are not established. Check the BGP peer relationships of R2 first.
The preceding command output shows that the State field of 10.0.1.1 displays
Active and the State field of 10.0.2.2 displays idle. If a BGP peer relationship is
established normally, the State field displays Established. If the State field remains
another state for a long period, a failure occurs and needs to be rectified.
Generally, when a peer IP address is unreachable for a local router, the peer status
displays Idle. That is, this router does not initiate a TCP connection with the peer.
When the peer IP address is reachable but an error occurs during the establishment
of a TCP connection, you can see that the peer status remains Active.
First check the BGP peer relationship between R2 and R3 and check connectivity
between loopback interface addresses of R2 and R3.
1 packet(s) transmitted
0 packet(s) received
[R2]display ip routing-table
----------------------------------------------------------------------------
Destinations : 14 Routes : 14
The preceding command output shows that there is no route to 10.0.3.3 of R3.
[R3]display ip routing-table
----------------------------------------------------------------------------
Destinations : 9 Routes : 9
The preceding command output shows that there is no route to 10.0.2.2 of R2.
For different ASs, using static routes can ensure connectivity between loopback
interface addresses of neighboring routers.
On R2 and R3, you need to configure static routes to the network segments
connected to the loopback interfaces of R3 and R2 respectively.
1 packet(s) transmitted
1 packet(s) received
The BGP peer relationship between R2 and R3 changes from Idle to Active state.
Check the BGP peer relationship between R1 and R2. After OSPF is configured,
connectivity between loopback interface addresses of R1 and R2 has been tested.
BGP uses TCP port 179 for communication. Check whether port 179 is enabled on
the routers.
The preceding command output shows that port 179 for corresponding peer
address is in Listening state. BGP works normally on a single router.
Run the debugging command on R1 to check whether R1 receives BGP packets sent
from R2.
<R1>terminal monitor
<R1>terminal debugging
ack = 2254758725,datalen = 0,optlen = 0,flag = ACK RST ,window = 0,ttl = 255,tos = 0,MSS = 0)
The preceding command output shows that the source address of the packet with
the destination port number 179 is 10.0.12.2. After checking the topology, you can
see that 10.0.12.2 is the address of R2's Serial1/0/0.
When establishing BGP peer relationships, you use the loopback interface address of
R2. As a result, the BGP peer relationship between R1 and R2 cannot be established.
Therefore, you need to use connect-interface to specify the source address during
establishment of BGP peer relationships.
Similarly, this problem also exists between R2 and R3. Therefore, you need to use
connect-interface to specify the source address during establishment of BGP peer
relationships.
[R1]bgp 64512
[R1-bgp]quit
[R2]bgp 64512
[R2-bgp]quit
[R3]bgp 64513
[R3-bgp]quit
After the modifications are complete, check BGP peer relationships of R2 again.
The preceding command output shows that the BGP peer relationship between R1
and R2 is in Established state.
Run the debugging command on R3 to check whether R3 receives any BGP packet
and check the content of the packet.
<R3>terminal monitor
<R3>terminal debugging
<R3>debugging ip packet
The preceding command output shows that the TTL of the BGP packet received by
R3 is 1. For EBGP, the default TTL of the packet sent from a router to its peer is 1.
In this scenario, R2 and R3 establish a BGP peer relationship using loopback interface
addresses. There are two hops from the loopback interface address of R2 to that of
R3. Therefore, before this BGP packet reaches the loopback interface address of R2, it
is discarded because of TTL expiry.
To address this problem, change the TTL of the packet sent between two EBGP peers.
[R2]bgp 64512
[R2-bgp]quit
[R3]bgp 64513
[R3-bgp]quit
After the configurations are complete, check the BGP peer relationship of R2 again.
The preceding command output shows that the BGP peer relationship between R2
and R3 remains Active.
<R3>terminal debugging
The preceding command output shows that the error code/suberror code is 2. This
error indicates incorrect AS number. You need to change the peer AS number on R3.
[R3]bgp 64513
[R3-bgp]quit
To prevent malicious users from forging valid routers to establish BGP peer
relationships with BGP routers, configure MD5 authentication between BGP peers.
[R1]bgp 64512
[R1-bgp]quit
[R2]bgp 64512
[R2-bgp]quit
Reset the BGP peer relationship of R1. The following command output shows that
the peer relationship between R1 and R2 remains Connect and Active and cannot
enter the Established state.
[R2]bgp 64512
[R2-bgp]quit
Wait for about 30 seconds, and then check the peer relationship again.
The preceding command output shows that the peer relationship between R1 and
R2 has reached the Established state.
In this scenario, the administrator of AS 64512 does not want the routers in AS 64513
to view its actual AS number.
The fake-as parameter can achieve this purpose. It can specify a fake AS number for
the peer.
Configure this command on R2, specify R3's address as the peer address, and set the
fake AS number to 100.
[R2]bgp 64512
[R2-bgp]quit
[R3]bgp 64513
[R3-bgp]quit
Check the BGP peer of R3. The following command output shows that the AS
number of R2 changes to 100.
On R2, advertise the network segment where its Loopback0 resides and observe the
AS_Path attribute of the BGP route learned from R3.
[R2]bgp 64512
[R2-bgp]network 10.0.2.2 32
[R2-bgp]quit
The preceding command output shows that the AS_Path attribute of the BGP route
10.0.2.2/32 learned from R3 is 100. That is, R3 considers that this route is originated
from AS 100. In this situation, AS 64512 is not displayed.
In this scenario, enable GTSM on the link between R2 and R3 to observe BGP packet
exchange. First, in the system view of R2, configure the default action to be taken on
BGP packets whose TTL value is not within the specified range. Here, you configure
the default action to drop. That is, the BGP packets whose TTL value is not within the
specified range will be discarded.
In the BGP view of R2, specify R3's address as the peer address and enable GTSM.
Before performing this configuration, you need to delete the ebgp-max-hop
configuration. Because R2 and R3 are directly connected, the valid-ttl-hops
parameter is 1.
[R2]bgp 64512
[R2-bgp]quit
[R1]bgp 64512
[R1-bgp]quit
[R3]bgp 64513
[R3-bgp]quit
<R3>terminal monitor
<R3>terminal debugging
<R3>debugging ip packet
The preceding command output shows that the TTL value of packets received by R3
from R2 is 255 instead of the default value 1. To confirm that GTSM discards the BGP
packets whose TTL value is not within the specified range, enable the GTSM log
function on R3. When BGP packets are discarded by GTSM, a log is recorded.
Run the ebgp-max-hop command on R2 to ensure that the TTL value of BGP
packets sent from R2 to R3 is less than 254.
[R2]bgp 64512
[R2-bgp]quit
After waiting for a certain period, you can see that the BGP peer relationship
between R2 and R3 is in Idle state. Check GTSM statistics on R3. The following
command output shows that some BGP packets are discarded by GTSM.
----------------------------------------------------------------
----------------------------------------------------------------
0 BGP 83 27 56
0 OSPF 0 0 0
0 LDP 0 0 0
----------------------------------------------------------------
[R2]bgp 64512
[R2-bgp]quit
----------------------------------------------------------------
----------------------------------------------------------------
0 BGP 89 27 62
0 OSPF 0 0 0
0 LDP 0 0 0
----------------------------------------------------------------
The preceding command output shows that no more BGP packets are discarded.
----End
Device Configurations
<R1>display current-configuration
[V200R007C00SPC600]
sysname R1
router id 10.0.1.1
interface Serial1/0/0
link-protocol ppp
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
area 0.0.0.0
return
<R2>display current-configuration
[V200R007C00SPC600]
sysname R2
router id 10.0.2.2
interface Serial1/0/0
link-protocol ppp
interface Serial2/0/0
link-protocol ppp
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
area 0.0.0.0
return
<R3>display current-configuration
[V200R007C00SPC600]
sysname R3
router id 10.0.3.3
interface Serial2/0/0
link-protocol ppp
interface LoopBack0
bgp 64513
ipv4-family unicast
undo synchronization
return