[SwitchC-bgp] group ex external
[SwitchC-bgp] peer 193.1.1.1 group ex as-number 100
[SwitchC-bgp] group in internal
[SwitchC-bgp] peer 195.1.1.1 group in
[SwitchC-bgp] peer 194.1.1.2 group in
4 Configure Switch D.
[SwitchD] interface vlan-interface 4
[SwitchD-Vlan-interface4] ip address 194.1.1.1 255.255.255.0
[SwitchD] interface vlan-interface 5
[SwitchD-Vlan-interface5] ip address 195.1.1.1 255.255.255.0
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 194.1.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 195.1.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 4.0.0.0 0.255.255.255
[SwitchD] bgp 200
[SwitchD-bgp] undo synchronization
[SwitchD-bgp] group in internal
[SwitchD-bgp] peer 195.1.1.2 group in
[SwitchD-bgp] peer 194.1.1.2 group in
To make the configuration take effect, all BGP neighbors need to execute the
■
reset bgp all command.
After the above configuration, because the MED attribute value of the route
■
1.0.0.0 learnt by Switch C is smaller than that of the route 1.0.0.0 learnt by
Switch B, Switch D will choose the route 1.0.0.0 coming from Switch C.
If you do not configure MED attribute of Switch A when you configure Switch
■
A, but configure the local preference on Switch C as following:
# Configure the local preference of Switch C
Create ACL 2000 to permit routing information sourced from network 1.0.0.0.
■
[SwitchC] acl number 2000
[SwitchC-acl-basic-2000] rule permit source 1.0.0.0 0.255.255.255
[SwitchC-acl-basic-2000] rule deny source any
Define a routing policy named localpref, and set the local preference of the
■
routes matching with ACL 2000 to 200, and that of those unmatched routes to
100.
[SwitchC] route-policy localpref
[SwitchC-route-policy] if-match acl 2000
[SwitchC-route-policy] apply local-preference 200
[SwitchC-route-policy] quit
[SwitchC] route-policy localpref permit node 20
[SwitchC-route-policy] apply local-preference 100
[SwitchC-route-policy] quit
Apply this routing policy to the inbound traffic flows coming from BGP
■
neighbor 193.1.1.1 (Switch A).
[SwitchC] bgp 200
[SwitchC-bgp] peer 193.1.1.1 route-policy localpref import
In this case, because the local preference value of the route 1.0.0.0 learnt by
Switch C is 200, which is greater than that of the route 1.0.0.0 learnt by Switch B
Configuration Example
permit node 10
375