R1上建立环回口1.1.1.1和11.1.1.1;
1.R1、R2、R3、R4分别属于不同的AS,两两之间建立EBGP邻居
2.要求R4到达R1的环回口都通过左边的R2,而不是R3;
实验参考配置:
R1:
interface Loopback0 ip address 1.1.1.1 255.255.255.0
interface Loopback1 ip address 11.1.1.1 255.255.255.0
interface Serial0/0 ip address 12.1.1.1 255.255.255.0
router bgp 100
network 1.1.1.0 mask 255.255.255.0
network 11.1.1.0 mask 255.255.255.0
neighbor 12.1.1.2 remote-as 200
neighbor 13.1.1.3 remote-as 300
neighbor 13.1.1.3 route-map as-path out
(As-path prepend预附加)
access-list 10 permit 11.1.1.0 0.0.0.255
!
route-map as-path permit 10
match ip address 10
set as-path prepend 100
R2:(R3类似)
router bgp 200
neighbor 12.1.1.1 remote-as 100
neighbor 24.1.1.4 remote-as 400
R4:
router bgp 400
network 4.4.4.0 mask 255.255.255.0
neighbor 24.1.1.2 remote-as 200
neighbor 34.1.1.3 remote-as 300
实验效果测试:
R1测试: