Example for Configuring IPv6 Static Routes
Networking Requirements
On an IPv6 network, hosts on different network segments are connected through several Switches. Every two hosts on different network segments can communicate with each other without using dynamic routing protocols.
Configuration Roadmap
The configuration roadmap is as follows:
- Create VLANs, add interfaces to the VLANs, and assign IPv6 addresses to VLANIF interfaces so that devices can communicate with each other.
- Configure the IPv6 default gateway on each host, and configure IPv6 static routes and default static routes on each Switch so that hosts on different network segments can communicate with each other without using dynamic routing protocols.
Procedure
- Add interfaces to VLANs.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*SwitchA] vlan batch 10 20 [*SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 10 [*SwitchA-10GE1/0/2] commit [~SwitchA-10GE1/0/2] quit [~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 20 [*SwitchA-10GE1/0/1] commit [~SwitchA-10GE1/0/1] quit
The configurations of SwitchB and SwitchC are similar to that of SwitchA. The detailed configurations are not provided here.
- Assign IP addresses to the VLANIF interfaces.
[~SwitchA] interface vlanif 10 [*SwitchA-Vlanif10] ipv6 enable [*SwitchA-Vlanif10] ipv6 address fc00:0:0:2001::1/64 [*SwitchA-Vlanif10] commit [~SwitchA-Vlanif10] quit [~SwitchA] interface vlanif 20 [*SwitchA-Vlanif20] ipv6 enable [*SwitchA-Vlanif20] ipv6 address fc00:0:0:2004::1/64 [*SwitchA-Vlanif20] commit [~SwitchA-Vlanif20] quit
The configurations of SwitchB and SwitchC are similar to that of SwitchA. The detailed configurations are not provided here.
- Configure the host addresses and gateways.
Configure an IPv6 address for each host according to the networking diagram. Configure the default gateway of PC1 to FC00:0:0:2001::1, that of PC2 to FC00:0:0:2002::1, and that of Host3 to FC00:0:0:2003::1.
- Configure static IPv6 routes.
# Configure a default IPv6 route on SwitchA.
[~SwitchA] ipv6 route-static :: 0 vlanif20 fc00:0:0:2004::2 [*SwitchA] commit
# Configure two IPv6 static routes on SwitchB.
[~SwitchB] ipv6 route-static fc00:0:0:2001:: 64 vlanif20 fc00:0:0:2004::1
[*SwitchB] ipv6 route-static fc00:0:0:2003:: 64 vlanif40 fc00:0:0:2005::1 [*SwitchB] commit
# Configure a default IPv6 route on SwitchC.
[~SwitchC] ipv6 route-static :: 0 vlanif40 FC00:0:0:2005::2 [*SwitchC] commit
- Verify the configuration.
# Check the IPv6 routing table on SwitchA.
[~SwitchA] display ipv6 routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route --------------------------------------------------------------------------------- Routing Table : _public_ Destinations : 6 Routes : 6 Destination : :: PrefixLength : 0 NextHop : FC00:0:0:2004::2 Preference : 60 Cost : 0 Protocol : Static RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif20 Flags : D Destination : FC00:0:0:2001:: PrefixLength : 64 NextHop : FC00:0:0:2001::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif10 Flags : D Destination : FC00:0:0:2001::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif10 Flags : D Destination : FC00:0:0:2004:: PrefixLength : 64 NextHop : FC00:0:0:2004::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif20 Flags : D Destination : FC00:0:0:2004::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif20 Flags : D Destination : FE80:: PrefixLength : 10 NextHop : :: Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : NULL0 Flags : D
# Run the ping command.
[~SwitchA] ping ipv6 fc00:0:0:2003::1 PING FC00:0:0:2003::1 : 56 data bytes, press CTRL_C to break Reply from FC00:0:0:2003::1 bytes=56 Sequence=1 hop limit=63 time = 63 ms Reply from FC00:0:0:2003::1 bytes=56 Sequence=2 hop limit=63 time = 62 ms Reply from FC00:0:0:2003::1 bytes=56 Sequence=3 hop limit=63 time = 62 ms Reply from FC00:0:0:2003::1 bytes=56 Sequence=4 hop limit=63 time = 63 ms Reply from FC00:0:0:2003::1 bytes=56 Sequence=5 hop limit=63 time = 63 ms --- fc00:0:0:2003::1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 62/62/63 ms
# Run the tracert command.
[~SwitchA] tracert ipv6 fc00:0:0:2003::1 traceroute to FC00:0:0:2003::1 30 hops max,60 bytes packet 1 FC00:0:0:2004::2 31 ms 32 ms 31 ms 2 FC00:0:0:2003::1 62 ms 63 ms 62 ms
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # vlan batch 10 20 # interface Vlanif10 ipv6 enable ipv6 address FC00:0:0:2001::1/64 # interface Vlanif20 ipv6 enable ipv6 address FC00:0:0:2004::1/64 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 10 # ipv6 route-static :: 0 vlanif20 FC00:0:0:2004::2 # return
Configuration file of SwitchB
# sysname SwitchB # vlan batch 20 30 40 # interface Vlanif20 ipv6 enable ipv6 address FC00:0:0:2004::2/64 # interface Vlanif30 ipv6 enable ipv6 address FC00:0:0:2002::1/64 # interface Vlanif40 ipv6 enable ipv6 address FC00:0:0:2005::2/64 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 40 # interface 10GE1/0/3 port link-type trunk port trunk allow-pass vlan 30 # ipv6 route-static FC00:0:0:2001:: 64 Vlanif20 FC00:0:0:2004::1 ipv6 route-static FC00:0:0:2003:: 64 Vlanif40 FC00:0:0:2005::1 # return
Configuration file of SwitchC
# sysname SwitchC # vlan batch 40 50 # interface Vlanif40 ipv6 enable ipv6 address FC00:0:0:2005::1/64 # interface Vlanif50 ipv6 enable ipv6 address FC00:0:0:2003::1/64 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 40 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 50 # ipv6 route-static :: 0 Vlanif40 FC00:0:0:2005::2 # return