Figure 1 shows an IPv6 network. PC1, PC2, and PC3 are on different network segments, and are connected through SwitchA, SwitchB, and SwitchC. Any two PCs must be connected using static routes to communicate with each other without using dynamic routing protocols.
The configuration roadmap is as follows:
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 20 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 20 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type access [SwitchA-GigabitEthernet0/0/2] port default vlan 10 [SwitchA-GigabitEthernet0/0/2] quit
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA.
[SwitchA] ipv6 [SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ipv6 enable [SwitchA-Vlanif10] ipv6 address fc00:0:0:2001::1/64 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 20 [SwitchA-Vlanif20] ipv6 enable [SwitchA-Vlanif20] ipv6 address fc00:0:0:2010::1/64 [SwitchA-Vlanif20] quit
Assign IPv6 addresses to the PCs, and set the default gateway address of PC1, PC2, and PC3 to fc00:0:0:2001::1, fc00:0:0:2002::1, and fc00:0:0:2003::1 respectively.
# Configure a default IPv6 static route on SwitchA.
[SwitchA] ipv6 route-static :: 0 vlanif20 fc00:0:0:2010::2
# Configure two IPv6 static routes on SwitchB.
[SwitchB] ipv6 route-static fc00:0:0:2001:: 64 vlanif20 fc00:0:0:2010::1
[SwitchB] ipv6 route-static fc00:0:0:2003:: 64 vlanif40 fc00:0:0:2020::2
# Configure a default IPv6 static route on SwitchC.
[SwitchC] ipv6 route-static :: 0 vlanif40 fc00:0:0:2020::1
# Check the IPv6 routing table on SwitchA.
[SwitchA] display ipv6 routing-table
Routing Table : Public
Destinations : 7 Routes : 7
Destination : :: PrefixLength : 0
NextHop : FC00:0:0:2010::2 Preference : 60
Cost : 0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : Vlanif20 Flags : D
Destination : ::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : InLoopBack0 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:2010:: PrefixLength : 64
NextHop : FC00:0:0:2010::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : Vlanif20 Flags : D
Destination : FC00:0:0:2010::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 to verify the connectivity.
[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 to verify the connectivity.
[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:2010::2 31 ms 32 ms 31 ms
2 FC00:0:0:2003::1 62 ms 63 ms 62 ms
SwitchA configuration file
# sysname SwitchA # ipv6 # 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:2010::1/64 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet0/0/2 port link-type access port default vlan 10 # ipv6 route-static :: 0 Vlanif20 FC00:0:0:2010::2 # return
SwitchB configuration file
# sysname SwitchB # ipv6 # vlan batch 20 30 40 # interface Vlanif20 ipv6 enable ipv6 address FC00:0:0:2010::2/64 # interface Vlanif30 ipv6 enable ipv6 address FC00:0:0:2002::1/64 # interface Vlanif40 ipv6 enable ipv6 address FC00:0:0:2020::1/64 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 40 # interface GigabitEthernet0/0/3 port link-type access port default vlan 30 # ipv6 route-static FC00:0:0:2001:: 64 Vlanif20 FC00:0:0:2010::1 ipv6 route-static FC00:0:0:2003:: 64 Vlanif40 FC00:0:0:2020::2 # return
SwitchC configuration file
# sysname SwitchC # ipv6 # vlan batch 40 50 # interface Vlanif40 ipv6 enable ipv6 address FC00:0:0:2020::2/64 # interface Vlanif50 ipv6 enable ipv6 address FC00:0:0:2003::1/64 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 40 # interface GigabitEthernet0/0/2 port link-type access port default vlan 50 # ipv6 route-static :: 0 Vlanif40 FC00:0:0:2020::1 # return