R2(config-router)#neighbor 12.1.1.1 route-map R-1 out
R2(config)#route-map R-4
R2(config-route-map)#match ip add 1
R2(config-route-map)#set metric 200
R2(config-route-map)#exit
R2(config)#route-map R-4 20
R2(config-route-map)#match ip add 2
R2(config-route-map)#set metric 100
R2(config-route-map)#exit
R2(config)#route-map R-4 30
R2(config-route-map)#exit
R2(config-router)#neighbor 24.1.1.4 route-map R-4 out
R2#clear ip bgp * soft
R3#sh ip bgp BGP table version is 22, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path *> 10.1.1.0/24 0.0.0.0 0 32768 i *>i172.16.1.0/24 13.1.1.1 100 100 0 2 i * i 34.1.1.4 200 100 0 2 i * i192.168.1.0 13.1.1.1 200 100 0 2 i *>i 34.1.1.4 100 100 0 2 i
========================验证======================
在R1,R4上分别启用debug ip packet,然后在R3上ping 172.16.1.1 source 10.1.1.1