BGP综合实验

STEP1:配置IP地址环回地址,AS2内部启用ospf协议

 骨干链路划分进入子网172.16.0.0/24,且子网掩码为30位
将所有用于建立邻居的IP写在环回地址0上,子网划分在172.16.1.0/24网段,子网掩码位32位

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.32.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.64.1 0.0.0.0

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.64.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.96.1 0.0.0.0

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.96.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.224.1 0.0.0.0

[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 172.16.128.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.32.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.160.1 0.0.0.0

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 172.16.129.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.160.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.192.1 0.0.0.0

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 172.16.129.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.160.2 0.0.0.0

display ospf peer brief        ( 观察邻居表是否建立邻居关系)
 

STEP2:使用bgp协议,使用路由反射器和联邦。

[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.1.1.2 as-number 2

[R2]bgp 64512
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation id 2    
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 12.1.1.1 as-number 1
[R2-bgp]peer 172.16.1.1 as-number 64512
[R2-bgp]peer 172.16.1.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.128.1 as-number 64513
[R2-bgp]peer 172.16.128.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.128.1 ebgp-max-hop 2

[R3]bgp 64512
[R3-bgp]router-id 3.3.3.3    
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.0.1 as-number 64512
[R3-bgp]peer 172.16.0.1 connect-interface LoopBack 0
[R3-bgp]peer 172.16.2.1 as-number 64512
[R3-bgp]peer 172.16.2.1 connect-interface LoopBack 0

[R4]bgp 64512
[R4-bgp]router-id 4.4.4.4
[R4-bgp]confederation id 2
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 172.16.1.1 as-number 64512
[R4-bgp]peer 172.16.1.1 connect-interface LoopBack 0
[R4-bgp]peer 172.16.130.1 as-number 64513
[R4-bgp]peer 172.16.130.1 connect-interface LoopBack 0
[R4-bgp]peer 172.16.130.1 ebgp-max-hop 2

[R5]bgp 64513
[R5-bgp]router-id 5.5.5.5
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.0.1 as-number 64512
[R5-bgp]peer 172.16.0.1 connect-interface LoopBack 0
[R5-bgp]peer 172.16.0.1 ebgp-max-hop 2
[R5-bgp]peer 172.16.129.1 as-number 64512
[R5-bgp]peer 172.16.129.1 connect-interface LoopBack 0

[R6]bgp 64513
[R6-bgp]router-id 6.6.6.6
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.128.1 as-number 64513
[R6-bgp]peer 172.16.128.1 connect-interface LoopBack 0
[R6-bgp]peer 172.16.130.1 as-number 64513
[R6-bgp]peer 172.16.130.1 connect-interface LoopBack 0

[R7]bgp 64513
[R7-bgp]router-id 7.7.7.7
[R7-bgp]confederation id 2
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 172.16.129.1 as-number 64513
[R7-bgp]peer 172.16.129.1 connect-interface LoopBack 0
[R7-bgp]peer 172.16.2.1 as-number 64512
[R7-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[R7-bgp]peer 172.16.2.1 ebgp-max-hop 2
[R7-bgp]peer 23.1.1.2 as-number 3

[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 23.1.1.1 as-number 2

[R1]ip route-static 10.1.1.0 255.255.255.0 null 0
[R1]bgp 1
[R1-bgp]network 10.1.1.0 24

[R2]ip route-static 0.0.0.0 0.0.0.0 null 0
[R2]bgp 64512
[R2-bgp]network 172.16.0.0 19
[R2-bgp]peer 172.16.1.1 next-hop-local
[R2-bgp]peer 172.16.128.1 next-hop-local

[R7]ip route-static 0.0.0.0 0.0.0.0 null 0
[R7]bgp 64513
[R7-bgp]network 172.16.0.0 19
[R7-bgp]peer 172.16.2.1 next-hop-local
[R7-bgp]peer 172.16.129.1 next-hop-local

[R8]ip route-static 10.1.2.0 24 null 0
[R8]bgp 3
[R8-bgp]network 10.1.2.0 24

R3的路由是优,但是由于三和四都是IBGP,所以R4中没有路由,这里有两种解决办法
R2和R4建立BGP邻居
[R2]bgp 64512 
[R2-bgp]peer 172.16.2.1 as-number 64512
[R2-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.2.1 next-hop-local
[R4]bgp 64512
[R4-bgp]peer 172.16.0.1 as-number 64512
[R4-bgp]peer 172.16.0.1 connect-interface LoopBack 0
5和7建立BGP邻居
[R7]bgp 64513
[R7-bgp]peer 172.16.128.1 as-number 64513
[R7-bgp]peer 172.16.128.1 connect-interface LoopBack 0
[R5]bgp 64513
[R5-bgp]peer 172.16.130.1 as-number 64513
[R5-bgp]peer 172.16.130.1 connect-interface LoopBack 0
[R5-bgp]peer 172.16.130.1 next-hop-local
让R3和R6成为RR反射器
[R3-bgp]peer 172.16.2.1 reflect-client    让R4成为R3的客户
[R6-bgp]peer 172.16.130.1 reflect-client  让R7成为R5的客户 R7和R5上出现路 

STEP 3:192.168.1.1和192.168.2.1可以通信,要使用tunnel,手写一条静态路由

[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 20.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 10.1.1.1
[R1-Tunnel0/0/0]destination 10.1.2.1
[R1-Tunnel0/0/0]qu
[R1]ip route-static 192.168.2.0 24 20.1.1.2

[R8]int Tunnel 0/0/0
[R8-Tunnel0/0/0]ip add 20.1.1.2 24    
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]source 10.1.2.1
[R8-Tunnel0/0/0]destination 10.1.1.1
[R8-Tunnel0/0/0]qu
[R8]ip route-static 192.168.1.0 255.255.255.0 20.1.1.1

STEP4:全网可达

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值