BGP综合实验

实验需求

1、AS1中存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告;

AS3中存在两个环回,一个地址为192.168.2.0/24,该地址不能在任何协议中宣告,最终要求这两个环回可以ping通

2、R1-R8的建邻环回用x.x.X.X/32表示

3、整个AS2的IP地址为172.16.0.0/16,R3-R7上各有一个业务网段,请合理划分;并且其内部配置OSPF协议

4、AS间的骨干链路IP地址随意定制;

5、使用BGP协议让整个网络所有设备的环回可以互相访问;

6、减少路由条目数量,避免环路出现;

配置接口ip地址

R1:

复制代码
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]interface L0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]int L1
[R1-LoopBack1]ip add 192.168.1.1 24

R2:

复制代码
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip add 172.16.1.1 30
[R2-GigabitEthernet0/0/1]interface g0/0/2
[R2-GigabitEthernet0/0/2]ip add 172.16.1.21 30
[R2-GigabitEthernet0/0/2]int L0
[R2-LoopBack0]ip add 2.2.2.2 32

R3:

复制代码
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.1.2 30
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip add 172.16.1.5 30
[R3-GigabitEthernet0/0/1]interface L0
[R3-LoopBack0]ip add 3.3.3.3 32
[R3-LoopBack0]int L1
[R3-LoopBack1]ip add 172.16.3.3 24

R4:

复制代码
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip add 172.16.1.6 30
[R4-GigabitEthernet0/0/0]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip add 172.16.1.9 30
[R4-GigabitEthernet0/0/1]interface L0
[R4-LoopBack0]ip add 4.4.4.4 32
[R4-LoopBack0]int L1
[R4-LoopBack1]ip add 172.16.4.4 24

R5:

复制代码
[R5]interface g0/0/0
[R5-GigabitEthernet0/0/0]ip add 172.16.1.22 30
[R5-GigabitEthernet0/0/0]interface g0/0/1
[R5-GigabitEthernet0/0/1]ip add 172.16.1.17 30
[R5-GigabitEthernet0/0/1]interface L0
[R5-LoopBack0]ip add 5.5.5.5 32
[R5-LoopBack0]int L1
[R5-LoopBack1]ip add 172.16.5.5 24

R6:

复制代码
[R6]interface g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.1.18 30
[R6-GigabitEthernet0/0/0]interface g0/0/1
[R6-GigabitEthernet0/0/1]ip add 172.16.1.13 30
[R6-GigabitEthernet0/0/1]interface L0
[R6-LoopBack0]ip add 6.6.6.6 32
[R6-LoopBack0]int L1
[R6-LoopBack1]ip add 172.16.6.6 24

R7:

复制代码
[R7]interface g0/0/0
[R7-GigabitEthernet0/0/0]ip add 172.16.1.14 30
[R7-GigabitEthernet0/0/0]interface g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.1.10 30
[R7-GigabitEthernet0/0/1]interface g0/0/2
[R7-GigabitEthernet0/0/2]ip add 34.1.1.7 24
[R7-GigabitEthernet0/0/2]interface L0
[R7-LoopBack0]ip add 7.7.7.7 32
[R7-LoopBack0]int L1
[R7-LoopBack1]ip add 172.16.7.7 24

R8:

复制代码
[R8]interface g0/0/0
[R8-GigabitEthernet0/0/0]ip add 34.1.1.8 24
[R8-GigabitEthernet0/0/0]interface L0
[R8-LoopBack0]ip add 8.8.8.8 32
[R8-LoopBack0]int L1
[R8-LoopBack1]ip add 192.168.2.8 24

配置ospf

复制代码
[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.0 0.0.255.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 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 3.3.3.3 0.0.0.0
[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
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[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
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[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
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[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
[R7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[R7-ospf-1-area-0.0.0.0]network 7.7.7.7 0.0.0.0

测试:

建IBGP邻居和EBGP邻居

复制代码
[R1]bgp 1
[R1-bgp]peer 12.1.1.2 as-number 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 3.3.3.3 as-number 64512
[R2-bgp]peer 3.3.3.3 connect-interface L0 
[R2-bgp]peer 3.3.3.3 next-hop-local 
[R2-bgp]peer 172.16.1.22 as-number 64513
[R2-bgp]peer 172.16.1.22 next-hop-local 

[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]peer 2.2.2.2 as-number 64512
[R3-bgp]peer 2.2.2.2 connect-interface L0
[R3-bgp]peer 4.4.4.4 as-number 64512
[R3-bgp]peer 4.4.4.4 connect-interface L0

[R4]bgp 64512 
[R4-bgp]confederation id 2
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 3.3.3.3 as-number 64512
[R4-bgp]peer 3.3.3.3 next-hop-local
[R4-bgp]peer 3.3.3.3 connect-interface L0
[R4-bgp]peer 172.16.1.10 as-number 64513
[R4-bgp]peer 172.16.1.10 next-hop-local 

[R5]bgp 64513  
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.1.21 as-number 64512
[R5-bgp]peer 172.16.1.21 next-hop-local 
[R5-bgp]peer 6.6.6.6 as-number 64513
[R5-bgp]peer 6.6.6.6 connect-interface L0
[R5-bgp]peer 6.6.6.6 next-hop-local 

[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 5.5.5.5 as-number 64513
[R6-bgp]peer 5.5.5.5 connect-interface L0
[R6-bgp]peer 7.7.7.7 as-number 64513
[R6-bgp]peer 7.7.7.7 connect-interface L0

[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 6.6.6.6 as-number 64513
[R7-bgp]peer 6.6.6.6 connect-interface L0
[R7-bgp]peer 6.6.6.6 next-hop-local 
[R7-bgp]peer 172.16.1.9 as-number 64
[R7-bgp]peer 172.16.1.9 as-number 64512
[R7-bgp]peer 172.16.1.9 next-hop-local 
[R7-bgp]peer 34.1.1.8 as-number 3

[R8]bgp 3
[R8-bgp]peer 34.1.1.7 as    
[R8-bgp]peer 34.1.1.7 as-number 2

查看建邻

在BGP中宣告网段

复制代码
[R3]interface L1
[R3-LoopBack1]ospf network-type broadcast

[R4]interface L1
[R4-LoopBack1]ospf network-type broadcast

[R5]interface L1
[R5-LoopBack1]ospf network-type broadcast

[R6]interface L1
[R6-LoopBack1]ospf network-type broadcast

[R7]interface L1
[R7-LoopBack1]ospf network-type broadcast
宣告
复制代码
[R2]bgp 64512
[R2-bgp]network 172.16.3.0 24
[R2-bgp]network 172.16.4.0 24
[R2-bgp]network 172.16.5.0 24
[R2-bgp]network 172.16.6.0 24
[R2-bgp]network 172.16.7.0 24

[R7]bgp 64513
[R7-bgp]network 172.16.3.0 24
[R7-bgp]network 172.16.4.0 24
[R7-bgp]network 172.16.5.0 24
[R7-bgp]network 172.16.6.0 24
[R7-bgp]network 172.16.7.0 24

[R3]bgp 64512
[R3-bgp]peer 2.2.2.2 reflect-client 
[R3-bgp]peer 4.4.4.4 reflect-client

[R6]bgp 64513
[R6-bgp]peer 5.5.5.5 reflect-client 
[R6-bgp]peer 7.7.7.7 reflect-client

测试

复制代码
[R1]bgp 1
[R1-bgp]network 1.1.1.1 32
[R8]bgp 3
[R8-bgp]network 8.8.8.8 32

汇总

复制代码
[R2]bgp 64512
[R2-bgp]aggregate 172.16.0.0 21 detail-suppressed as-set 
[R2]ip route-static 172.16.0.0 21 NULL 0

[R7]bgp 64513
[R7-bgp]aggregate 172.16.0.0 21 detail-suppressed as-set 
[R7]ip route-static 172.16.0.0 21 NULL 0
路由引入+路由过滤
复制代码
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1]route-policy im permit node 10
[R1-route-policy]if-match acl 2000
[R1]bgp 1 
[R1-bgp]import-route direct route-policy im


[R8]acl 2000
[R8-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R8]route-policy im permit node 10
[R8-route-policy]if-match acl 2000
[R8]bgp 3
[R8-bgp]import-route direct route-policy im

测试:

相关推荐
小乖写代码1 小时前
帧协议(TCP) · TCP Framing
网络·网络协议·tcp/ip·tcp
如夏倾城17 小时前
VRRP(虚拟路由器冗余协议Virtual Router Redundancy Protocol)
网络·python·网络协议·安全·智能路由器·负载均衡·信息与通信
张小姐的猫21 小时前
【基于 WebSocket 的多用户网页五子棋】—— 认识第三方库Websocketpp
网络·websocket·网络协议
LightBreeze200221 小时前
IS-IS 基本概念详解——报文类型、地址结构与网络拓扑
网络·lsp·路由协议·net·is-is
小乖写代码2 天前
提交注册验证 · WhatsApp /v2/register
android·网络·账号注册
多弗朗皮卡丘2 天前
网络基础:数据链路层与其他协议或技术
linux·网络·tcp/ip
我不会插花弄玉2 天前
9.数据链路层【由浅入深-网络】
网络
进击的荆棘2 天前
Linux网络——网络基础概念
linux·运维·服务器·网络
LightBreeze20022 天前
从 LSA 到路由计算,彻底理解 OSPF 的区域路由与防环机制
网络·智能路由器·ospf·lsa·spf
忆挽篱笙歌2 天前
通信连接,匿名管道
linux·服务器·网络