Example for Configuring a Dot1q Termination Layer 3 Sub-interface to Implement Communication Across a Layer 3 Network
Networking Requirements
As shown in Figure 5-26, SwitchA and SwitchB connect to data center networks in VLAN 10 and VLAN 20 through 10GE1/0/1.1. A Layer 3 network running OSPF is deployed between SwitchA and SwitchB.
Layer 3 connectivity is required between the two data center networks.
Configuration Roadmap
Switches connect to the two data center network through Layer 3 sub-interfaces, so the Dot1q termination Layer 3 sub-interface can be configured to implement Layer 3 connectivity. The configuration roadmap is as follows:
- Create VLANs on SwitchC and SwitchD and configure uplink interfaces and user-side interfaces so that packets of data center networks can be forwarded to SwitchA and SwitchB at Layer 2.
Configure interfaces on SwitchA and SwitchB connected to data center networks to terminate VLAN tags of data center networks.
Configure interfaces on SwitchA and SwitchB connected to the Layer 3 network, and configure VLANIF interfaces and basic OSPF functions to implement Layer 3 forwarding.
On the edge device of the Layer 3 network connected to SwitchA and SwitchB, configure the interconnected interfaces, VLAIF interfaces, and basic OSPF functions so that the edge device can communicate with SwitchA and SwitchB at Layer 3. Layer 3 connectivity between the two data center networks is therefore implemented.
For the configuration on the edge device of the Layer 3 network connected to SwitchA and SwitchB, see the configuration manual of the edge device.
Procedure
- Configure SwitchC and SwitchD.
Configure a VLAN on SwitchC, and add the uplink interface to VLAN 10 in tagged mode and user-side interface to VLAN 10 in untagged mode. Configure a VLAN on SwitchD, and add the uplink interface to VLAN 20 in tagged mode and user-side interface to VLAN 20 in untagged mode. For the detailed configuration, see Example for Assigning VLANs Based on Ports.
- Configure SwitchA.
# Configure 10GE1/0/1.1 on SwitchA connected to the data center network to terminate VLAN 10.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] interface 10ge1/0/1 [~SwitchA-10GE1/0/1] undo portswitch [*SwitchA-10GE1/0/1] quit [*SwitchA] interface 10ge 1/0/1.1 [*SwitchA-10GE1/0/1.1] dot1q termination vid 10 [*SwitchA-10GE1/0/1.1] ip address 10.10.10.1 24 [*SwitchA-10GE1/0/1.1] quit [*SwitchA] commit
# Create a VLAN and configure 10GE1/0/2 on SwitchA connected to the Layer 3 network to allow the VLAN.
[~SwitchA] vlan batch 30 [*SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 30 [*SwitchA-10GE1/0/2] quit [*SwitchA] commit
# Create a VLANIF interface and assign an IP address to the VLANIF interface so that SwitchA can forward packets at Layer 3.
[~SwitchA] interface vlanif 30 [*SwitchA-Vlanif30] ip address 10.10.30.1 24 [*SwitchA-Vlanif30] quit [*SwitchA] commit
# Configure basic OSPF functions.
[~SwitchA] router id 1.1.1.1 [*SwitchA] ospf [*SwitchA-ospf-1] area 0 [*SwitchA-ospf-1-area-0.0.0.0] network 10.10.10.0 0.0.0.255 [*SwitchA-ospf-1-area-0.0.0.0] network 10.10.30.0 0.0.0.255 [*SwitchA-ospf-1-area-0.0.0.0] quit [*SwitchA-ospf-1] quit [*SwitchA] commit
- Configure SwitchB.
# Configure 10GE1/0/1.1 on SwitchB connected to the data center network to terminate VLAN 20.
<HUAWEI> system-view [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] interface 10ge1/0/1 [~SwitchB-10GE1/0/1] undo portswitch [*SwitchB-10GE1/0/1] quit [*SwitchB] interface 10ge 1/0/1.1 [*SwitchB-10GE1/0/1.1] dot1q termination vid 20 [*SwitchB-10GE1/0/1.1] ip address 10.10.20.1 24 [*SwitchB-10GE1/0/1.1] quit [*SwitchB] commit
# Create a VLAN and configure 10GE1/0/2 on SwitchB connected to the Layer 3 network to allow the VLAN.
[~SwitchB] vlan batch 40 [*SwitchB] interface 10ge 1/0/2 [*SwitchB-10GE1/0/2] port link-type trunk [*SwitchB-10GE1/0/2] port trunk allow-pass vlan 40 [*SwitchB-10GE1/0/2] quit [*SwitchB] commit
# Create a VLANIF interface and assign an IP address to the VLANIF interface so that SwitchB can forward packets at Layer 3.
[~SwitchB] interface vlanif 40 [*SwitchB-Vlanif40] ip address 10.10.40.1 24 [*SwitchB-Vlanif40] quit [*SwitchB] commit
# Configure basic OSPF functions.
[~SwitchB] router id 2.2.2.2 [*SwitchB] ospf [*SwitchB-ospf-1] area 0 [*SwitchB-ospf-1-area-0.0.0.0] network 10.10.20.0 0.0.0.255 [*SwitchB-ospf-1-area-0.0.0.0] network 10.10.40.0 0.0.0.255 [*SwitchB-ospf-1-area-0.0.0.0] quit [*SwitchB-ospf-1] quit [*SwitchB] commit
- Verify the configuration.
On ServerA of the data center network connected to SwitchA, configure the default gateway address as the IP address 10.10.10.1/24 of 10GE1/0/1.1.
On ServerB of the data center network connected to SwitchB, configure the default gateway address as the IP address 10.10.20.1/24 of 10GE1/0/2.1.
After the configuration is complete, Layer 3 connectivity between the two data center networks is implemented.
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # router id 1.1.1.1 # vlan batch 30 # interface Vlanif30 ip address 10.10.30.1 255.255.255.0 # interface 10GE1/0/1 undo portswitch # interface 10GE1/0/1.1 ip address 10.10.10.1 255.255.255.0 dot1q termination vid 10 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 30 # ospf 1 area 0.0.0.0 network 10.10.10.0 0.0.0.255 network 10.10.30.0 0.0.0.255 # return
Configuration file of SwitchB
# sysname SwitchB # router id 2.2.2.2 # vlan batch 40 # interface Vlanif40 ip address 10.10.40.1 255.255.255.0 # interface 10GE1/0/1 undo portswitch # interface 10GE1/0/1.1 ip address 10.10.20.1 255.255.255.0 dot1q termination vid 20 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 40 # ospf 1 area 0.0.0.0 network 10.10.20.0 0.0.0.255 network 10.10.40.0 0.0.0.255 # return