1、没有设置LOCAL-PREF之前(R5有两条路由到200.100.50):
R5#sh ip bgp 200.100.50.0
BGP routing table entry for 200.100.50.0/24, version 4
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
10.1.1.2
200
192.168.1.6 from 192.168.1.6 (200.100.50.1)
Origin IGP, metric 0, localpref 100 , valid, external, best
300 200
10.1.1.2 from 10.1.1.2 (172.24.1.18)
Origin IGP, localpref 100 , valid, external
结果:
R5#sh ip bgp
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 10.0.0.0 0.0.0.0 0 32768 i
* 192.168.1.6 0 200 300 i
* 10.1.1.2 0 0 300 i
* 200.100.50.0 192.168.1.6 0 0 200 i
* 10.1.1.2 0 300 200 i
2、而设置了LOCAL-PREF后(R5优先选择优先级高的路由):
R5#sh ip bgp 200.100.50.0
BGP routing table entry for 200.100.50.0/24, version 4
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Flag: 0x208
Advertised to non peer-group peers:
192.168.1.6
300 200
10.1.1.2 from 10.1.1.2 (172.24.1.18)
Origin IGP, localpref 150 , valid, external, best
200
192.168.1.6 from 192.168.1.6 (200.100.50.1)
Origin IGP, metric 0, localpref 100 , valid, external
结果:
R5#sh ip bgp
BGP table version is 4, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 10.0.0.0 10.1.1.2 0 150 0 300 i
* 192.168.1.6 0 200 300 i
* 0.0.0.0 0 32768 i
* 200.100.50.0 10.1.1.2 150 0 300 200 i
* 192.168.1.6 0 0 200 i