Track event monitor policy configuration example

Network requirements

As shown in Figure 78, Device A has established BGP sessions with Device D and Device E. Traffic from Device D and Device E to the Internet is forwarded through Device A.

Configure a CLI-defined EAA monitor policy on Device A to disconnect the sessions with Device D and Device E when Ten-GigabitEthernet 1/0/1 connected to Device C is down. In this way, traffic from Device D and Device E to the Internet can be forwarded through Device B.

Figure 78: Network diagram

Configuration procedures

# Display BGP peer information for Device A.

<Sysname> display bgp peer ipv4

 BGP local router ID: 1.1.1.1
 Local AS number: 100
 Total number of peers: 3                  Peers in established state: 3

  * - Dynamically created peer
  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

  10.2.1.2                200       13       16    0       0 00:16:12 Established
  10.3.1.2                300       13       16    0       0 00:10:34 Established
  10.3.2.2                300       13       16    0       0 00:10:38 Established

# Create track entry 1 and associate it with the link state of Ten-GigabitEthernet 1/0/1.

<Sysname> system-view
[Sysname] track 1 interface ten-gigabitethernet 1/0/1

# Configure a CLI-defined EAA monitor policy so that the system automatically disables session establishment with Device D and Device E when Ten-GigabitEthernet 1/0/1 is down.

Sysname] rtm cli-policy test
[Sysname-rtm-test] event track 1 state negative
[Sysname-rtm-test] action 0 cli system-view
[Sysname-rtm-test] action 1 cli bgp 100
[Sysname-rtm-test] action 2 cli peer 10.3.1.2 ignore
[Sysname-rtm-test] action 3 cli peer 10.3.2.2 ignore
[Sysname-rtm-test] user-role network-admin
[Sysname-rtm-test] commit
[Sysname-rtm-test] quit

Verifying the configuration

# Shut down Ten-GigabitEthernet 1/0/1.

[Sysname] interface ten-gigabitethernet 1/0/1
[Sysname-Ten-GigabitEthernet1/0/1] shutdown

# Display BGP peer information.

<Sysname> display bgp peer ipv4

 BGP local router ID: 1.1.1.1
 Local AS number: 100
 Total number of peers: 0                  Peers in established state: 0

  * - Dynamically created peer
  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

The command output shows that Device A does not have any BGP peers.