BGP Configuration Example 475
Figure 156 Networking diagram of configuring BGP path selection
1 Configure Router A:
[RouterA] interface serial 0
[RouterA-Serial0] ip address 192.1.1.1 255.255.255.0
[RouterA] interface serial 1
[RouterA-Serial1] ip address 193.1.1.1 255.255.255.0
[RouterA-Serial1] quit
a Start BGP
[RouterA] bgp 100
[RouterA-bgp] undo synchronization
b Specify BGP transmission network
[RouterA-bgp] network 1.0.0.0 mask 255.0.0.0
[RouterA-bgp] network 2.0.0.0 mask 255.0.0.0
c Configure peer
[RouterA-bgp] peer 192.1.1.2 as-number 200
[RouterA-bgp] peer 193.1.1.2 as-number 200
d Configure MED attribute of Router A
■ Add access list to Router A and enable network 1.0.0.0.
[RouterA-bgp] acl 1
[RouterA-acl-1] rule permit source 1.0.0.0 0.255.255.255
■ Define two routing diagram, namely set_med_50 and set_med_100. The first
routing diagram is network 1.0.0.0. The MED attribute is 50, and the second
MED attribute is 100.
[RouterA-acl-1] route-policy set_med_50 permit 1
[RouterA-route-policy] if-match ip address 1
[RouterA-route-policy] apply cost 50
[RouterA-route-policy] quit
[RouterA] route-policy set_med_100 permit 1
[RouterA-route-policy] if-match ip address 1
■ [RouterA-route-policy] apply cost 100Apply the routing diagram set_med_50
to the exit routing update of Router C (193.1.1.2). Apply the routing diagram
set_med_100 to exit routing update of Router B (192.1.1.2).
[RouterA] bgp 100
[RouterA-bgp] peer 193.1.1.2 route-policy set_med_50 export
[RouterA-bgp] peer 192.1.1.2 route-policy set_med_100 export
Router B
Router C
Router D
Router A
S0
194.1.1.2/24
S0 192.1.1.1/24
S1 193.1.1.1/24
S0 193.1.1.2/24
S1
195.1.1.2/24
S0
192.1.1.2/24
2.2.2.2
4.4.4.4
3.3.3.3
1.1.1.1
AS100
AS200
S0
194.1.1.1/24
S1
195.1.1.1/24
IBGP
IBGP
EBGP
EBGP
1.0.0.0
To network
2.0.0.0
2.0.0.0
To network
To network
2.0.0.0
To network