HCIP-BGP实验4

发布时间:2024年01月24日

搭建实验拓扑图

要求

1.全网可达?

2.isp只能配置IP地址

实验开始

配置IP地址及环回

r1,r2,r9,r10配ipv4地址(以r1为例)

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

OSPF

r1

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255

r2

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]q
[r2-ospf-1]q
[r2]ip route-static 0.0.0.0 0 29.1.1.2
[r2]ospf 1 	
[r2-ospf-1]default-route-advertise 
[r2-ospf-1]q
[r2]acl 2000
[r2-acl-basic-2000]rule permit source any 
[r2-acl-basic-2000]q
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]nat outbound  2000

r10

[r10]ip route-static 0.0.0.0 0 91.1.1.1

在r10上ping 9.9.9.9

?在r1上同样可以ping通

r1配ipv6地址

[r1]ipv6
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ipv6 enable 
[r1-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101::1/50
[r1-GigabitEthernet0/0/0]q
[r1]interface LoopBack 0
[r1-LoopBack0]ipv6 enable 
[r1-LoopBack0]ipv6 address 1::1/64

r2

[r2]ipv6
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ipv6 enable
[r2-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101::2/50
[r2-GigabitEthernet0/0/0]q
[r2]interface LoopBack 0
[r2-LoopBack0]ipv6 enable
[r2-LoopBack0]ipv6 address 2::2/64

r10

[r10]ipv6
[r10]interface g0/0/1
[r10-GigabitEthernet0/0/1]ipv6 enable
[r10-GigabitEthernet0/0/1]ipv6 address 2002:5b01:0102::1/50
[r10-GigabitEthernet0/0/1]q
[r10]interface LoopBack 0
[r10-LoopBack0]ipv6 enable
[r10-LoopBack0]ipv6 address 10::10/64

?r11

[r11]ipv6
[r11]interface g0/0/0
[r11-GigabitEthernet0/0/0]ipv6 enable
[r11-GigabitEthernet0/0/0]ipv6 address 2002:5b01:0102::2/50
[r11-GigabitEthernet0/0/0]q
[r11]interface LoopBack 0
[r11-LoopBack0]ipv6 enable
[r11-LoopBack0]ipv6 address 11::11/64

在r2上ping 一下

在r11上ping一下

做隧道?

r2?

[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ipv6 enable
[r2-Tunnel0/0/0]ipv6 address 2002:1d01:0101:4000::1/50

r10

[r10]interface Tunnel 0/0/0	
[r10-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4 
[r10-Tunnel0/0/0]source g0/0/0
[r10-Tunnel0/0/0]ipv6 enable
[r10-Tunnel0/0/0]ipv6 address 2002:5b01:0102:4000::1/50

做引流

r1

[r1]ipv6 route-static :: 0 2002:1d01:0101::2

r2

[r2]ipv6 route-static :: 0 Tunnel 0/0/0

r10

[r10]ipv6 route-static :: 0 Tunnel 0/0/0
[r10]interface g0/0/1
[r10-GigabitEthernet0/0/1]ripng default-route originate

RIP

r10

[r10]ripng 1
[r10-ripng-1]q
[r10]interface g0/0/1
[r10-GigabitEthernet0/0/1]ripng 1 enable
[r10-GigabitEthernet0/0/1]q
[r10]interface LoopBack 0
[r10-LoopBack0]ripng 1 enable

r11

[r11]ripng 1
[r11-ripng-1]q	
[r11]interface LoopBack 0
[r11-LoopBack0]ripng 1 enable
[r11-LoopBack0]q
[r11]interface g0/0/0
[r11-GigabitEthernet0/0/0]ripng 1 enable

在r10宣告隧道

[r10]interface Tunnel 0/0/0
[r10-Tunnel0/0/0]ripng 1 enable

查看缺省

?在r2上测试隧道是否通

在r1上ping?r2的环回?

在r2上写指向r1的静态路由

[r2]ipv6 route-static 1::1 64 2002:1D01:101::1

此时在r2上ping r1的环回?

在r1上ping ,并不通

解决

由于地址划分有问题,修改如下?

r10

[r10]interface LoopBack 0
[r10-LoopBack0]undo ipv6 address 
[r10-LoopBack0]ipv6 address 2002:5b01:0102:8000::1/50
[r10-LoopBack0]ripng 1 enable

在ping一次?

继续配置ipv6地址及环回地址

?r3

[r3]ipv6 
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ipv6 enable
[r3-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101:4::2/64
[r3-GigabitEthernet0/0/0]q
[r3]interface LoopBack 0
[r3-LoopBack0]ipv6 enable
[r3-LoopBack0]ipv6 address 3::3/64
[r3-LoopBack0]q
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ipv6 enable
[r3-GigabitEthernet0/0/1]ipv6 address 2002:1d01:0101:5::1/64

r4

[r4]ipv6
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ipv6 
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ipv6 enable
[r4-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101:5::2/64
[r4-GigabitEthernet0/0/0]q
[r4]interface LoopBack 0
[r4-LoopBack0]ipv6 enable
[r4-LoopBack0]ipv6 address 4::4/64
[r4-LoopBack0]q
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ipv6 enable
[r4-GigabitEthernet0/0/1]ipv6 address 2002:1d01:0101:6::1/64

r5

[r5]interface LoopBack 0
[r5-LoopBack0]ipv6 enable
[r5-LoopBack0]ipv6 address 5::5/64
[r5-LoopBack0]q
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ipv6 enable
[r5-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101:6::2/64
[r5-GigabitEthernet0/0/0]q
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]ipv6 enable
[r5-GigabitEthernet0/0/1]ipv6 address 2002:1d01:0101:7::1/64

r6

[r6]interface g0/0/0
[r6-GigabitEthernet0/0/0]ipv6 enable
[r6-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101:7::2/64
[r6-GigabitEthernet0/0/0]q
[r6]interface LoopBack 0
[r6-LoopBack0]ipv6 enable
[r6-LoopBack0]ipv6 address 6::6/64
[r6-LoopBack0]q
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]ipv6 enable 
[r6-GigabitEthernet0/0/1]ipv6 address 2002:1d01:0101:8::1/64

?r7

[r7]ipv6
[r7]interface LoopBack 0
[r7-LoopBack0]ipv6 enable
[r7-LoopBack0]ipv6 address 7::7/64
[r7-LoopBack0]q
[r7]interface g0/0/0
[r7-GigabitEthernet0/0/0]ipv6 enable 
[r7-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101:8::2/64
[r7-GigabitEthernet0/0/0]q
[r7]interface g0/0/1
[r7-GigabitEthernet0/0/1]ipv6 enable
[r7-GigabitEthernet0/0/1]ipv6 address 2002:1d01:0101:9::1/64

r8

[r8]ipv6
[r8]interface LoopBack 0
[r8-LoopBack0]ipv6 enable
[r8-LoopBack0]ipv6 address 8::8/64
[r8-LoopBack0]q
[r8]interface g0/0/0
[r8-GigabitEthernet0/0/0]ipv6 enable
[r8-GigabitEthernet0/0/0]ipv6 address 2002:1d01:0101:9::2/64

?OSPF

r3

[r3]ospfv3 1
[r3-ospfv3-1]router-id 3.3.3.3
[r3-ospfv3-1]q
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ospfv3 1 area 0
[r3-GigabitEthernet0/0/1]q
[r3]interface LoopBack 0
[r3-LoopBack0]ospfv3 1 area 0

r4

[r4]ospfv3 1
[r4-ospfv3-1]router-id 4.4.4.4
[r4-ospfv3-1]q
[r4]interface LoopBack 0
[r4-LoopBack0]ospfv3 1 area 0
[r4-LoopBack0]q
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ospfv3 1 area 0
[r4-GigabitEthernet0/0/0]q
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ospfv3 1 area 0

r5

[r5]ospfv3 1
[r5-ospfv3-1]router-id 5.5.5.5
[r5-ospfv3-1]q
[r5]interface LoopBack 0
[r5-LoopBack0]ospfv3 1 area 0
[r5-LoopBack0]q
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ospfv3 1 area 0
[r5-GigabitEthernet0/0/0]q
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]ospfv3 1 area 0

r6

[r6]ospfv3 1
[r6-ospfv3-1]router-id 6.6.6.6
[r6-ospfv3-1]q
[r6]interface g0/0/0
[r6-GigabitEthernet0/0/0]ospfv3 1 area 0
[r6-GigabitEthernet0/0/0]q
[r6]interface LoopBack 0
[r6-LoopBack0]ospfv3 1 area 0

RIP

r7

[r7]ripng 1
[r7-ripng-1]q
[r7]interface g0/0/1
[r7-GigabitEthernet0/0/1]ripng 1 enable
[r7-GigabitEthernet0/0/1]q
[r7]interface LoopBack 0
[r7-LoopBack0]ripng 1 enable

r8

[r8]ripng 1
[r8-ripng-1]q
[r8]interface LoopBack 0
[r8-LoopBack0]ripng 1 enable
[r8-LoopBack0]q
[r8]interface g0/0/0
[r8-GigabitEthernet0/0/0]ripng 1 enable

?在r8上ping

建立BGP

r3

[r3]bgp 64512
[r3-bgp]confederation id 100
[r3-bgp]router-id 3.3.3.3	
[r3-bgp]peer 4::4 as-number 64512
[r3-bgp]peer 4::4 connect-interface lo 0
[r3-bgp]ipv6-family 
[r3-bgp-af-ipv6]peer 4::4 enable

?r4

[r4]bgp 64512
[r4-bgp]confederation id 100
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 3::3 as-number 64512	
[r4-bgp]peer 3::3 connect-interface  lo 0	
[r4-bgp]peer 5::5 as-number 64512
[r4-bgp]peer 5::5 connect-interface lo 0
[r4-bgp]ipv6-family 
[r4-bgp-af-ipv6]peer 3::3 enable
[r4-bgp-af-ipv6]peer 3::3 reflect-client 
[r4-bgp-af-ipv6]peer 5::5 enable
[r4-bgp-af-ipv6]peer 5::5 reflect-clien

r5

[r5]bgp 64512
[r5-bgp]confederation id 100
[r5-bgp]confederation peer-as 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 4::4 as-number 64512
[r5-bgp]peer 4::4 connect-interface  lo 0
[r5-bgp]peer 6::6 as-number 64513
[r5-bgp]peer 6::6 connect-interface  lo 0
[r5-bgp]peer 6::6 ebgp-max-hop 
[r5-bgp]ipv6-family 
[r5-bgp-af-ipv6]peer 4::4 enable
[r5-bgp-af-ipv6]peer 4::4 next-hop-local 
[r5-bgp-af-ipv6]peer 6::6 enable

r6

[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 100
[r6-bgp]confederation peer-as 64512
[r6-bgp]peer 5::5 as-number 64512
[r6-bgp]peer 5::5 connect-interface lo 0
[r6-bgp]peer 5::5 ebgp-max-hop 
[r6-bgp]peer 2002:1D01:101:9::1 as-number 101	
[r6-bgp]ipv6-family 
[r6-bgp-af-ipv6]peer 5::5 enable
[r6-bgp-af-ipv6]peer 2002:1D01:101:9::1 enable
[r6-bgp]peer 2002:1D01:101:8::2 as-number 101
[r6-bgp]ipv6-family 
[r6-bgp-af-ipv6]peer 2002:1D01:101:8::2 enable

?r7

[r7]bgp 101
[r7-bgp]router-id 7.7.7.7
[r7-bgp]peer 2002:1D01:101:8::1 as-number 100	
[r7-bgp]peer 8::8 as-number 101
[r7-bgp]peer 8::8 connect-interface  lo 0
[r7-bgp]ipv6-family 
[r7-bgp-af-ipv6]peer 8::8 enable
[r7-bgp-af-ipv6]peer 8::8 next-hop-local 
[r7-bgp-af-ipv6]peer 2002:1D01:101:8::1 enable

?r8

[r8]bgp 101
[r8-bgp]router-id 8.8.8.8	
[r8-bgp]peer 7::7 as-number 101
[r8-bgp]peer 7::7 connect-interface lo 0
[r8-bgp]ipv6-family 
[r8-bgp-af-ipv6]peer 7::7 enable

?重发布

r7

[r7-bgp]ipv6-family 
[r7-bgp-af-ipv6]import-route ripng 1

?r6

[r6-bgp]ipv6-family 
[r6-bgp-af-ipv6]import-route ospfv3 1

?以上就是基本操作了

文章来源:https://blog.csdn.net/2201_75769266/article/details/135775922
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。