BGP第二次实验

实验拓扑图及要求:
在这里插入图片描述
基础配置:
r1
[r1]int lo0
[r1-LoopBack0]ip add 172.16.1.1 24
[r1-LoopBack0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 172.16.0.1 30
[r1-GigabitEthernet0/0/1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.0.5 30

r2
[r2]int lo0
[r2-LoopBack0]ip add 172.16.2.1 24
[r2-LoopBack0]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.0.2 30
[r2-GigabitEthernet0/0/0]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.0.9 30
[r2-GigabitEthernet0/0/2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 24.1.1.1 24
r3
[r3]int lo0
[r3-LoopBack0]ip add 172.16.3.1 24
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.0.6 30
[r3-GigabitEthernet0/0/0]int g0/0/2
[r3-GigabitEthernet0/0/2]ip add 172.16.0.10 30
[r3-GigabitEthernet0/0/2]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 35.1.1.1 24
r4
[r4]int lo0
[r4-LoopBack0]ip add 172.17.4.1 24
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 24.1.1.2 24
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 172.17.0.1 30
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 172.17.0.5 30
r5
[r5]int lo0
[r5-LoopBack0]ip add 172.17.5.1 24
[r5-LoopBack0]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 35.1.1.2 24
[r5-GigabitEthernet0/0/0]int g0/0/2
[r5-GigabitEthernet0/0/2]ip add 172.17.0.6 30
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 172.17.0.9 30
r6
[r6]int lo0
[r6-LoopBack0]ip add 172.17.6.1 24
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.17.0.2 30
[r6]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 172.17.32.1 30
r7
[r7]int lo0
[r7-LoopBack0]ip add 172.17.7.1 24
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 172.17.0.10 30
[r7]interface GigabitEthernet0/0/1
[r7-GigabitEthernet0/0/1]ip address 172.17.32.9 255.255.255.252
r8
[r8]int lo0
[r8-LoopBack0]ip add 172.17.33.1 24
[r8-LoopBack0]interface GigabitEthernet0/0/0
[r8-GigabitEthernet0/0/0]ip address 172.17.32.2 255.255.255.252
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.17.32.5 30
r9
[r9]int lo0
[r9-LoopBack0]ip add 172.17.34.1 24
[r9]interface GigabitEthernet0/0/0
[r9-GigabitEthernet0/0/0]ip address 172.17.32.10 255.255.255.252
[r9-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1
[r9-GigabitEthernet0/0/1]ip address 172.17.32.13 255.255.255.252
[r9]interface GigabitEthernet0/0/2
[r9-GigabitEthernet0/0/2]ip address 91.1.1.1 255.255.255.0
r10
[r10]int lo0
[r10-LoopBack0]ip add 172.17.35.1 24
[r10-LoopBack0]interface GigabitEthernet0/0/0
[r10-GigabitEthernet0/0/0]ip address 172.17.32.6 255.255.255.252
[r10]interface GigabitEthernet0/0/1
[r10-GigabitEthernet0/0/1]ip address 172.17.64.1 255.255.255.252
r11
[r11]int lo0
[r11-LoopBack0]ip add 172.17.36.1 24
[r11]interface GigabitEthernet0/0/0
[r11-GigabitEthernet0/0/0]ip address 172.17.32.14 255.255.255.252
[r11]interface GigabitEthernet0/0/1
[r11-GigabitEthernet0/0/1]ip address 172.17.64.5 255.255.255.252
r12
[r12]int lo0
[r12-LoopBack0]ip add 172.17.65.1 24
[r12-LoopBack0]interface GigabitEthernet0/0/0
[r12-GigabitEthernet0/0/0]ip address 172.17.64.2 255.255.255.252
[r12-GigabitEthernet0/0/0]interface GigabitEthernet0/0/2
[r12-GigabitEthernet0/0/2]ip address 172.17.64.9 255.255.255.252
[r12-GigabitEthernet0/0/2]interface GigabitEthernet0/0/1
[r12-GigabitEthernet0/0/1]ip address 124.1.1.1 255.255.255.0
r13
[r13]int lo0
[r13-LoopBack0]ip add 172.17.66.1 24
[r13-LoopBack0]interface GigabitEthernet0/0/0
[r13-GigabitEthernet0/0/0]ip address 172.17.64.6 255.255.255.252
[r13-GigabitEthernet0/0/0]interface GigabitEthernet0/0/2
[r13-GigabitEthernet0/0/2]ip address 172.17.64.10 255.255.255.252
[r13-GigabitEthernet0/0/2]interface GigabitEthernet0/0/1
[r13-GigabitEthernet0/0/1]ip address 134.1.1.1 255.255.255.0
r14
[r14]interface GigabitEthernet0/0/0
[r14-GigabitEthernet0/0/0]ip address 124.1.1.2 255.255.255.0
[r14-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1
[r14-GigabitEthernet0/0/1]ip address 134.1.1.2 255.255.255.0
[r14-GigabitEthernet0/0/1]int lo0
[r14-LoopBack0]ip add 172.18.14.1 24
r15
[r15-GigabitEthernet0/0/2]int lo0
[r15-LoopBack0]ip add 172.19.15.1 24
[r15]interface GigabitEthernet0/0/2
[r15-GigabitEthernet0/0/2]ip address 91.1.1.2 255.255.255.0

S1启RIP
r1
[r1]rip
[r1-rip-1]version 2
[r1-rip-1]un summary
[r1-rip-1]network 172.16.0.0
r2
[r2]rip 1
[r2-rip-1]undo summary
[r2-rip-1]version 2
[r2-rip-1]network 172.16.0.0
r3
[r3]rip 1
[r3-rip-1]undo summary
[r3-rip-1]version 2
[r3-rip-1]network 172.16.0.0
S2启OSPF
r4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 172.17.0.0 0.0.255.255
r5
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.17.0.0 0.0.255.255
r6
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.17.0.2 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.17.6.1 0.0.0.0
[r6-ospf-1]area 1
[r6-ospf-1-area-0.0.0.1]network 172.17.32.1 0.0.0.0
r7
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.17.0.10 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.17.7.1 0.0.0.0
[r7-ospf-1-area-0.0.0.0]area 0.0.0.1
[r7-ospf-1-area-0.0.0.1]network 172.17.32.9 0.0.0.0
r8
[r8-ospf-1-area-0.0.0.1]ospf 1 router-id 8.8.8.8
[r8-ospf-1]area 1
[r8-ospf-1-area-0.0.0.1]network 172.17.0.0 0.0.255.255
r9
[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]area 1
[r9-ospf-1-area-0.0.0.1]network 172.17.0.0 0.0.255.255
r10
[r10]ospf 1 router-id 10.10.10.10
[r10-ospf-1]area 0.0.0.1
[r10-ospf-1-area-0.0.0.1]network 172.17.32.0 0.0.3.255
[r10-ospf-1-area-0.0.0.1]ospf 2
[r10-ospf-2]area 0.0.0.2
[r10-ospf-2-area-0.0.0.2]network 172.17.64.1 0.0.0.0
r11
[r11]ospf 1 router-id 11.11.11.11
[r11-ospf-1]area 0.0.0.1
[r11-ospf-1-area-0.0.0.1]network 172.17.32.0 0.0.7.255
[r11-ospf-1-area-0.0.0.1]ospf 2
[r11-ospf-2]area 0.0.0.2
[r11-ospf-2-area-0.0.0.2]network 172.17.64.5 0.0.0.0
r12
[r12]ospf 1 router-id 12.12.12.12
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]network 172.17.0.0 0.0.255.255
r13
[r13]ospf 1 router-id 13.13.13.13
[r13-ospf-1]area 2
[r13-ospf-1-area-0.0.0.2]network 172.17.0.0 0.0.255.255

双向重发布
r10
[r10]ospf
[r10-ospf-1]import-route ospf 2
[r10-ospf-1]q
[r10]ospf 2
[r10-ospf-2]import-route ospf 1
r11
[r11]ospf 1
[r11-ospf-1]import-route ospf 2
[r11-ospf-1]q
[r11]ospf 2
[r11-ospf-2]import-route ospf 1
修改优先级
以r11为例
[r11]ospf 1
[r11-ospf-1]preference route-policy a
[r11]ip ip-prefix a permit 172.17.35.0 24
[r11]route-policy a permit node 10
[r11-route-policy]if-match ip-prefix a
[r11-route-policy]apply preference 151
启BGP
r1
[r1-bgp]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 172.16.2.1 as-number 1
[r1-bgp]peer 172.16.2.1 connect-interface lo0
[r1-bgp]peer 172.16.3.1 as-number 1
[1-bgp]peer 172.16.3.1 connect-interface LoopBack 0
r2
[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 172.16.1.1 as-number 1
[r2-bgp]peer 172.16.1.1 connect-interface LoopBack 0
[r2-bgp]peer 172.16.3.1 as-number 1
[r2-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r2-bgp]peer 24.1.1.2 as-number 2
r3
[r3]bgp 1
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 172.16.1.1 as-number 1
[r3-bgp]peer 172.16.1.1 connect-interface LoopBack 0
[r3-bgp]peer 172.16.2.1 as-number 1
[r3-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[r3-bgp]peer 35.1.1.2 as-number 2
r4
[r4]bgp 2
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 172.16.2.1 as-number 1
[r4-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[r4-bgp]peer 172.17.5.1 as-number 2
[r4-bgp]peer 172.17.5.1 connect-interface LoopBack 0
[r4-bgp]peer 172.17.34.1 as-number 2
[r4-bgp]peer 172.17.34.1 connect-interface LoopBack 0
r5
[r5]bgp 2
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 35.1.1.1 as-number 1
[r5-bgp]peer 172.17.4.1 as-number 2
[r5-bgp]peer 172.17.4.1 connect-interface LoopBack 0
[r5-bgp]peer 172.17.34.1 as-number 2
[r5-bgp]peer 172.17.34.1 connect-interface LoopBack 0
r9
[r9]bgp 2
[r9-bgp]router-id 9.9.9.9
[r9-bgp]peer 172.17.4.1 as-number 1
[r9-bgp]peer 172.17.4.1 connect-interface LoopBack 0
[r9-bgp]peer 172.17.5.1 as-number 2
[r9-bgp]peer 172.17.5.1 connect-interface LoopBack 0
[r9-bgp]peer 172.17.65.1 as-number 2
[r9-bgp]peer 172.17.65.1 connect-interface LoopBack 0
[r9-bgp]peer 172.17.66.1 as-number 2
[r9-bgp]peer 172.17.66.1 connect-interface LoopBack 0
[r9-bgp]peer 91.1.1.2 as-number 4
r12
[r12]bgp 2
[r12-bgp]router-id 12.12.12.12
[r12-bgp]peer 172.17.34.1 as-number 2
[r12-bgp]peer 172.17.34.1 connect-interface LoopBack 0
[r12-bgp]peer 172.17.66.1 as-number 2
[r12-bgp]peer 172.17.66.1 connect-interface LoopBack 0
[r12-bgp]peer 124.1.1.2 as-number 3
r13
[r13]bgp 2
[r13-bgp]router-id 13.13.13.13
[r13-bgp]peer 172.17.34.1 as-number 2
[r13-bgp]peer 172.17.34.1 connect-interface LoopBack 0
[r13-bgp]peer 172.17.65.1 as-number 2
[r13-bgp]peer 172.17.65.1 connect-interface LoopBack 0
[r13-bgp]peer 134.1.1.2 as-number 3
r14
[r14]bgp 3
[r14-bgp]router-id 14.14.14.14
[r14-bgp]peer 124.1.1.2 as-number 2
[r14-bgp]peer 134.1.1.2 as-number 2
r15
[r15]bgp 4
[r15-bgp]router-id 15.15.15.15
[r15-bgp]peer 91.1.1.2 as-number 2
实验完成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值