实验条件
网络拓朴
背景环境配置
R1
interface Loopback0
ip address 1.1.1.2 255.255.255.255 secondary
ip address 1.1.1.1 255.255.255.255
interface Ethernet0/0
ip address 12.1.1.1 255.255.255.0
interface Ethernet0/1
ip address 13.1.1.1 255.255.255.0
ip prefix-list CON seq 5 deny 12.1.1.0/24
ip prefix-list CON seq 10 deny 13.1.1.0/24
route-map RED permit 10
match ip address prefix-list CON
router bgp 1111
bgp router-id 1.1.1.1
redistribute connected route-map RED
neighbor 12.1.1.2 remote-as 12345
neighbor 13.1.1.3 remote-as 12345
R2
interface Loopback0
ip address 2.2.2.2 255.255.255.255
ip ospf 12345 area 0
interface Ethernet0/0
ip address 12.1.1.2 255.255.255.0
interface Ethernet0/2
ip address 23.1.1.2 255.255.255.0
ip ospf 12345 area 0
ip ospf cost 1000
interface Ethernet0/3
ip address 25.1.1.2 255.255.255.0
ip ospf 12345 area 0
router ospf 12345
router-id 2.2.2.2
router bgp 12345
bgp router-id 2.2.2.2
bgp default local-preference 150
network 2.2.2.2 mask 255.255.255.255
neighbor 5.5.5.5 remote-as 12345
neighbor 5.5.5.5 update-source Loopback0
neighbor 5.5.5.5 route-map LP in
neighbor 12.1.1.1 remote-as 1111
access-list 1 permit 1.1.1.1
access-list 1 permit 1.1.1.0
route-map LP permit 10
match ip address 1
set local-preference 99
route-map LP permit 20
R3
interface Loopback0
ip address 3.3.3.3 255.255.255.255
ip ospf 12345 area 0
interface Ethernet0/0
ip address 34.1.1.3 255.255.255.0
ip ospf 12345 area 0
interface Ethernet0/1
ip address 13.1.1.3 255.255.255.0
interface Ethernet0/2
ip address 23.1.1.3 255.255.255.0
ip ospf 12345 area 0
ip ospf cost 1000
router ospf 12345
router-id 3.3.3.3
router bgp 12345
bgp router-id 3.3.3.3
network 3.3.3.0 mask 255.255.255.0
neighbor 4.4.4.4 remote-as 12345
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 13.1.1.1 remote-as 1111
R4
interface Loopback0
ip address 4.4.4.4 255.255.255.255
interface Ethernet0/0
ip address 34.1.1.4 255.255.255.0
ip ospf 12345 area 0
interface Ethernet0/2
ip address 45.1.1.4 255.255.255.0
ip ospf 12345 area 0
interface Ethernet0/3
ip address 47.1.1.4 255.255.255.0
ip ospf 12345 area 0
router ospf 12345
router-id 4.4.4.4
router bgp 12345
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 12345
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 route-reflector-client
neighbor 5.5.5.5 remote-as 12345
neighbor 5.5.5.5 update-source Loopback0
neighbor 5.5.5.5 next-hop-self
neighbor 7.7.7.7 remote-as 12345
neighbor 7.7.7.7 update-source Loopback0
neighbor 7.7.7.7 route-reflector-client
R5
interface Loopback0
ip address 5.5.5.5 255.255.255.255
ip ospf 12345 area 0
interface Ethernet0/1
ip address 56.1.1.5 255.255.255.0
ip ospf 12345 area 0
interface Ethernet0/2
ip address 45.1.1.5 255.255.255.0
ip ospf 12345 area 0
interface Ethernet0/3
ip address 25.1.1.5 255.255.255.0
ip ospf 12345 area 0
router ospf 12345
router-id 5.5.5.5
router bgp 12345
bgp router-id 5.5.5.5
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 12345
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 route-reflector-client
neighbor 4.4.4.4 remote-as 12345
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 route-reflector-client
neighbor 6.6.6.6 remote-as 12345
neighbor 6.6.6.6 shutdown
neighbor 6.6.6.6 update-source Loopback0
neighbor 6.6.6.6 route-reflector-client
R6
interface Loopback0
ip address 6.6.6.6 255.255.255.255
ip ospf 12345 area 0
interface Ethernet0/0
ip address 6.7.8.6 255.255.255.0
interface Ethernet0/1
ip address 56.1.1.6 255.255.255.0
ip ospf 12345 area 0
interface Ethernet0/2
ip address 67.1.1.6 255.255.255.0
ip ospf 12345 area 0
router ospf 12345
router-id 6.6.6.6
router bgp 12345
bgp router-id 6.6.6.6
bgp log-neighbor-changes
neighbor 5.5.5.5 remote-as 12345
neighbor 5.5.5.5 update-source Loopback0
neighbor 5.5.5.5 next-