实验拓扑图如下:
实验要求:
1.as100要求使用172.16.0.0/16 每个路由器两个环回
2.as101要求使用192.168.0.0/24 每个路由器两个环回
3.as100到as101只有汇总路由能通过
4.as101到as100除了汇总路由之外还有R8的两个环回允许通过
5.全网可达
6.r4、r5之间使用环回建邻
实验步骤:
1.划分IP,底层配置
2.在两个AS内建立BGP邻居关系(IBGP全连)以R2、R7为例
[r2]bgp 100
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 172.16.1.1 as-number 100
[r2-bgp]peer 172.16.1.1 connect-interface lo0
[r2-bgp]peer 172.16.6.1 as-number 100
[r2-bgp]peer 172.16.6.1 connect-interface lo0
[r2-bgp]peer 172.16.9.1 as-number 100
[r2-bgp]peer 172.16.9.1 connect-interface lo 0
[r7]bgp 101
[r7-bgp]router-id 7.7.7.7
[r7-bgp]peer 192.168.0.33 as-number 101
[r7-bgp]peer 192.168.0.33 connect-interface lo 0
[r7-bgp]peer 192.168.0.97 as-number 101
[r7-bgp]peer 192.168.0.97 connect-interface lo 0
[r7-bgp]peer 192.168.0.225 as-number 101
[r7-bgp]peer 192.168.0.225 connect-interface lo 0
建邻完成
3.先配置要求使得全网可达
(1)在R4、R5上互写缺省指向对方
(2)重发布
r4上:bgp 100
import rip 1
r5上:bgp 101
import ospf 100
(3)改下一跳
R4对R1、2、3
[R4-bgp]peer 172.16.1.1 next-hop-local
[R4-bgp]peer 172.16.3.1 next-hop-local
[R4-bgp]peer 172.16.6.1 next-hop-local
改完之后(路径全优)
R5上的操作与R4一样,修改R5对R6、7、8的下一跳
此时全网可达
4.使得as101只有汇总和R8的环回传到as100
先写空接口路由
[R5]ip route-static 172.16.0.0 24 NULL 0
宣告在BGP中
[R4]bgp 101
[R4-bgp]network 172.16.0.0 24
此时R5路由表中多了一个路由条目为 172.16.0.0
前缀列表抓流量
[r5]ip ip-prefix yy deny 192.168.0.0 27
[r5]ip ip-prefix yy deny 192.168.0.32 28
[r5]ip ip-prefix yy deny 192.168.0.48 28
[r5]ip ip-prefix yy deny 192.168.0.64 27
[r5]ip ip-prefix yy deny 192.168.0.97 32
[r5]ip ip-prefix yy deny 192.168.0.113 32
[r5]ip ip-prefix yy deny 192.168.0.128 27
[r5]ip ip-prefix yy deny 192.168.0.161 32
[r5]ip ip-prefix yy deny 192.168.0.177 32
[r5]ip ip-prefix yy permit 0.0.0.0 0 less-equal 32
[r5]bgp 101
[r5-bgp]peer 172.16.9.1 ip-prefix yy export
R4上的路由表为
R4上
[r4]ip ip-prefix yy deny 172.16.0.0 24
[r4]ip ip-prefix yy deny 172.16.1.0 24
[r4]ip ip-prefix yy deny 172.16.2.0 24
[r4]ip ip-prefix yy deny 172.16.3.0 24
[r4]ip ip-prefix yy deny 172.16.4.0 24
[r4]ip ip-prefix yy deny 172.16.5.0 24
[r4]ip ip-prefix yy deny 172.16.6.0 24
[r4]ip ip-prefix yy deny 172.16.7.0 24
[r4]ip ip-prefix yy deny 172.16.8.0 24[r4]ip ip-prefix yy deny 172.16.9.0 24
[r4]ip ip-prefix yy deny 172.16.10.0 24
[r4]ip ip-prefix yy permit 0.0.0.0 0 less-equal 32
[r4]bgp 100
[r4-bgp]peer 192.168.0.33 ip-prefix yy export
实验完成