Sei sulla pagina 1di 14

7/5/2019

Centro de soporte de HPE

HP 5800/5830 Switch/6600 Router Series - BGP Configuration: BGP


Configuration Examples
BGP basic configuration
BGP and IGP synchronization configuration

BGP load balancing configuration

BGP community configuration

BGP route reflector configuration


BGP confederation configuration
BGP path selection configuration

BGP GR configuration

Configuring BFD for BGP

BGP basic configuration


Network requirements:

In Figure 1, run eBGP between Router A and Router B and iBGP between Router B and Router C so that Router C can access the network
8.1.1.0/24 connected to Router A.

Figure 1: Network diagram for BGP basic configuration

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure iBGP.
To prevent route flapping caused by port state changes, this example uses loopback interfaces to establish iBGP connections.
Because loopback interfaces are virtual interfaces, the user needs to use the peer connect-interface command to
specify the loopback interface as the source interface for establishing BGP connections.
Enable OSPF in AS 65009 to ensure that Router B can communicate with Router C through loopback interfaces.
Configure Router B:
<RouterB> system-view
[RouterB] bgp 65009
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp] peer 3.3.3.3 as-number 65009
[RouterB-bgp] peer 3.3.3.3 connect-interface loopback 0
[RouterB-bgp] quit
[RouterB] ospf 1
[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[RouterB-ospf-1-area-0.0.0.0] network 9.1.1.1 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] quit
Configure Router C:
<RouterC> system-view
[RouterC] bgp 65009
[RouterC-bgp] router-id 3.3.3.3
[RouterC-bgp] peer 2.2.2.2 as-number 65009
[RouterC-bgp] peer 2.2.2.2 connect-interface loopback 0
[RouterC-bgp] quit
[RouterC] ospf 1
[RouterC-ospf-1] area 0
[RouterC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
[RouterC-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] quit
[RouterC-ospf-1] quit
[RouterC] display bgp peer

BGP local router ID : 3.3.3.3


Local AS number : 65009
Total number of peers : 1 Peers in established state : 1

Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State

2.2.2.2 65009 7 10 0 0 00:06:09 Established


The output information shows that Router C has established an iBGP peer relationship with Router B.

1/14
7/5/2019
3. Configure eBGP.
The eBGP peers, Router A and Router B (usually belong to different ISPs), are located in different ASs. Typically, their
loopback interfaces are not reachable to each other, so directly connected interfaces are used for establishing BGP sessions.
To enable Router C to access the network 8.1.1.0/24 connected directly to Router A, inject network 8.1.1.0/24 to the BGP
routing table of Router A.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 65008
[RouterA-bgp] router-id 1.1.1.1
[RouterA-bgp] peer 3.1.1.1 as-number 65009
[RouterA-bgp] network 8.1.1.1 24
[RouterA-bgp] quit
Configure Router B:
[RouterB] bgp 65009
[RouterB-bgp] peer 3.1.1.2 as-number 65008
[RouterB-bgp] quit
Display BGP peer information on Router B:
[RouterB] display bgp peer

BGP local router ID : 2.2.2.2


Local AS number : 65009
Total number of peers : 2 Peers in established state : 2

Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State

3.3.3.3 65009 12 10 0 3 00:09:16 Established


3.1.1.2 65008 3 3 0 1 00:00:08 Established
The output shows that Router B has established an iBGP peer relationship with Router C and an eBGP peer relationship with Router
A.
Display the BGP routing table on Router A:
[RouterA] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 1.1.1.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

*> 8.1.1.0/24 0.0.0.0 0 0 i


Display the BGP routing table on Router B:
[RouterB] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 2.2.2.2


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

*> 8.1.1.0/24 3.1.1.2 0 0 65008i


Display the BGP routing table on Router C:
[RouterC] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 3.3.3.3


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

i 8.1.1.0/24 3.1.1.2 0 100 0 65008i


From the outputs, you can find Router A has learned no route to AS65009, and Router C has learned network 8.1.1.0 but the next
hop 3.1.1.2 is unreachable, and thus the route is invalid.
4. Redistribute direct routes.
Configure BGP to redistribute direct routes on Router B, so that Router A can obtain the route to 9.1.1.0/24 and Router C can obtain
the route to 3.1.1.0/24.
Configure Router B:
[RouterB] bgp 65009
[RouterB-bgp] import-route direct
Display the BGP routing table on Router A:
[RouterA] display bgp routing-table

Total Number of Routes: 4

BGP Local router ID is 1.1.1.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? – incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

*> 2.2.2.2/32 3.1.1.1 0 0 65009?


* 3.1.1.0/24 3.1.1.1 0 0 65009?
*> 8.1.1.0/24 0.0.0.0 0 0 i
*> 9.1.1.0/24 3.1.1.1 0 0 65009?
Two routes 2.2.2.2/32 and 9.1.1.0/24 have been added in Router A’s routing table.

2/14
7/5/2019
Display the BGP routing table on Router C:
[RouterC] display bgp routing-table

Total Number of Routes: 4

BGP Local router ID is 3.3.3.3


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

i 2.2.2.2/32 2.2.2.2 0 100 0 ?


*>i 3.1.1.0/24 2.2.2.2 0 100 0 ?
*>i 8.1.1.0/24 3.1.1.2 0 100 0 65008i
* i 9.1.1.0/24 2.2.2.2 0 100 0 ?
The output shows that the route 8.1.1.0 becomes valid with the next hop as Router A.
5. Verification.
Ping 8.1.1.1 on Router C:
[RouterC] ping 8.1.1.1
PING 8.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 8.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=2 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=3 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=4 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=5 ttl=254 time=2 ms
--- 8.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/2 ms

top

BGP and IGP synchronization configuration


Network requirements:

As shown in Figure 2, all devices of company A belong to AS 65008 while all devices of company B belong to AS 65009. AS 65008 and AS
65009 are connected through Router A and Router B. It is required that Router A can access network 9.1.2.0/24 in AS 65009, and Router C
can access network 8.1.1.0/24 in AS 65008.

Figure 2: Network diagram for BGP and IGP synchronization

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure OSPF.
Enable OSPF in AS 65009, so that Router B can obtain the route to 9.1.2.0/24.
Configure Router B:
<RouterB> system-view
[RouterB] ospf 1
[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[RouterB-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] quit
Configure Router C:
<RouterC> system-view
[RouterC] ospf 1
[RouterC-ospf-1] import-route direct
[RouterC-ospf-1] area 0
[RouterC-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] quit
[RouterC-ospf-1] quit
3. Configure the eBGP connection.
Configure the eBGP connection and inject network 8.1.1.0/24 to the BGP routing table of Router A, so that Router B can obtain the
route to 8.1.1.0/24.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 65008
[RouterA-bgp] router-id 1.1.1.1
[RouterA-bgp] peer 3.1.1.1 as-number 65009
[RouterA-bgp] network 8.1.1.0 24
[RouterA-bgp] quit
Configure Router B:
[RouterB] bgp 65009
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp] peer 3.1.1.2 as-number 65008
4. Configure BGP and IGP synchronization.
Configure BGP to redistribute routes from OSPF on Router B, so that Router A can obtain the route to 9.1.2.0/24.
Configure OSPF to redistribute routes from BGP on Router B, so that Router C can obtain the route to 8.1.1.0/24.
Configure BGP to redistribute routes from OSPF on Router B:

3/14
7/5/2019
[RouterB-bgp] import-route ospf 1
[RouterB-bgp] quit
[RouterB] ospf 1
[RouterB-ospf-1] import-route bgp
[RouterB-ospf-1] quit
Display the BGP routing table on Router A:
[RouterA] display bgp routing-table

Total Number of Routes: 3

BGP Local router ID is 1.1.1.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

*> 3.3.3.3/32 3.1.1.1 1 0 65009?


*> 8.1.1.0/24 0.0.0.0 0 0 i
*> 9.1.2.0/24 3.1.1.1 1 0 65009?
Display the routing table on Router C:
[RouterC] display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9

Destination/Mask Proto Pre Cost NextHop Interface

2.2.2.2/32 OSPF 10 1 9.1.1.1 S2/2/0


3.3.3.3/32 Direct 0 0 127.0.0.1 InLoop0
8.1.1.0/24 O_ASE 150 1 9.1.1.1 S2/2/0
9.1.1.0/24 Direct 0 0 9.1.1.2 S2/2/0
9.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
9.1.2.0/24 Direct 0 0 9.1.2.1 GE2/1/1
9.1.2.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
5. Verification.
Use ping for verification:
[RouterA] ping -a 8.1.1.1 9.1.2.1
PING 9.1.2.1: 56 data bytes, press CTRL_C to break
Reply from 9.1.2.1: bytes=56 Sequence=1 ttl=254 time=15 ms
Reply from 9.1.2.1: bytes=56 Sequence=2 ttl=254 time=31 ms
Reply from 9.1.2.1: bytes=56 Sequence=3 ttl=254 time=47 ms
Reply from 9.1.2.1: bytes=56 Sequence=4 ttl=254 time=46 ms
Reply from 9.1.2.1: bytes=56 Sequence=5 ttl=254 time=47 ms

--- 9.1.2.1 ping statistics ---


5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/37/47 ms
[RouterC] ping -a 9.1.2.1 8.1.1.1
PING 8.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 8.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=2 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=3 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=4 ttl=254 time=2 ms
Reply from 8.1.1.1: bytes=56 Sequence=5 ttl=254 time=2 ms

--- 8.1.1.1 ping statistics ---


5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/2 ms

top

BGP load balancing configuration


Network requirements:

As shown in Figure 3, all routers run BGP, and Router A resides in AS 65008, Router B and Router C in AS 65009. Between Router A and
Router B, Router A and Router C are eBGP connections, and between Router B and Router C is an iBGP connection. Two routes are
configured on Router A for load balancing.

Figure 3: Network diagram for BGP load balancing configuration

4/14
7/5/2019

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure BGP connections.
On Router A, establish eBGP connections with Router B and Router C, respectively. Configure BGP to advertise network
8.1.1.0/24 to Router B and Router C, so that Router B and Router C can access the internal network connected to Router A.
On Router B, establish an eBGP connection with Router A and an iBGP connection with Router C. Configure BGP to
advertise network 9.1.1.0/24 to Router A, so that Router A can access the intranet through Router B;. Configure a static route
to interface loopback 0 on Router C (or use a routing protocol like OSPF) to establish the iBGP connection.
On Router C, establish an eBGP connection with Router A and an iBGP connection with Router B. Configure BGP to
advertise network 9.1.1.0/24 to Router A, so that Router A can access the intranet through Router C. Configure a static route
to interface loopback 0 on Router B (or use another protocol like OSPF) to establish the iBGP connection.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 65008
[RouterA-bgp] router-id 1.1.1.1
[RouterA-bgp] peer 3.1.1.1 as-number 65009
[RouterA-bgp] peer 3.1.2.1 as-number 65009
[RouterA-bgp] network 8.1.1.1 24
[RouterA-bgp] quit
Configure Router B:
<RouterB> system-view
[RouterB] bgp 65009
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp] peer 3.1.1.2 as-number 65008
[RouterB-bgp] peer 3.3.3.3 as-number 65009
[RouterB-bgp] peer 3.3.3.3 connect-interface loopback 0
[RouterB-bgp] network 9.1.1.0 24
[RouterB-bgp] quit
[RouterB] ip route-static 3.3.3.3 32 9.1.1.2
Configure Router C:
<RouterC> system-view
[RouterC] bgp 65009
[RouterC-bgp] router-id 3.3.3.3
[RouterC-bgp] peer 3.1.2.2 as-number 65008
[RouterC-bgp] peer 2.2.2.2 as-number 65009
[RouterC-bgp] peer 2.2.2.2 connect-interface loopback 0
[RouterC-bgp] network 9.1.1.0 24
[RouterC-bgp] quit
[RouterC] ip route-static 2.2.2.2 32 9.1.1.1
Display the BGP routing table on Router A:
[RouterA] display bgp routing-table

Total Number of Routes: 3

BGP Local router ID is 1.1.1.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? – incomplete

Network NextHop MED LocPrf PrefVal Path/Ogn

*> 8.1.1.0/24 0.0.0.0 0 0 i


*> 9.1.1.0/24 3.1.1.1 0 0 65009i
* 3.1.2.1 0 0 65009i
The output shows two valid routes to destination 9.1.1.0/24: the route with next hop 3.1.1.1 is marked with a greater-than sign
(>), indicating it is the best route (because the ID of Router B is smaller); the route with next hop 3.1.2.1 is marked with only
an asterisk (*), indicating it is a valid route, but not the best.
Using the display ip routing-table command, the user can find only one route to 9.1.1.0/24 with next hop 3.1.1.1 and
outbound interface S2/2/0.
3. Configure loading balancing.
Since Router A has two routes to reach AS 65009, configuring load balancing over the two BGP routes on Router A can improve link
use.
Configure Router A:
[RouterA] bgp 65008
[RouterA-bgp] balance 2
[RouterA-bgp] quit
4. Verification.
Display the BGP routing table on Router A:
[RouterA] display bgp routing-table

Total Number of Routes: 3

BGP Local router ID is 1.1.1.1

5/14
7/5/2019
Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

*> 8.1.1.0/24 0.0.0.0 0 0 i


*> 9.1.1.0/24 3.1.1.1 0 0 65009i
*> 3.1.2.1 0 0 65009i
From the previous output information, you can find two valid routes to the destination 9.1.1.0/24, and both of them are marked
with a greater-than sign (>), indicating they are the best routes.
Using the display ip routing-table command, the user can find two routes to 9.1.1.0/24: one with next hop 3.1.1.1
and outbound interface S2/2/0, the other with next hop 3.1.2.1 and outbound interface S2/2/1.

top

BGP community configuration


Network requirements:

As shown in Figure 4, Router B establishes eBGP connections with Router A and Router C. Configure No_Export community attribute on
Router A to make routes from AS 10 not advertised by AS 20 to any other AS.

Figure 4: Network diagram for BGP community configuration

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure eBGP connections.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 10
[RouterA-bgp] router-id 1.1.1.1
[RouterA-bgp] peer 200.1.2.2 as-number 20
[RouterA-bgp] network 9.1.1.0 255.255.255.0
[RouterA-bgp] quit
Configure Router B:
<RouterB> system-view
[RouterB] bgp 20
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp] peer 200.1.2.1 as-number 10
[RouterB-bgp] peer 200.1.3.2 as-number 30
[RouterB-bgp] quit
Configure Router C:
<RouterC> system-view
[RouterC] bgp 30
[RouterC-bgp] router-id 3.3.3.3
[RouterC-bgp] peer 200.1.3.1 as-number 20
[RouterC-bgp] quit
Display BGP routing table information on Router B:
[RouterB] display bgp routing-table 9.1.1.0

BGP local router ID : 2.2.2.2


Local AS number : 20
Paths: 1 available, 1 best

BGP routing table entry information of 9.1.1.0/24:


From : 200.1.2.1 (1.1.1.1)
Original nexthop: 200.1.2.1
AS-path : 10
Origin : igp
Attribute value : MED 0, pref-val 0, pre 255
State : valid, external, best,
Advertised to such 1 peers:
200.1.3.2
Router B has advertised the route to Router C in AS 30.
Display BGP routing table information on Router C:
[RouterC] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 3.3.3.3


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

6/14
7/5/2019

*> 9.1.1.0/24 200.1.3.1 0 0 20 10i


Router C has learned the route to the destination 9.1.1.0/24 from Router B.
3. Configure BGP community attribute.
Configure a routing policy:
[RouterA] route-policy comm_policy permit node 0
[RouterA-route-policy] apply community no-export
[RouterA-route-policy] quit
Apply the routing policy:
[RouterA] bgp 10
[RouterA-bgp] peer 200.1.2.2 route-policy comm_policy export
[RouterA-bgp] peer 200.1.2.2 advertise-community
Display BGP routing table information on Router B:
[RouterB] display bgp routing-table 9.1.1.0
BGP local router ID : 2.2.2.2
Local AS number : 20
Paths: 1 available, 1 best

BGP routing table entry information of 9.1.1.0/24:


From : 200.1.2.1 (1.1.1.1)
Original nexthop: 200.1.2.1
Community : No-Export
AS-path : 10
Origin : igp
Attribute value : MED 0, pref-val 0, pre 255
State : valid, external, best,
Not advertised to any peers yet
User can find the No-export community attribute in the previous output information. In this case, the route of 9.1.1.0/24 is not
available in the routing table of Router C.

top

BGP route reflector configuration


Network requirements:

In Figure 5, all routers run BGP.

Between Router A and Router B is an eBGP connection, and between Router C and Router B, and between Router C and Router D
are iBGP connections.
Router C is a route reflector with clients Router B and D.
Router D can learn route 1.0.0.0/8 from Router C.

Figure 5: Network diagram for BGP route reflector configuration

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure BGP connections.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 100
[RouterA-bgp] peer 192.1.1.2 as-number 200
Inject network 1.0.0.0/8 to the BGP routing table:
[RouterA-bgp] network 1.0.0.0
[RouterA-bgp] quit
Configure Router B:
<RouterB> system-view
[RouterB] bgp 200
[RouterB-bgp] peer 192.1.1.1 as-number 100
[RouterB-bgp] peer 193.1.1.1 as-number 200
[RouterB-bgp] peer 193.1.1.1 next-hop-local
[RouterB-bgp] quit
Configure Router C:
<RouterC> system-view
[RouterC] bgp 200
[RouterC-bgp] peer 193.1.1.2 as-number 200
[RouterC-bgp] peer 194.1.1.2 as-number 200
[RouterC-bgp] quit
Configure Router D:
<RouterD> system-view
[RouterD] bgp 200
[RouterD-bgp] peer 194.1.1.1 as-number 200
[RouterD-bgp] quit
3. Configure the route reflector.
Configure Router C as the route reflector:

7/14
7/5/2019
[RouterC] bgp 200
[RouterC-bgp] peer 193.1.1.2 reflect-client
[RouterC-bgp] peer 194.1.1.2 reflect-client
[RouterC-bgp] quit
4. Verify the configuration.
Display the BGP routing table on Router B:
[RouterB] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 200.1.2.2


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

*> 1.0.0.0 192.1.1.1 0 0 100i


Display the BGP routing table on Router D:
[RouterD] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 200.1.2.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

i 1.0.0.0 193.1.1.2 0 100 0 100i


Router D learned the route 1.0.0.0/8 from Router C.

top

BGP confederation configuration


Network requirements:

As shown in Figure 6, to reduce iBGP connections in AS 200, split it into three sub-ASs, AS65001, AS65002 and AS65003. Routers in
AS65001 are fully meshed.

Figure 6: Network diagram for BGP confederation configuration

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure BGP confederation.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 65001
[RouterA-bgp] router-id 1.1.1.1
[RouterA-bgp] confederation id 200
[RouterA-bgp] confederation peer-as 65002 65003
[RouterA-bgp] peer 10.1.1.2 as-number 65002
[RouterA-bgp] peer 10.1.1.2 next-hop-local
[RouterA-bgp] peer 10.1.2.2 as-number 65003
[RouterA-bgp] peer 10.1.2.2 next-hop-local
[RouterA-bgp] quit
Configure Router B:
<RouterB> system-view
[RouterB] bgp 65002
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp] confederation id 200

8/14
7/5/2019
[RouterB-bgp] confederation peer-as 65001 65003
[RouterB-bgp] peer 10.1.1.1 as-number 65001
[RouterB-bgp] quit
Configure Router C:
<RouterC> system-view
[RouterC] bgp 65003
[RouterC-bgp] router-id 3.3.3.3
[RouterC-bgp] confederation id 200
[RouterC-bgp] confederation peer-as 65001 65002
[RouterC-bgp] peer 10.1.2.1 as-number 65001
[RouterC-bgp] quit
3. Configure iBGP connections in AS65001.
Configure Router A:
[RouterA] bgp 65001
[RouterA-bgp] peer 10.1.3.2 as-number 65001
[RouterA-bgp] peer 10.1.3.2 next-hop-local
[RouterA-bgp] peer 10.1.4.2 as-number 65001
[RouterA-bgp] peer 10.1.4.2 next-hop-local
[RouterA-bgp] quit
Configure Router D:
<RouterD> system-view
[RouterD] bgp 65001
[RouterD-bgp] router-id 4.4.4.4
[RouterD-bgp] confederation id 200
[RouterD-bgp] peer 10.1.3.1 as-number 65001
[RouterD-bgp] peer 10.1.5.2 as-number 65001
[RouterD-bgp] quit
Configure Router E:
<RouterE> system-view
[RouterE] bgp 65001
[RouterE-bgp] router-id 5.5.5.5
[RouterE-bgp] confederation id 200
[RouterE-bgp] peer 10.1.4.1 as-number 65001
[RouterE-bgp] peer 10.1.5.1 as-number 65001
[RouterE-bgp] quit
4. Configure the eBGP connection between AS100 and AS200.
Configure Router A:
[RouterA] bgp 65001
[RouterA-bgp] peer 200.1.1.2 as-number 100
[RouterA-bgp] quit
Configure Router F:
<RouterF> system-view
[RouterF] bgp 100
[RouterF-bgp] router-id 6.6.6.6
[RouterF-bgp] peer 200.1.1.1 as-number 200
[RouterF-bgp] network 9.1.1.0 255.255.255.0
[RouterF-bgp] quit
5. Verify the configuration.
Display BGP routing table information on Router B:
[RouterB] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 2.2.2.2


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 9.1.1.0/24 10.1.1.1 0 100 0 (65001) 100i


[RouterB] display bgp routing-table 9.1.1.0

BGP local router ID : 2.2.2.2


Local AS number : 65002
Paths: 1 available, 1 best

BGP routing table entry information of 9.1.1.0/24:


From : 10.1.1.1 (1.1.1.1)
Relay Nexthop : 0.0.0.0
Original nexthop: 10.1.1.1
AS-path : (65001) 100
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0, pre 255
State : valid, external-confed, best,
Not advertised to any peers yet
Display BGP routing table information on Router D:
[RouterD] display bgp routing-table

Total Number of Routes: 1

BGP Local router ID is 4.4.4.4


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 9.1.1.0/24 10.1.3.1 0 100 0 100i


[RouterD] display bgp routing-table 9.1.1.0

BGP local router ID : 4.4.4.4


Local AS number : 65001
Paths: 1 available, 1 best

BGP routing table entry information of 9.1.1.0/24:

9/14
7/5/2019
From : 10.1.3.1 (1.1.1.1)
Relay Nexthop : 0.0.0.0
Original nexthop: 10.1.3.1
AS-path : 100
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0, pre 255
State : valid, internal, best,
Not advertised to any peers yet
The output information shows that:
Router F can send route information to Router B and Router C through the confederation by establishing only an eBGP
connection with Router A.
Router B and Router D are in the same confederation, but belong to different sub ASs. They obtain external route information
from Router A and generate the same BGP route entries. It seems like that they reside in the same AS although they have no
direct connection in between.

top

BGP path selection configuration


Network requirements:

In Figure 7, all routers run BGP. Between Router A and Router B, and between Router A and Router C are eBGP connections.
Between Router B and Router D, and between Router D and Router C are iBGP connections.
OSPF is the IGP protocol in AS 200.
Configure routing policies to make Router D give priority to the route 1.0.0.0/8 learned from Router C.

Figure 7: Network diagram for BGP path selection configuration

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure OSPF on routers B, C and D.
Configure Router B:
<RouterB> system-view
[RouterB] ospf
[RouterB-ospf] area 0
[RouterB-ospf-1-area-0.0.0.0] network 192.1.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] network 194.1.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] quit
Configure Router C:
<RouterC> system-view
[RouterC] ospf
[RouterC-ospf] area 0
[RouterC-ospf-1-area-0.0.0.0] network 193.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] network 195.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] quit
[RouterC-ospf-1] quit
Configure Router D:
<RouterD> system-view
[RouterD] ospf
[RouterD-ospf] area 0
[RouterD-ospf-1-area-0.0.0.0] network 194.1.1.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.0] network 195.1.1.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.0] quit
[RouterD-ospf-1] quit
3. Configure BGP connections.
Configure Router A:
<RouterA> system-view
[RouterA] bgp 100
[RouterA-bgp] peer 192.1.1.2 as-number 200
[RouterA-bgp] peer 193.1.1.2 as-number 200
Inject network 1.0.0.0/8 into the BGP routing table of Router A:
[RouterA-bgp] network 1.0.0.0 8
[RouterA-bgp] quit
Configure Router B:
[RouterB] bgp 200
[RouterB-bgp] peer 192.1.1.1 as-number 100

10/14
7/5/2019
[RouterB-bgp] peer 194.1.1.1 as-number 200
[RouterB-bgp] quit
Configure Router C:
[RouterC] bgp 200
[RouterC-bgp] peer 193.1.1.1 as-number 100
[RouterC-bgp] peer 195.1.1.1 as-number 200
[RouterC-bgp] quit
Configure Router D:
[RouterD] bgp 200
[RouterD-bgp] peer 194.1.1.2 as-number 200
[RouterD-bgp] peer 195.1.1.2 as-number 200
[RouterD-bgp] quit
4. Configure different attribute values for the route 1.0.0.0/8 to make Router D give priority to the route learned from Router C.
Method I: Specify a higher MED value for the route 1.0.0.0/8 advertised to 192.1.1.2 to make Router D give priority to the
route learned from Router C.
Define ACL 2000 to permit the route 1.0.0.0/8:
[RouterA] acl number 2000
[RouterA-acl-basic-2000] rule permit source 1.0.0.0 0.255.255.255
[RouterA-acl-basic-2000] quit
Define routing policy apply_med_50 that sets the MED value of route 1.0.0.0/8 to 50, and routing policy
apply_med_100 that sets the MED value of route 1.0.0.0/8 to 100:
[RouterA] route-policy apply_med_50 permit node 10
[RouterA-route-policy] if-match acl 2000
[RouterA-route-policy] apply cost 50
[RouterA-route-policy] quit
[RouterA] route-policy apply_med_100 permit node 10
[RouterA-route-policy] if-match acl 2000
[RouterA-route-policy] apply cost 100
[RouterA-route-policy] quit
Apply routing policy apply_med_50 to the route advertised to 193.1.1.2 (Router C), and apply routing policy
apply_med_100 to the route advertised to 192.1.1.2 (Router B):
[RouterA] bgp 100
[RouterA-bgp] peer 193.1.1.2 route-policy apply_med_50 export
[RouterA-bgp] peer 192.1.1.2 route-policy apply_med_100 export
[RouterA-bgp] quit
Display the BGP routing table on Router D:
[RouterD] display bgp routing-table

Total Number of Routes: 2

BGP Local router ID is 194.1.1.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d – damped,
h – history, i – internal, s – suppressed, S – Stale
Origin : i – IGP, e – EGP, ? – incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 1.0.0.0 193.1.1.1 50 100 0 100i


* i 192.1.1.1 100 100 0 100i
The route 1.0.0.0/8 learned from Router C is the optimal.
Method II: Specify different local preferences for route 1.0.0.0/8 on Router B and C to make Router D give priority to the route
learned from Router C.
Define ACL 2000 to permit the route 1.0.0.0/8 on Router C:
[RouterC] acl number 2000
[RouterC-acl-basic-2000] rule permit source 1.0.0.0 0.255.255.255
[RouterC-acl-basic-2000] quit
Define routing policy localpref on Router C to set the local preference of route 1.0.0.0/8 to 200 (the default is 100):
[RouterC] route-policy localpref permit node 10
[RouterC-route-policy] if-match acl 2000
[RouterC-route-policy] apply local-preference 200
[RouterC-route-policy] quit
Apply the routing policy localpref to the route from the peer 193.1.1.1 on Router C:
[RouterC] bgp 200
[RouterC-bgp] peer 193.1.1.1 route-policy localpref import
[RouterC-bgp] quit
Display the BGP routing table on Router D:
[RouterD] display bgp routing-table

Total Number of Routes: 2

BGP Local router ID is 194.1.1.1


Status codes: * - valid, ^ - VPNv4 best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 1.0.0.0 193.1.1.1 0 200 0 100i


* i 192.1.1.1 0 100 0 100i
The route 1.0.0.0/8 learned from Router C is the optimal.

top

BGP GR configuration
Network requirements:

In Figure 8, all are BGP routers. Between Router A and Router B is an eBGP connection. Router B and Router C are connected over an
iBGP connection. Enable GR capability for BGP so that the communication between Router A and Router C cannot be affected when an
active/standby main board switchover occurs on Router B.

Figure 8: Network diagram for BGP GR configuration

11/14
7/5/2019

Procedure:

1. Configure Router A.
Configure IP addresses for interfaces (omitted).
Configure the eBGP connection:
<RouterA> system-view
[RouterA] bgp 65008
[RouterA-bgp] router-id 1.1.1.1
[RouterA-bgp] peer 200.1.1.1 as-number 65009
Inject network 8.0.0.0/8 to the BGP routing table:
[RouterA-bgp] network 8.0.0.0
Enable GR capability for BGP:
[RouterA-bgp] graceful-restart
2. Configure Router B.
Configure IP addresses for interfaces (omitted).
Configure the eBGP connection:
<RouterB> system-view
[RouterB] bgp 65009
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp] peer 200.1.1.2 as-number 65008
Configure the iBGP connection:
[RouterB-bgp] peer 9.1.1.2 as-number 65009
Inject networks 200.1.1.0/24 and 9.1.1.0/24 to the BGP routing table:
[RouterB-bgp] network 200.1.1.0 24
[RouterB-bgp] network 9.1.1.0 24
Enable GR capability for BGP:
[RouterB-bgp] graceful-restart
3. Configure Router C.
Configure IP addresses for interfaces (omitted).
Configure the iBGP connection:
<RouterC> system-view
[RouterC] bgp 65009
[RouterC-bgp] router-id 3.3.3.3
[RouterC-bgp] peer 9.1.1.1 as-number 65009
Enable GR capability for BGP:
[RouterC-bgp] graceful-restart

Verification:

Ping Router C on Router A. Meanwhile, perform an active/standby main board switchover on Router B. The ping operation is successful
during the whole switchover process.

top

Configuring BFD for BGP


Network requirements:

As shown in Figure 9:

Configure OSPF as the IGP in AS 200.


Establish two iBGP connections between Router A and Router C. When both links are working, Router C adopts the link Router A<—
>Router B<->Router C to exchange packets with network 1.1.1.0/24. Configure BFD over the link. Then if the link fails, BFD can
quickly detect the failure and notify it to BGP. Then the link Router A<->Router D<->Router C takes effect immediately.

Figure 9: Network diagram for BFD for BGP configuration

Procedure:

1. Configure IP addresses for interfaces (omitted).


2. Configure OSPF (omitted) so that Router A and Router C are reachable to each other.
3. Configure BGP on Router A.
Establish two iBGP connections between Router A and Router C:
<RouterA> system-view
[RouterA] bgp 100
[RouterA-bgp] peer 3.0.2.2 as-number 200

12/14
7/5/2019
[RouterA-bgp] peer 2.0.2.2 as-number 200
[RouterA-bgp] quit
When the two links between Router A and Router C are both up, Router C adopts the link Router A<->Router B<->Router C to
exchange packets with network 1.1.1.0/24. (Set a higher MED value for route 1.1.1.0/24 sent to peer 2.0.2.2 on Router A.)
Create ACL 2000 to permit 1.1.1.0/24 to pass.
[RouterA] acl number 2000
[RouterA-acl-basic-2000] rule permit source 1.1.1.0 24
[RouterA-acl-basic-2000] quit
Create two route policies, apply_med_50 and apply_med_100. Policy apply_med_50 sets the MED for route 1.1.1.0/24 to
50. Policy apply_med_100 sets that to 100.
[RouterA] route-policy apply_med_50 permit node 10
[RouterA-route-policy] if-match acl 2000
[RouterA-route-policy] apply cost 50
[RouterA-route-policy] quit
[RouterA] route-policy apply_med_100 permit node 10
[RouterA-route-policy] if-match acl 2000
[RouterA-route-policy] apply cost 100
[RouterA-route-policy] quit
Apply routing policy apply_med_50 to routes outgoing to peer 3.0.2.2, and apply routing policy apply_med_100 to routes
outgoing to peer 2.0.2.2.
[RouterA] bgp 100
[RouterA-bgp] peer 3.0.2.2 route-policy apply_med_50 export
[RouterA-bgp] peer 2.0.2.2 route-policy apply_med_100 export
Configure BFD over the link to peer 3.0.2.2 so that when the link Router A<->Router B<->Router C fails, BFD can quickly
detect the failure and notify it to BGP, and then the link Router A<->Router D<->Router C takes effect immediately.
[RouterA-bgp] peer 3.0.2.2 bfd
[RouterA-bgp] quit
4. Configure BGP on Router C:
<RouterC> system-view
[RouterC] bgp 100
[RouterC-bgp] peer 3.0.1.1 as-number 200
[RouterC-bgp] peer 3.0.1.1 bfd
[RouterC-bgp] peer 2.0.1.1 as-number 200
[RouterC-bgp] quit
5. Configure BFD parameters (the user can use default BFD parameters instead).
Configure Router A:
[RouterA] bfd session init-mode active
[RouterA] interface gigabitethernet 2/1/2
Configure the minimum interval for transmitting BFD control packets as 500 milliseconds.
[RouterA-Gigabitethernet2/1/2] bfd min-transmit-interval 500
Configure the minimum interval for receiving BFD control packets as 500 milliseconds.
[RouterA-Gigabitethernet2/1/2] bfd min-receive-interval 500
Configure the detect multiplier as 7.
[RouterA-Gigabitethernet2/1/2] bfd detect-multiplier 7
Configure the BFD authentication mode as plain-text authentication, and set the authentication key to ibgpbfd.
[RouterA-Gigabitethernet2/1/2] bfd authentication-mode simple 1 ibgpbfd
[RouterA-Gigabitethernet2/1/2] quit
Configure Router C:
[RouterC] bfd session init-mode active
[RouterC] interface gigabitethernet 2/1
[RouterC-Gigabitethernet2/1] bfd min-transmit-interval 500
[RouterC-Gigabitethernet2/1] bfd min-receive-interval 500
[RouterC-Gigabitethernet2/1] bfd detect-multiplier 7
[RouterC-Gigabitethernet2/1] bfd authentication-mode simple 1 ibgpbfd
[RouterC-Gigabitethernet2/1] return
6. Verify the configuration.
The following operations are made on Router C. Operations on Router A are similar and are thus omitted.
Display detailed BFD session information:
<RouterC> display bfd session verbose

Total Session Num: 1 Init Mode: Active

IP Session Working Under Ctrl Mode:

Local Discr: 17 Remote Discr: 13


Source IP: 3.0.2.2 Destination IP: 3.0.1.1
Session State: Up Interface: GigabitEthernet2/1/1
Min Trans Inter: 500ms Act Trans Inter: 500ms
Min Recv Inter: 500ms Act Detect Inter: 3500ms
Recv Pkt Num: 57 Send Pkt Num: 53
Hold Time: 2200ms Connect Type: Indirect
Running Up for: 00:00:06 Auth mode: Simple
Protocol: BGP
Diag Info: No Diagnostic
The previous output shows that a BFD session is established between Router A’s GigabitEthernet 2/1/2 and Router C’s
GigabitEthernet 2/1/1 and that BFD runs properly.
Display BGP peer information on Router C, and you can see that Router C has established two BGP neighborships with
Router A:
<RouterC> display bgp peer

BGP local router ID : 1.1.1.1


Local AS number : 200
Total number of peers : 2 Peers in established state : 2

Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State

2.0.1.1 200 7 10 0 0 00:01:05 Established


3.0.1.1 200 7 10 0 0 00:01:34 Established
Display route 1.1.1.0/24 on Router C, and you can see that Router A and Router C communicate through Router B:
<RouterC> display ip routing-table 1.1.1.0 24 verbose
Routing Table : Public
Summary Count : 2

13/14
7/5/2019

Destination: 1.1.1.0/24
Protocol: BGP Process ID: 0
Preference: 0 Cost: 50
NextHop: 3.0.1.1 Interface: GigabitEthernet2/1/1
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 3.0.2.1 Neighbor : 3.0.1.1
Tunnel ID: 0x0 Label: NULL
State: Active Adv Age: 00h08m54s
Tag: 0

Destination: 1.1.1.0/24
Protocol: BGP Process ID: 0
Preference: 0 Cost: 100
NextHop: 2.0.1.1 Interface: GigabitEthernet2/1/2
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 2.0.2.1 Neighbor : 2.0.1.1
Tunnel ID: 0x0 Label: NULL
State: Invalid Adv Age: 00h08m54s
Tag: 0
The output shows that Router C has two routes to reach network 1.1.1.0/24: Router C<—>Router B<—>Router A, which is the active
route; Router C<—>Router D<—>Router A, which is the backup route.
Enable BFD debugging on Router C:
<RouterC> debugging bfd scm
<RouterC> debugging bfd event
<RouterC> debugging bgp bfd
<RouterC> terminal monitor
<RouterC> terminal debugging
The following debugging information shows that: when the link between Router A and Router B fails, Router C can quickly detect the
link failure.
%Nov 5 11:42:24:172 2009 RouterC BFD/5/BFD_CHANGE_FSM:
Sess[3.0.2.2/3.0.1.1,13/17,GE2/1/1,Ctrl], Sta: UP->DOWN, Diag: 1
%Nov 5 11:42:24:172 2009 RouterC BGP/5/BGP_STATE_CHANGED: 3.0.1.1 state is changed from
ESTABLISHED to IDLE.
*Nov 5 11:42:24:187 2009 RouterC RM/6/RMDEBUG: BGP_BFD: Recv BFD DOWN msg, Src IP 3.0.2.2,
Dst IP 3.0.1.1, Instance ID 0.
*Nov 5 11:42:24:187 2009 RouterC RM/6/RMDEBUG: BGP_BFD: Reset BGP session 3.0.1.1 for BFD
session down.
*Nov 5 11:42:24:187 2009 RouterC RM/6/RMDEBUG: BGP_BFD: Send DELETE msg to BFD, Connection
type DIRECT, Src IP 3.0.2.2, Dst IP 3.0.1.1, Instance ID 0.
Display route 1.1.1.0/24 on Router C, and you can see that Router A and Router C communicate through Router D:
<RouterC> display ip routing-table 1.1.1.0 24 verbose
Routing Table : Public
Summary Count : 1

Destination: 1.1.1.0/24
Protocol: BGP Process ID: 0
Preference: 0 Cost: 100
NextHop: 2.0.1.1 Interface: GigabitEthernet2/1/2
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 2.0.2.1 Neighbor : 2.0.1.1
Tunnel ID: 0x0 Label: NULL
State: Active Adv Age: 00h09m54s
Tag: 0
The output shows that Router C has one route to reach network 1.1.1.0/24 (Router C<—>Router D<—>Router A).

top

14/14

Potrebbero piacerti anche