HCIP网络搭建实验5——5分钟学会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

[Huawei]sysname 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
[R1-GigabitEthernet0/0/0]q
[R1]display ip interface brief

 R2

[Huawei]sysname R2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 23.1.1.1 24
[R2-GigabitEthernet0/0/1]q

[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 32
[R2]display ip interface brief 

 R3

[Huawei]sysname R3
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]interface g0/0/0 
[R3-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 34.1.1.1 24
[R3-GigabitEthernet0/0/1]q
[R3]display ip interface brief 

 R4

[Huawei]sysname R4
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 4.4.4.4 32
[R4-LoopBack0]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip address 34.1.1.2 24
[R4-GigabitEthernet0/0/0]interface g0/0/01
[R4-GigabitEthernet0/0/1]ip address 45.1.1.1 24
[R4-GigabitEthernet0/0/1]q
[R4]display ip interface brief 

 R5

[Huawei]sysname R5
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 5.5.5.5 32
[R5-LoopBack0]interface g0/0/0
[R5-GigabitEthernet0/0/0]ip address 45.1.1.2 24
[R5-GigabitEthernet0/0/0]interface g0/0/1
[R5-GigabitEthernet0/0/1]ip address 56.1.1.1 24
[R5-GigabitEthernet0/0/1]q
[R5]display ip interface brief 

 R6

[Huawei]sysname R6
[R6]interface LoopBack 0
[R6-LoopBack0]ip address 6.6.6.6 32
[R6-LoopBack0]interface g0/0/0
[R6-GigabitEthernet0/0/0]ip address 56.1.1.2 24
[R6-GigabitEthernet0/0/0]interface g0/0/1
[R6-GigabitEthernet0/0/1]ip address 67.1.1.1 24
[R6-GigabitEthernet0/0/1]q
[R6]display ip interface brief 

 R7

[Huawei]sysname R7
[R7]interface LoopBack 0
[R7-LoopBack0]ip address 7.7.7.7 32
[R7-LoopBack0]interface g0/0/0
[R7-GigabitEthernet0/0/0]ip address 67.1.1.2 24
[R7-GigabitEthernet0/0/0]q
[R7]display ip interface brief 

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

[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 2.0.0.0

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.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]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.2.0

R1宣告

[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]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 100
[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 100
[R2-bgp]import-route rip 1

R3

[R3]bgp 100
[R3-bgp]import-route ospf 1

R5

[R5]bgp 100
[R5-bgp]import-route ospf 1

R6

[R6]bgp 102
[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

[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上查看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值