实验BGP综合实验
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验BGP综合实验
实验物理拓扑图
R1
r1(config)#interface e1/0
r1(config-if)#ip add 192.168.1.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#interface loopback 1
r1(config-if)#ip add 1.1.1.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#interface loopback 2
r1(config-if)#ip add 192.168.7.11 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#router rip
r1(config-router)#net 192.168.1.0
r1(config-router)#net 192.168.7.0
r1(config-router)#net 1.1.1.0
r1(config-router)#exit
r1(config)#router bgp 100
r1(config-router)#neighbor 2.2.2.2 remote-as 200 手动指上邻居
r1(config-router)#neighbor 2.2.2.2 update-source loopback 1 以我的LOOPBACK 1 为原与
2 .2..2.2 建立邻居关系
r1(config-router)#neighbor 2.2.2.2 ebgp-multihop 2 EB与EB用回环口建立邻居所
要经历的HOP数
r1(config-router)#exit
r1(config)#ip route 2.2.2.0 255.255.255.0 192.168.1.2
r1(config)#router bgp 100
r1(config-router)#net 192.168.1.0
r1(config-router)#net 1.1.1.0
r1(config-router)#net 192.168.7.0
r1(config-router)#end
R2
r2(config)#interface e1/0
r2(config-if)#ip add 192.168.1.2 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#interface e1/1
r2(config-if)#ip add 192.168.2.1 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#interface loopback 1
r2(config-if)#ip add 2.2.2.2 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#router eigrp 100
r2(config-router)#net 2.2.2.0
r2(config-router)#net 192.168.2.0
r2(config-router)#exit
r2(config)#router bgp 200
r2(config-router)#neighbor 1.1.1.1 remote-as 100
r2(config-router)#neighbor 1.1.1.1 update-source loopback 1
r2(config-router)#neighbor 1.1.1.1 ebgp-multihop 2
r2(config-router)#exit
r2(config)#ip route 1.1.1.0 255.255.255.0 192.168.1.1
r2(config)#router bgp 200
r2(config-router)#neighbor 3.3.3.3 remote-as 200
r2(config-router)#neighbor 3.3.3.3 update-source loopback 1
r2(config-router)#neighbor 4.4.4.4 remote-as 200
r2(config-router)#neighbor 4.4.4.4 update-source loopback 1
r2(config-router)#net 192.168.1.0
r2(config-router)#net 192.168.2.0
r2(config-router)#net 2.2.2.0
r2(config-router)#end
r2#show ip r
*Mar 1 00:19:29.135: %SYS-5-CONFIG_I: Configured from console by console
r2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static rou
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 [1/0] via 192.168.1.1
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback1
D 2.0.0.0/8 is a summary, 00:13:45, Null0
D 3.0.0.0/8 [90/409600] via 192.168.2.2, 00:09:50, Ethernet1/1
D 4.0.0.0/8 [90/435200] via 192.168.2.2, 00:07:28, Ethernet1/1
B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:00:38
B 192.168.7.0/24 [20/0] via 1.1.1.1, 00:01:19
C 192.168.1.0/24 is directly connected, Ethernet1/0
C 192.168.2.0/24 is directly connected, Ethernet1/1
D 192.168.3.0/24 [90/307200] via 192.168.2.2, 00:09:47, Ethernet1/1
r2(config)#router bgp 200
r2(config-router)#neighbor 3.3.3.3 next-hop-self 默认EB告诉IB路由条目是下一跳
不会改变所以必须强制下一跳
r2(config-router)#neighbor 4.4.4.4 next-hop-self
r2(config-router)#end
r2#show ip route
*Mar 1 00:21:54.807: %SYS-5-CONFIG_I: Configured from console by console
r2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static rou
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
B 192.168.12.0/24 [200/0] via 4.4.4.4, 00:00:06
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 [1/0] via 192.168.1.1
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback1
D 2.0.0.0/8 is a summary, 00:16:11, Null0
D 3.0.0.0/8 [90/409600] via 192.168.2.2, 00:12:16, Ethernet1/1
D 4.0.0.0/8 [90/435200] via 192.168.2.2, 00:09:54, Ethernet1/1
B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:03:04
B 192.168.7.0/24 [20/0] via 1.1.1.1, 00:03:45
C 192.168.1.0/24 is directly connected, Ethernet1/0
C 192.168.2.0/24 is directly connected, Ethernet1/1
D 192.168.3.0/24 [90/307200] via 192.168.2.2, 00:12:13, Ethernet1/1
R3
r3(config)#interface e1/1
r3(config-if)#ip add 192.168.2.2 255.255.255.0
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#interface e1/0
r3(config-if)#ip add 192.168.3.1 255.255.255.0
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#interface loopback 1
r3(config-if)#ip add 3.3.3.3 255.255.255.0
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#router eigrp 100
r3(config-router)#net 3.3.3.0
r3(config-router)#net 192.168.2.0
r3(config-router)#net 192.168.3.0
r3(config-router)#exit
r3(config)#router bgp 200
r3(config-router)#neighbor 2.2.2.2 remote-as 200
r3(config-router)#neighbor 2.2.2.2 update-source loopback 1
r3(config-router)#neighbor 4.4.4.4 remote-as 200
r3(config-router)#neighbor 4.4.4.4 update-source loopback 1
r3(config-router)#net 192.168.2.0
r3(config-router)#net 192.168.3.0
r3(config-router)#net 3.3.3.0
r3(config-router)#end
r3#show ip route
*Mar 1 00:19:36.211: %SYS-5-CONFIG_I: Configured from console by r3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter a
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-
ia - IS-IS inter area, * - candidate default, U - per-user
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
D 2.0.0.0/8 [90/409600] via 192.168.2.1, 00:09:58, Ethernet1/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback1
D 3.0.0.0/8 is a summary, 00:10:00, Null0
D 4.0.0.0/8 [90/409600] via 192.168.3.2, 00:07:36, Ethernet1/0
B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:00:46
B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:01:28
C 192.168.2.0/24 is directly connected, Ethernet1/1
C 192.168.3.0/24 is directly connected, Ethernet1/0
r3#show ip bgp
BGP table version is 7, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path *>i192.168.1.0 2.2.2.2 0 100 0 i *> 192.168.2.0 0.0.0.0 0 32768 i
* i 2.2.2.2 0 100 0 i
* i192.168.3.0 4.4.4.4 0 100 0 i *> 0.0.0.0 0 32768 i *>i192.168.4.0 4.4.4.4 0 100 0 i
* i192.168.7.0 1.1.1.1 0 100 0 100 i * i192.168.12.0 5.5.5.5 0 100 0 300 i r3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter a
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-
ia - IS-IS inter area, * - candidate default, U - per-user
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
D 2.0.0.0/8 [90/409600] via 192.168.2.1, 00:10:53, Ethernet1/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback1
D 3.0.0.0/8 is a summary, 00:10:56, Null0
D 4.0.0.0/8 [90/409600] via 192.168.3.2, 00:08:31, Ethernet1/0
B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:01:41
B 192.168.7.0/24 [200/0] via 2.2.2.2, 00:00:13
B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:02:23
C 192.168.2.0/24 is directly connected, Ethernet1/1
C 192.168.3.0/24 is directly connected, Ethernet1/0
r3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter a
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-
ia - IS-IS inter area, * - candidate default, U - per-user
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
B 192.168.12.0/24 [200/0] via 4.4.4.4, 00:00:09
D 2.0.0.0/8 [90/409600] via 192.168.2.1, 00:12:10, Ethernet1/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback1
D 3.0.0.0/8 is a summary, 00:12:12, Null0
D 4.0.0.0/8 [90/409600] via 192.168.3.2, 00:09:48, Ethernet1/0
B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:02:58
B 192.168.7.0/24 [200/0] via 2.2.2.2, 00:01:29
B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:03:40
C 192.168.2.0/24 is directly connected, Ethernet1/1
C 192.168.3.0/24 is directly connected, Ethernet1/0
R4
r4(config)#interface e1/0
r4(config-if)#ip add 192.168.3.2 255.255.255.0
r4(config-if)#no shutdown
r4(config-if)#exit
r4(config)#interface e1/1
r4(config-if)#ip add 192.168.4.1 255.255.255.0
r4(config-if)#no shutdown
r4(config-if)#exit
r4(config)#interface loopback 1
r4(config-if)#ip add 4.4.4.4 255.255.255.0
r4(config-if)#no shutdown
r4(config-if)#exit
r4(config)#router eigrp 100
r4(config-router)#net 192.168.3.0
r4(config-router)#net 4.4.4.0
r4(config-router)#exit
r4(config)#router bgp 200
r4(config-router)#neighbor 3.3.3.3 remote-as 200
r4(config-router)#neighbor 3.3.3.3 update-source loopback r4(config-router)#neighbor 2.2.2.2 remote-as 200
r4(config-router)#neighbor 2.2.2.2 update-source loopback r4(config-router)#neighbor 5.5.5.5 remote-as 300
r4(config-router)#neighbor 5.5.5.5 update-source loopback r4(config-router)#neighbor 5.5.5.5 ebgp-multihop 2
r4(config-router)#exit
r4(config)#ip route 5.5.5.0 255.255.255.0 192.168.4.2
r4(config)#router bgp 200
r4(config-router)#net 192.168.3.0
r4(config-router)#net 192.168.4.0
r4(config-router)#net 4.4.4.0
r4(config-router)#end
r4(config)#router bgp 200
r4(config-router)#neighbor 3.3.3.3 next-hop-self
r4(config-router)#neighbor 2.2.2.2 next-hop-self
R5
r5(config)#interface e1/1
r5(config-if)#ip add 192.168.4.2 255.255.255.0
r5(config-if)#no shutdown
r5(config-if)#exit
r5(config)#interface loopback 1
r5(config-if)#ip add 5.5.5.5 255.255.255.0
r5(config-if)#no shutdown
r5(config-if)#exit
r5(config)#interface loopback 2
r5(config-if)#ip add 192.168.12.27 255.255.255.0
r5(config-if)#no shutdown
r5(config-if)#exit
r5(config)#router ospf 1
r5(config-router)#net 5.5.5.0 0.0.0.255 area 0
r5(config-router)#net 192.168.4.0 0.0.0.255 area 0
r5(config-router)#net 192.168.12.0 255.255.255.0 area 0
r5(config-router)#exit
r5(config)#ip route 4.4.4.0 255.255.255.0 192.168.4.1
r5(config)#router bgp 300
r5(config-router)#neighbor 4.4.4.4 remote-as 200
r5(config-router)#neighbor 4.4.4.4 update-source loopback 1 r5(config-router)#neighbor 4.4.4.4 ebgp-multihop 2
r5(config-router)#net 192.168.4.0
r5(config-router)#net 192.168.12.0
r5(config-router)#net 5.5.5.0。