Design of the BGP Practice Policy Routing distribution requirements for the two Routers
R1 and R2 are connected by two lines. BGP is used. R1 has two groups of routes, 192.168.1.0/24 and 192.168.2.0/24. When both lines are connected, the traffic of the two groups of routes is distributed and balanced on the two lines. When any one of them is disconnected, only traffic of 192.168.1.0/24 is allowed. WKiom1T5LvyRIKJLAABRKb2AoGQ286.jpg method 1 [R1 configuration] interface Loopback0ip address 1.1.1.1 255.255.255.255! Interface Loopback1ip address 192.168.1.1 255.255.255.0! Interface Loopback2ip address 192.168.2.1 255.255.255.0! Interface FastEthernet0/0ip address 10.2.12.1 255.255.255.0duplex autospeed auto! Interface FastEthernet1/0ip address 10.1.12.1 255.255.255.0duplex autospeed auto! Router bgp 1no bgp default ipv4-unicastbgp log-neighbor-route 2.2.2.2 remote-as 2 neighbor 2.2.2.2 ebgp-multihop 2 neighbor 2.2.2.2 update-source limit 2.2.2.2 timers 1 3 neighbor 10.1.12.2 remote-as 2 neighbor 10.1.12.2 timers 1 3 neighbor 10.2.12.2 remote-as 2 neighbor 10.2.12.2 timers 1 3maximum-paths 2! Address-family ipv4 neighbor 2.2.2.2 activate neighbor 10.1.12.2 activate neighbor 10.2.12.2 activate maximum-paths 2 no auto-summary no synchronization network 192.168.1.0 network 192.168.2.0exit-address-family! No ip http serverno ip http secure-serverip route 2.2.2.2 route 255.255 FastEthernet0/0 10.2.12.2ip route 2.2.2.2 route 255.255.255.255 FastEthernet1/0 10.1.12.2! [R2 configuration ]! Ip sla monitor 1 type echo protocol ipIcmpEcho 10.2.12.1 source-interface FastEthernet0/0ip sla monitor schedule 1 start-time nowip sla monitor 2 type echo protocol ipIcmpEcho 10.1.12.1 source-interface FastEthernet1/0ip sla monitor schedule 2 start-time now !! Track 1 rtr 1 reachability! Track 2 rtr 2 reachability! Track 3 list boolean andobject 1 object 2 !! Interface Loopback0ip address 2.2.2.2 255.255.255.255! Interface FastEthernet0/0ip address 10.2.12.2 255.255.255.0duplex autospeed auto! Interface FastEthernet1/0ip address 10.1.12.2 255.255.255.0duplex autospeed auto! Router bgp 2no bgp default ipv4-unicastbgp log-neighbor-route 1.1.1.1 remote-as 1 neighbor 1.1.1.1 ebgp-multihop 2 neighbor 1.1.1.1 update-source protocol 1.1.1.1 timers 1 3 neighbor 10.1.12.1 remote timers 1 3 neighbor 10.2.12.1 remote-as 1 neighbor 10.2.12.1 timers 1 3maximum-paths 2! Address-family ipv4 protocol 1.1.1.1 activate protocol 1.1.1.1 distribute-list 1 in container 10.1.12.1 activate protocol 10.1.12.1 distribute-list 2 in container 10.2.12.1 activate neighbor 10.2.12.1 distribute-list 2 in maximum-paths 2 no auto -summary no synchronizationexit-address-family! No ip http serverno ip http secure-serverip route 1.1.1.1 255.255.255.255 10.2.12.1 track 3ip route 1.1.1.1 255.255.255.255 10.1.12.1 track 3 !!! Access-list 1 permit 192.168.2.0 0.0.255access-list 2 permit 192.168.1.0 0.0.0.255 method 2R2 Modification Scheme, for enterprise ip sla monitor 1 type echo protocol ipIcmpEcho 10.2.12.1 source-interface FastEthernet0/0ip sla monitor schedule 1 start-time nowip sla monitor 2 type echo protocol ipIcmpEcho 10.1.12.1 source-interface FastEthernet1/0ip sla monitor schedule 2 start-time now !!!!!!!!!!!!!!!!!! Track 1 rtr 1 reachability! Track 2 rtr 2 reachability! Track 3 list boolean andobject 1 object 2 !!!!! Interface Loopback0ip address 2.2.2.2 255.255.255.255! Interface Loopback1ip address 192.168.1.1 255.255.255.0! Interface Loopback2ip address 192.168.2.1 255.255.255.0! Interface FastEthernet0/0ip address 10.2.12.2 255.255.255.0duplex autospeed auto! Interface FastEthernet1/0ip address 10.1.12.2 255.255.255.0duplex autospeed auto! Router bgp 2no bgp default ipv4-unicastbgp log-neighbor-route 1.1.1.1 remote-as 1 neighbor 1.1.1.1 ebgp-multihop 2 neighbor 1.1.1.1 update-source protocol 1.1.1.1 timers 1 3 neighbor 10.1.12.1 remote timers 1 3 neighbor 10.2.12.1 remote-as 1 neighbor 10.2.12.1 timers 1 3maximum-paths 2! Address-family ipv4 protocol 1.1.1.1 activate protocol 1.1.1.1 distribute-list 1 out route 10.1.12.1 activate route 10.1.12.1 distribute-list 2 out route 10.2.12.1 activate neighbor 10.2.12.1 distribute-list 2 out maximum-paths 2 no auto -summary no synchronization network 192.168.1.0 network 192.168.2.0exit-address-family! No ip http serverno ip http secure-serverip route 1.1.1.1 255.255.255.255 10.2.12.1 track 3ip route 1.1.1.1 255.255.255.255 10.1.12.1 track 3 !!! Access-list 1 permit 192.168.2.0 0.0.255access-list 2 permit 192.168.1.0 0.0.0.255 R1 down one of the interfaces R2 prompt R2 # * Mar 1 02:34:50. 951: % BGP-5-ADJCHANGE: neighbor 10.1.12.1 Down BGP Notification sentR2 # * Mar 1 02:34:50. 955: % BGP-3-NOTIFICATION: sent to neighbor 10.1.12.1 4/0 (hold time expired) 0 bytesR2 # R2 # R2 # R2 # R2 # * Mar 1 02:35:00. 387: % TRACKING-5-STATE: 2 rtr 2 reachability Up-> Down * Mar 1 02:35:00. 555: % TRA CKING-5-STATE: 3 list boolean and Up-> DownR2 # * Mar 1 02:35:02. 939: % BGP-3-NOTIFICATION: pinned ed from neighbor 1.1.1.1 4/0 (hold time expired) 0 bytesR2 # * Mar 1 02:35:02. 947: % BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down BGP Notification receivedR1 route table R1 # sh ip ro bB 192.168.1.0/24 [20/0] via 10.2.12.2, 00:03:24 method 3 Use advertise-map to solve, however, some IOS do not. (R1) Config: router bgp 1no synchronizationbgp log-neighbor-changesnetwork 192.168.1.0network 192.168.2.0redistribute connected route-map redis_conn, it is convenient for advertise-map to check the existence of the two routes to determine whether to publish secondary network segments) neighbor 12.1.1.2 remote-as 2 neighbor 12.1.1.2 update-source Serial1/0 neighbor 12.1.1.2 advertise-map dist_out2 exist-map line2 (if the external line 2 is normal, the route entry of the external line 2 will be re-distributed to the bgpl route table, and the secondary route will be advertised. If 2 is normal, and it can be advertised from s1/0 [first-line port] Neighbor routing, indicating that 1 is also normal, that is, both are normal. If the two lines are disconnected, the port will go down, and the route-map redis_conn will not distribute the line2 path into the bgp route table, so that the secondary route will not be declared, this is also a bit similar to the Cross-neighbor building method. The same is true for the following: neighbor 12.1.2.2 update-source Serial1/1 neighbor 12.1.2.2 advertise-map dist_out2 exist-map line1no auto-summary! Ip prefix-list dist_out2 seq 5 permit 192.168.2.0/24! Ip prefix-list line1 seq 5 permit 12.1.1.0/30 (external route )! Ip prefix-list line2 seq 5 permit 12.1.2.0/30 (external Route 2 )! Route-map redis_conn permit 10 match interface Serial1/0 Serial1/1 route-map dist_out2 permit 10 match ip address prefix-list dist_out2! Route-map line2 permit 10 match ip address prefix-list line2! Route-map line1 permit 10 match ip address prefix-list line1! ISP (R2) Config: (the ISP configuration is very simple and basically nothing is done. In reality, it is best to do what the user needs on CE, when PE can meet the requirements, try to streamline the configuration and save resources) router bgp 2no container log-neighbor-route 12.1.1.1 remote-as 1 neighbor 12.1.1.1 update-source Serial1/0 neighbor 12.1.2.1 remote-as 1 neighbor 12.1.2.1 update-source Serial1/1no auto-summar