无逼逼赖赖之BGP高级特性应用

1.实验需求:(又是这个实验需求

无逼逼赖赖之BGP高级特性应用
①R3为AS3,并且为EBGP,创建一个环回口为3.3.3.3/24,e0/0为13.1.1.3/24
②R1为AS10,并且为IBGP,创建一个环回口为1.1.1.1/24,e0/0为124.1.1.1/24
③R2为AS10,并且为IBGP,创建一个环回口为2.2.2.2/24,e0/0为124.1.1.2/24
④R1与R2之间运行EIGRP
⑤R4为AS4,并且为EBGP,创建一个环回口为4.4.4.4/24,e0/0为124.1.1.4/24

2.BGP的详细配置:

R3:
router bgp 3
no auto-summary
no synchronization
bgp router-id 3.3.3.3
neighbor 13.1.1.1 remote-as 10
bgp default ipv4-unicast
address-family ipv4 unicast
network 3.3.3.0 mask 255.255.255.0

R1:
router bgp 10
no auto-summary
no synchronization
bgp router-id 1.1.1.1
no bgp default ipv4-unicast
neighbor 13.1.1.3 remote-as 3
address-family ipv4 unicast
neighbor 13.1.1.3 activate

neighbor 2.2.2.2 remote-as 10
neighbor 2.2.2.2 update-source loopback 0
address-family ipv4 unicast
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 next-hop-self

R2:
router bgp 10
no auto-summary
no synchronization
bgp router-id 3.3.3.3
no bgp default ipv4-unicast
neighbor 1.1.1.1 remote-as 10
neighbor 1.1.1.1 update-source loopback 0
address-family ipv4 unicast
neighbor 1.1.1.1 activate

neighbor 124.1.1.4 remote-as 4
address-family ipv4 unicast
neighbor 124.1.1.4 activate

R4:
router bgp 4
no auto-summary
no synchronization
bgp router-id 4.4.4.4
no bgp default ipv4-unicast
neighbor 124.1.1.2 remote-as 10
address-family ipv4 unicast
neighbor 124.1.1.2 activate
network 4.4.4.0 mask 255.255.255.0

3.BGP的Inject-map与Exist-map的应用:

前提:
现在假设在R3上设置loopback 8为172.16.8.1/24,loopback 9 172.16.9.0/24,现在把R3当做ISP,然后在不影响ISP设备的情况下让ISP给我传汇总路由的同时,我自己能够根据这个汇总路由来产生一条汇总里面的明细路由。

①先用前缀列表抓汇总路由:
ip prefix-list 1 seq 10 permit 172.16.8.0/23

②再抓汇总路由的发送者:
ip prefix-list 2 seq 10 permit 13.1.1.3/32

③抓生成的明细路由:
ip prefix-list 3 seq 10 permit 172.16.9.0/24

④做第一个route-map来产生该汇总路由中的明细路由:
route-map inject permit 10
set ip address prefix-list 3

⑤做第二个route-map来做产生明细路由的条件:
route-map exist permit 10
match ip address prefix-list 1
match ip route-source prefix-list 2

⑥进入BGP调用:
bgp inject-map inject exist-map exist copy-attributes
最后调用的时候一定要加 copy-attributes参数,不然会导致路由回传造成超长距离的路由黑洞

没做之前的效果:

无逼逼赖赖之BGP高级特性应用
这是做了之后的情况:

无逼逼赖赖之BGP高级特性应用