HCIP-BGP实验1

搭建实验拓扑图

要求

1.r1上有两个环回分别为192.168.1.0/24和192.168.2.0/24只允许学到汇总和1.0

2.r7上有两个环回172.16.1.0/24和172.16.2.0/24 要求全部宣告,但是只有2.0可以通过

3.全网可达

实验开始

配IP地址

r1,r2,r3,r4,r5,r6,r7分别配(这里以r1为例)

[r1]interface LoopBack 0
[r1-LoopBack0]ip address 1.1.1.1 32
[r1-LoopBack0]q
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24

RIP

r1

[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 1.0.0.0

r2同上

OSPF

r3

[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 34.1.1.1 0.0.0

r4

[r4]ospf 1 router-id 4.4.4.4 
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.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 45.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0

 r6

[r6]ospf 2 router-id 6.6.6.6
[r6-ospf-2]area 0
[r6-ospf-2-area-0.0.0.0]network 67.1.1.1 0.0.0.0
[r6-ospf-2-area-0.0.0.0]network 6.6.6.6 0.0.0.0

 r7

[r7]ospf 2 router-id 7.7.7.7
[r7-ospf-2]area 0
[r7-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255

完成以上基本配置,接下来按要求做

r1

[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.1 24
[r1-LoopBack1]q
[r1]interface LoopBack 2
[r1-LoopBack2]ip address 192.168.2.1 24

 r7

[r7]interface LoopBack 1
[r7-LoopBack1]ip address 172.16.1.1 24
[r7-LoopBack1]q
[r7]interface LoopBack 2
[r7-LoopBack2]ip address 172.16.2.1 24

 r1宣告

[r1]rip 1	
[r1-rip-1]version 2
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 192.168.2.0

BGP

r1

[r1]bgp 100	
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 2.2.2.2 as-number 100	
[r1-bgp]peer 2.2.2.2 connect-interface LoopBack 0

r2

[r2]bgp 100
[r2-bgp]peer 1.1.1.1 as-number 100

 r3

[r3]bgp 100
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 23.1.1.1 as-number 100
[r3-bgp]peer 5.5.5.5 as-number 101	
[r3-bgp]peer 5.5.5.5 connect-interface LoopBack 0

r5

[r5]bgp 101
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 3.3.3.3 as-number 101	
[r5-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r5-bgp]peer 56.1.1.2 as-number 102

r6

[r6]bgp 102	
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 56.1.1.1 as-number 101
[r6-bgp]peer 7.7.7.7 as-number 102	
[r6-bgp]peer 7.7.7.7 connect-interface LoopBack 0

 r7

[r7]bgp 102
[r7-bgp]router-id 7.7.7.7
[r7-bgp]peer 6.6.6.6 as-number 102	
[r7-bgp]peer 6.6.6.6 connect-interface LoopBack 0

 在r5上查看

在r7上查看

 重发布

r2

[r2-bgp]import-route rip 1

r3

[r3-bgp]import-route ospf 1

r5

[r5-bgp]import-route ospf 1

r6

[r6-bgp]import-route ospf 2

优化

r3

[r3-bgp]peer 5.5.5.5 next-hop-local 

r2

[r2]ospf 1	
[r2-ospf-1]import-route bgp
[r2-ospf-1]q
[r2]bgp 100
[r2-bgp]network 192.168.1.0 24
[r2-bgp]network 192.168.2.0 24
[r2-bgp]aggregate 192.168.0.0 32
[r2-bgp]q	
[r2]ip ip-prefix xx permit 192.168.1.0 24
[r2]route-policy yy permit node 10
[r2-route-policy]if-match ip-prefix xx
[r2-route-policy]q
[r2]bgp 100
[r2-bgp]aggregate 192.168.0.0 22 detail-suppressed suppress-policy yy

 在r7上查看

由于只有2.0可以通过,在r6上做抑制

[r6]ip ip-prefix xx permit 172.16.1.1 32
[r6]route-policy yy deny node 10
[r6-route-policy]if-match ip-prefix xx
[r6-route-policy]q
[r6]route-policy yy permit node 20
[r6-route-policy]q
[r6]bgp 102	
[r6-bgp]peer 56.1.1.1 route-policy yy export

在r5上查看

至此,实验结束 

  • 23
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值