实验要求:
拓扑网搭建
公网配置
通过静态路由使整个公网互相访问
配置ipv4私网
通过静态路由与nat地址转换使私网可以访问公网
[r1]int l0
[r1-LoopBack0]ip add 192.168.1.1 25
[r1-LoopBack0]int l1
[r1-LoopBack1]ip add 192.168.1.129 25
[r1-LoopBack1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.0.1 30
Feb 5 2023 10:38:37-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]q
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.0.2
[r1]ip route-static 192.168.1.0 24 NULL 0
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.0.2 30
Feb 5 2023 10:39:02-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]int l0
[r2-LoopBack0]ip add 192.168.2.1 24
[r2-LoopBack0]q
[r2]ip route-static 192.168.1.0 24 192.168.0.1
[r2]
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[r2-acl-basic-2000]int g0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2000
[r2-GigabitEthernet0/0/0]
配置左侧ipv6私网:
[r1]ipv6
[r1]int l0
[r1-LoopBack0]ipv6 enable
[r1-LoopBack0]ipv6 address 2002:1701:0101:0000::1 65
[r1-LoopBack0]int l1
[r1-LoopBack1]ipv6 enable
[r1-LoopBack1]ipv6 address 2002:1701:0101:0000:8000::1 65
[r1-LoopBack1]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ipv6 enable
[r1-GigabitEthernet0/0/0]ipv6 address 2002:1701:0101:1::1 64
[r2]ipv6
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ipv6 enable
[r2-GigabitEthernet0/0/1]ipv6 address 2002:1701:0101:1::2 64
[r2-GigabitEthernet0/0/1]int l0
[r2-LoopBack0]ipv6 enable
[r2-LoopBack0]ipv6 address 2002:1701:0101:2::1 64
[r2-LoopBack0]q
使用ripng使私网互通
[r1]ripn
[r1]ripng 1
[r1-ripng-1]q
[r1]int l0
[r1-LoopBack0]ripng 1 enable
[r1-LoopBack0]int l1
[r1-LoopBack1]rip
[r1-LoopBack1]ripng 1 enable
[r1-LoopBack1]int g0/0/0
[r1-GigabitEthernet0/0/0]ripng 1 enable
[r1-GigabitEthernet0/0/0]q
[r2]ripng 1
[r2-ripng-1]q
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ripng 1 enable
[r2-GigabitEthernet0/0/1]int l0
[r2-LoopBack0]ripng 1 enable
[r2-LoopBack0]q
R1环回汇总
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ripng summary-address 2002:1701:0101:: 64
[r1-GigabitEthernet0/0/0]
[r1]ipv6 route-static 2002:1701:0101:: 64 NULL 0
6to4tunenl配置
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ipv6 enable
[r2-Tunnel0/0/0]ipv6 address 2002:1701:0101:3::1 64
[r2-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r2-Tunnel0/0/0]source 23.1.1.1
[r2-Tunnel0/0/0]q
[r2]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ripng default-route only
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ipv6 enable
[r4-Tunnel0/0/0]ipv6 address 2002:2201:0102:2::1 64
[r4-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r4-Tunnel0/0/0]source 34.1.1.2
配置右侧ipv6
[r4]ipv6
[r4]int l0
[r4-LoopBack0]ipv6 enable
[r4-LoopBack0]ipv6 address 2002:2201:0102::1 64
[r4-GigabitEthernet0/0/1]int g0/0/0
[r4-GigabitEthernet0/0/0]ipv6 enable
[r4-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:1::1 64
[r4-GigabitEthernet0/0/0]
[r5]ipv6
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]ipv6 enable
[r5-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:1::2 64
[r5-GigabitEthernet0/0/1]int g0/0/0
[r5-GigabitEthernet0/0/0]ipv6 enable
[r5-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8001::1 64
[r5-GigabitEthernet0/0/0]int l0
[r5-LoopBack0]ipv6 enable
[r5-LoopBack0]ipv6 address 2002:2201:0102:8000::1 64
[r5-LoopBack0]
[R6]ipv6
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]ipv6 enable
[R6-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8001::2 64
[R6-GigabitEthernet0/0/1]int l0
[R6-LoopBack0]ipv6 enable
[R6-LoopBack0]ipv6 address 2002:2201:0102:8002::1 64
[R6-LoopBack0]int g0/0/0
[R6-GigabitEthernet0/0/0]ipv6 enable
[R6-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8003::1 64
[R6-GigabitEthernet0/0/0]
[r7]ipv6
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]ipv6 enable
[r7-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8003::2 64
[r7-GigabitEthernet0/0/1]int l0
[r7-LoopBack0]ipv6 enable
[r7-LoopBack0]ipv6 address 2002:2201:0102:8004::1 64
[r7-LoopBack0]int g0/0/0
[r7-GigabitEthernet0/0/0]ipv6 enable
[r7-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8005::1 64
[r7-GigabitEthernet0/0/0]
[r8]ipv6
[r8]int g0/0/1
[r8-GigabitEthernet0/0/1]ipv6 enable
[r8-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8005::2 64.
[r8-GigabitEthernet0/0/1]int l0
[r8-LoopBack0]ipv6 enable
[r8-LoopBack0]ipv6 address 2002:2201:0102:8006::1 64
[r8-LoopBack0]
ospfv3搭建
[r5]ospfv3
[r5-ospfv3-1]router-id 5.5.5.5
[r5-ospfv3-1]int l0
[r5-LoopBack0]ospfv3 1 area 0
[r5-LoopBack0]int g0/0/0
[r5-GigabitEthernet0/0/0]ospfv3 1 area 0
[r5-GigabitEthernet0/0/0]
[R6]ospfv3
[R6-ospfv3-1]router-id 6.6.6.6
[R6-ospfv3-1]int g0/0/1
[R6-GigabitEthernet0/0/1]ospfv3 1 area 0
[R6-GigabitEthernet0/0/1]int l0
[R6-LoopBack0]ospfv3 1 area 0
[R6-LoopBack0]int g0/0/0
[R6-GigabitEthernet0/0/0]ospfv3 1 area 0
[R6-GigabitEthernet0/0/0]
[r7]ospfv3 1
[r7-ospfv3-1]router-id 7.7.7.7
[r7-ospfv3-1]int g0/0/1
[r7-GigabitEthernet0/0/1]ospfv3 1 area 0
[r7-GigabitEthernet0/0/1]int g0/0/0
[r7-GigabitEthernet0/0/0]ospfv3 1 area 0
[r7-GigabitEthernet0/0/0]int l0
[r7-LoopBack0]ospfv3 1 area 0
[r7-LoopBack0]
[r8]ospfv3 1
[r8-ospfv3-1]router-id 8.8.8.8
[r8-ospfv3-1]int g0/0/1
[r8-GigabitEthernet0/0/1]ospfv3 1 area 0
[r8-GigabitEthernet0/0/1]int l0
[r8-LoopBack0]ospfv3 1 area 0
[r8-LoopBack0]
bgp搭建
可以利用ipv6多数组的特性减小工作量
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2002:2201:0102:1::2 as-number 2
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]peer 2002:2201:0102:1::2 enable
[r5]bgp 64512
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 2002:2201:0102:1::1 as-number 1
[r5-bgp]confederation id 2
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 2002:2201:0102:1::1 enable
[r5-bgp-af-ipv6]q
[r5-bgp]q
[r5]int l0
[r5-LoopBack0]ipv6 add
[r5-LoopBack0]ipv6 address 1::5 128
[r5]bgp 64512
[r5-bgp]peer 1::6 as-number 64512
[r5-bgp]peer 1::6 connect-interface LoopBack 0 1::5
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 1::6 enable
[r5-bgp-af-ipv6]
[R6]bgp 64512
[R6-bgp]router-id 6.6.6.6
[R6-bgp]confederation id 2
[R6-bgp]peer 1::5 as-number 64512
[R6-bgp]peer 1::5 connect-interface LoopBack 0 1::6s
[R6-bgp]peer 1::7 as-number 64512
[R6-bgp]peer 1::7 connect-interface LoopBack 0 1::6
[R6-bgp]ipv6-family
[R6-bgp-af-ipv6]peer 1::5 enable
[R6-bgp-af-ipv6]peer 1::7 enable
[R6-bgp-af-ipv6]
[r7]bgp 64512
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64513
[r7-bgp]peer 1::6 as-number 64512
[r7-bgp]peer 1::6 connect-interface LoopBack 0 1::7
[r7-bgp]peer 1::8 as-number 64513
[r7-bgp]peer 1::8 connect-interface LoopBack 0 1::7
[r7-bgp]peer 1::8 ebgp-max-hop 2
[r7-bgp]ipv6-family
[r7-bgp-af-ipv6]peer 1::6 enable
[r7-bgp-af-ipv6]peer 1::8 enable
[r8]bgp 64513
[r8-bgp]router-id 8.8.8.8
[r8-bgp]confederation id 2
[r8-bgp]confederation peer-as 64512
[r8-bgp]peer 1::7 as-number 64512
[r8-bgp]peer 1::7 connect-interface LoopBack 0 1::8b
[r8-bgp]peer 1::7 ebgp-max-hop 2
[r8-bgp]ipv6-family
[r8-bgp-af-ipv6]peer 1::7 enable
修改下一跳和修改反射器
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 1::6 next-hop-local
[r5-bgp-af-ipv6]
[R6]bgp 64512
[R6-bgp]ipv6-family
[R6-bgp-af-ipv6]peer 1::7 reflect-client
[R6-bgp-af-ipv6]
最终结果
R1ping通R3环回与R8环回