实验拓扑如上:
实验要求:
1、AS1中存在两个环回,个地址为192.168.1.0/24,该地址不能在任何协议中宣告,最终要求这两个环回可以ping通;As3中存在两个环回,一个地址为192.168.2.0/24,
该地址不能在任何协议中宣告,最终要求这两个环回可以ping通
2、整个AS2的IP地址为172.16.0.0/16,请合理划分;并且其内部配置osPF协议
3、R1-R8的建邻环回用x.x.x.x/32表示;R2-R7上除了建邻环回,每个设备再划分一个业务网段;
4、AS间的骨干链路IP地址随意定制;
5、使用BGP协议让整个网络所有设备的环回可以互相访问;
第一步:
配置相应的IP地址:
R1:
R2
R3:
R4:
R5:
R6:
R7:
R8:
第二步:
在AS2 中配置OSPF:
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
在R2上检查是否建立邻居关系:dis ip routing-table protocol ospf
第三步
配置BGP:
R1:
[R1]bgp 1
[R1-bgp]peer 12.1.1.2 as 2 //使用物理口进行IBGP连接
R2:
[R2]bgp 64512
[R2-bgp]confederation id 2 //表示自己所在的小区域属于哪个大区域
[R2-bgp]confederation peer-as 64513 //邻居视为联盟内部的邻居,而这些邻居的AS号就是64513
[R2-bgp]peer 12.1.1.1 as-number 1
[R2-bgp]peer 172.16.0.30 as-number 64512
[R2-bgp]peer 172.16.0.30 connect-interface l0
[R2-bgp]peer 172.16.0.30 next-hop-loca
[R2-bgp]peer 172.16.0.50 as-number 64513 //联盟内AS 64512和AS 64513建立EBGP
[R2-bgp]peer 172.16.0.50 connect-interface l0
[R2-bgp]peer 172.16.0.50 next-hop-local
[R2-bgp]peer 172.16.0.50 ebgp-max-hop //修改最大跳数,默认修改为255
R3:
[R3]bgp 64512
[R3-bgp]peer 172.16.0.20 as-number 64512
[R3-bgp]peer 172.16.0.20 connect-interface l0
[R3-bgp]peer 172.16.0.40 as-number 64512
[R3-bgp]peer 172.16.0.40 connect-interface l0
需要做路由反射器,IBGP之间有水平分割限制
[R3-bgp]peer 172.16.0.20 reflect-client
[R3-bgp]peer 172.16.0.40 reflect-client
R4:
[R4-bgp]confederation id 2
[R4-bgp]peer 172.16.0.30 connect-interface l0
R5:
[R5]bgp 64513
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.0.60 as 64513
[R5-bgp]peer 172.16.0.60 connect-interface l0
[R5-bgp]peer 172.16.0.60 next-hop-local
[R5-bgp]peer 172.16.0.20 connect-interface l0
[R5-bgp]peer 172.16.0.20 next-hop-loca
[R5-bgp]peer 172.16.0.20 ebgp-max-ho
R6:
[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.0.50 as-number 64513
[R6-bgp]peer 172.16.0.50 connect-interface l0
[R6-bgp]peer 172.16.0.70 as-number 64513
[R6-bgp]peer 172.16.0.70 connect-interface l0
[R6-bgp]peer 172.16.0.50 reflect-client
[R6-bgp]peer 172.16.0.70 reflect-client
R7:
[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]peer 172.16.0.60 as-number 64513
[R7-bgp]peer 172.16.0.60 connect-interface l0
[R7-bgp]peer 172.16.0.60 next-hop-local
[R7-bgp]peer 34.1.1.8 as-number 3
R8:
[R8]bgp 3
[R8-bgp]peer 34.1.1.7
[R8-bgp]peer 34.1.1.7 as-number 2
第四步:
宣告业务网段
R2:
[R2]bgp 64512
[R2-bgp]net 172.16.0.20 32
R3:
[R3]bgp 64512
[R3-bgp]net 172.16.30.0 24
R4:
[R4]bgp 64512
[R4-bgp]net 172.16.40.0 24
R5:
[R5]bgp 64513
[R5-bgp]net 172.16.50.0 24
R6:
[R6]bgp 64513
[R6-bgp]net 172.16.60.0 24
R7:
[R7]bgp 64513
[R7-bgp]net 172.16.70.0 24
查看学习情况:dis bgp routing-table
第五步:
建立隧道,使AS1中的这个192.168.1.0/24地址可以ping通AS3中的192.168.2.0/24地址
R1:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip address 100.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 172.16.0.10
[R1-Tunnel0/0/0]description 172.16.0.80
[R1-bgp]net 172.16.0.10 32
R8:
[R8]int t0/0/0
[R8-Tunnel0/0/0]ip address 100.1.1.8 24
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]source 172.16.0.80
[R8-Tunnel0/0/0]description 172.16.0.10
[R8-bgp]net 172.16.0.80 32
第六步:
使AS1和AS3中的私网网通
[R1]ip route-static 192.168.2.0 24 100.1.1.8
[R8]ip route-static 192.168.1.0 24 100.1.1.1
测试:
实验结束.