NTD TCNE DAY05
1 案例1:IPv6 基本配置
1.1 问题
- 如图配置IPv6地址
- 查看并测试IPv6接口和连通性
- 确保 PC-1 和 PC-2 互通
1.2 方案
搭建实验环境,如图-1所示。
图-11.3 步骤
实现此案例需要按照如下步骤进行。
1)配置终端设备
PC1:
2001:11::1
64
2001:11::254
PC2:
2001:22::1
64
2001:22::254
2)配置网络设备
[Huawei]sysname R1
[R1]ipv6 //开启IPv6功能
[R1]interface GigabitEthernet 0/0/0 //连接 R2 所用的接口
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 address 2001:12::1 64
[R1-GigabitEthernet0/0/0]quit
[R1]interface GigabitEthernet 0/0/2 //连接 PC1 的网关接口
[R1-GigabitEthernet0/0/2]ipv6 enable
[R1-GigabitEthernet0/0/2]ipv6 address 2001:11::254 64
[R1-GigabitEthernet0/0/2]quit
[Huawei]sysname R2
[R2]ipv6 //开启IPv6功能
[R2]interface GigabitEthernet 0/0/1 //连接 R1 所用的接口
[R2-GigabitEthernet0/0/1]ipv6 enable
[R2-GigabitEthernet0/0/1]ipv6 address 2001:12::2 64
[R2-GigabitEthernet0/0/1]quit
[R2]interface GigabitEthernet 0/0/0 //连接 R3 所用的接口
[R2-GigabitEthernet0/0/0]ipv6 enable
[R2-GigabitEthernet0/0/0]ipv6 address 2001:23::2 64
[R2-GigabitEthernet0/0/0]quit
[Huawei]sysname R3
[R3]ipv6 //开启IPv6功能
[R3]interface GigabitEthernet 0/0/0 //连接 R2 所用的接口
[R3-GigabitEthernet0/0/0]ipv6 enable
[R3-GigabitEthernet0/0/0]ipv6 address 2001:23::3 64
[R3-GigabitEthernet0/0/0]quit
[R3]interface GigabitEthernet 0/0/2 //连接 PC1 的网关接口
[R3-GigabitEthernet0/0/2]ipv6 enable
[R3-GigabitEthernet0/0/2]ipv6 address 2001:22::254 64
[R3-GigabitEthernet0/0/2]quit
3)配置IPv6路由条目
[R1]ipv6 route-static :: 0 2001:12::2 //配置IPv6静态默认路由
[R3]ipv6 route-static :: 0 2001:23::2 //配置IPv6静态默认路由
[R2] ipv6 route-static 2001:11:: 64 2001:12::1 //配置去往PC1的路由
[R2] ipv6 route-static 2001:22:: 64 2001:23::3 //配置去往PC2的路由
4)测试 PC1 与 PC2 的连通性
PC1>ping 2001:22::1
Ping 2001:22::1: 32 data bytes, Press Ctrl_C to break
From 2001:22::1: bytes=32 seq=1 hop limit=254 time<1 ms
From 2001:22::1: bytes=32 seq=2 hop limit=254 time=15 ms
From 2001:22::1: bytes=32 seq=3 hop limit=254 time=16 ms
From 2001:22::1: bytes=32 seq=4 hop limit=254 time=15 ms
From 2001:22::1: bytes=32 seq=5 hop limit=254 time=16 ms
—- 2001:22::1 ping statistics —-
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 0/12/16 ms
PC2>ping 2001:11::1
Ping 2001:11::1: 32 data bytes, Press Ctrl_C to break
From 2001:11::1: bytes=32 seq=1 hop limit=254 time=16 ms
From 2001:11::1: bytes=32 seq=2 hop limit=254 time=16 ms
From 2001:11::1: bytes=32 seq=3 hop limit=254 time=15 ms
From 2001:11::1: bytes=32 seq=4 hop limit=254 time=16 ms
From 2001:11::1: bytes=32 seq=5 hop limit=254 time=15 ms
—- 2001:11::1 ping statistics —-
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/15/16 ms
2 案例2:配置 OSPFv3
2.1 问题
- 如图配置IPv6地址和OSPFv3区域
- 查看OSPFv3邻居和数据库LSA
- 确保 R1 和 R3 可以互相访问
2.2 方案
搭建实验环境,如图-2所示。
图-22.3 步骤
实现此案例需要按照如下步骤进行。
1)配置R1 地址,并启用 OSPFv3undo terminal monitor system-view
[Huawei]sysname R1
[R1]ipv6 //开启IPv6功能
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 address 2001:12::1 64
[R1-GigabitEthernet0/0/0]quit
[R1]ospfv3 1 //启用OSPFv3协议
[R1-ospfv3-1]router-id 1.1.1.1 //手动指定 router-id ,必须做
[R1-ospfv3-1]quit
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ospfv3 1 area 0 //将接口宣告进入到OSPFv3进程1的区域0
[R1-GigabitEthernet0/0/0]quit
2)配置R2 地址,并启用 OSPFv3
[Huawei]sysname R2
[R2]ipv6 //开启IPv6功能
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ipv6 enable
[R2-GigabitEthernet0/0/0]ipv6 address 2001:23::2 64
[R2-GigabitEthernet0/0/0]quit
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ipv6 enable
[R2-GigabitEthernet0/0/1]ipv6 address 2001:12::2 64
[R2-GigabitEthernet0/0/1]quit
[R2]ospfv3 1 //启用OSPFv3协议
[R2-ospfv3-1]router-id 2.2.2.2 //手动指定 router-id ,必须做
[R2-ospfv3-1]quit
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ospfv3 1 area 0 //将接口宣告进入到OSPFv3进程1的区域0
[R2-GigabitEthernet0/0/1]quit
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ospfv3 1 area 1 //将接口宣告进入到OSPFv3进程1的区域1
[R2-GigabitEthernet0/0/0]quit
3)配置R3 地址,并启用 OSPFv3
[Huawei]sysname R3
[R3]ipv6 //开启IPv6功能
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ipv6 enable
[R3-GigabitEthernet0/0/1]ipv6 address 2001:23::3 64
[R3-GigabitEthernet0/0/1]quit
[R3]ospfv3 1 //启用OSPFv3协议
[R3-ospfv3-1]router-id 3.3.3.3 //手动指定 router-id ,必须做
[R3-ospfv3-1]quit
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ospfv3 1 area 1 //将接口宣告进入到OSPFv3进程1的区域1
[R3-GigabitEthernet0/0/1]quit
4)验证PC-1与PC-2之间的互通性
[R1]ping ipv6 2001:23::3
PING 2001:23::3 : 56 data bytes, press CTRL_C to break
Reply from 2001:23::3
bytes=56 Sequence=1 hop limit=63 time = 30 ms
Reply from 2001:23::3
bytes=56 Sequence=2 hop limit=63 time = 30 ms
Reply from 2001:23::3
bytes=56 Sequence=3 hop limit=63 time = 40 ms
Reply from 2001:23::3
bytes=56 Sequence=4 hop limit=63 time = 30 ms
Reply from 2001:23::3
bytes=56 Sequence=5 hop limit=63 time = 30 ms
—- 2001:23::3 ping statistics —-
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/32/40 ms
3 案例3:配置 DHCPv6
3.1 问题
- 如图配置IPv6地址
- R1是DHCPv6服务器
- 确保 PC1和PC2自动获取IPv6地址
- 确保PC1和PC2互通
3.2 方案
搭建实验环境,如图-3所示。
图-33.3 步骤
实现此案例需要按照如下步骤进行。
1)设置PC1和PC2的IPv6地址为“自动获取”
2)设置 SW1,确保 DHCPv6 客户端与服务器可以互通undo terminal monitor system-view
[Huawei]sysname SW1
[SW1]vlan 12 //创建 VLAN 12
[SW1-vlan12]quit
[SW1]interface gi0/0/1 //连接 PC1所用的接口
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 12
[SW1-GigabitEthernet0/0/1]quit
[SW1]interface GigabitEthernet 0/0/2 //连接 PC2所用的接口
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 12
[SW1-GigabitEthernet0/0/2]quit
[SW1]interface GigabitEthernet 0/0/24 //连接 R1所用的接口
[SW1-GigabitEthernet0/0/24]port link-type access
[SW1-GigabitEthernet0/0/24]port default vlan 12
[SW1-GigabitEthernet0/0/24]quit
3)配置R1为DHCPv6服务器
[Huawei]sysname R1
[R1]ipv6 enable //开启IPv6功能
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 address 2001:1::254/64
[R1-GigabitEthernet0/0/0]quit
[R1]dhcp enable //开启 DHCP 功能
[R1]dhcpv6 pool VLAN12 //配置IPv6 的 DHCP 地址池
[R1-dhcpv6-pool-VLAN12]address prefix 2001:1::/64 //指定IPv6的网段
[R1-dhcpv6-pool-VLAN12]excluded-address 2001:1::254 //排除IPv6地址
[R1-dhcpv6-pool-VLAN12]quit
[R1]interface gi0/0/0
[R1-GigabitEthernet0/0/0]dhcpv6 server VLAN12 //在接口上关联IPv6地址池
[R1-GigabitEthernet0/0/0]quit
4)验证PC1与PC2之间的互通性
PC1>ping 2001:1::1 //在 PC1 上访问 PC2 的IPv6地址
Ping 2001:1::1: 32 data bytes, Press Ctrl_C to break
From 2001:1::1: bytes=32 seq=1 hop limit=254 time=141 ms
From 2001:1::1: bytes=32 seq=2 hop limit=254 time=78 ms
From 2001:1::1: bytes=32 seq=3 hop limit=254 time=78 ms
From 2001:1::1: bytes=32 seq=4 hop limit=254 time=78 ms
From 2001:1::1: bytes=32 seq=5 hop limit=254 time=62 ms
—- 2001:1::1 ping statistics —-
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/87/141 ms