IP subnet-based VLAN configuration example

Network requirements

As shown in Figure 44, the hosts in the office belong to different IP subnets.

Configure Device C to transmit packets from 192.168.5.0/24 and 192.168.50.0/24 in VLANs 100 and 200, respectively.

Figure 44: Network diagram

Configuration procedure

  1. Configure Device C:

    # Associate IP subnet 192.168.5.0/24 with VLAN 100.

    <DeviceC> system-view
    [DeviceC] vlan 100
    [DeviceC-vlan100] ip-subnet-vlan ip 192.168.5.0 255.255.255.0
    [DeviceC-vlan100] quit
    

    # Associate IP subnet 192.168.50.0/24 with VLAN 200.

    [DeviceC] vlan 200
    [DeviceC-vlan200] ip-subnet-vlan ip 192.168.50.0 255.255.255.0
    [DeviceC-vlan200] quit
    

    # Configure Ten-GigabitEthernet 1/0/11 as a hybrid port, and assign it to VLAN 100 as a tagged VLAN member.

    [DeviceC] interface ten-gigabitethernet 1/0/11
    [DeviceC-Ten-GigabitEthernet1/0/11] port link-type hybrid
    [DeviceC-Ten-GigabitEthernet1/0/11] port hybrid vlan 100 tagged
    [DeviceC-Ten-GigabitEthernet1/0/11] quit
    

    # Configure Ten-GigabitEthernet1/0/12 as a hybrid port, and assign it to VLAN 200 as a tagged VLAN member.

    [DeviceC] interface ten-gigabitethernet 1/0/12
    [DeviceC-Ten-GigabitEthernet1/0/12] port link-type hybrid
    [DeviceC-Ten-GigabitEthernet1/0/12] port hybrid vlan 200 tagged
    [DeviceC-Ten-GigabitEthernet1/0/12] quit
    

    # Configure Ten-GigabitEthernet 1/0/1 as a hybrid port, and assign it to VLANs 100 and 200 as an untagged VLAN member.

    [DeviceC] interface ten-gigabitethernet 1/0/1
    [DeviceC-Ten-GigabitEthernet1/0/1] port link-type hybrid
    [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged
    

    # Associate Ten-GigabitEthernet 1/0/1 with IP subnet-based VLANs 100 and 200.

    [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 100
    [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 200
    [DeviceC-Ten-GigabitEthernet1/0/1] quit
    
  2. Configure Device A and Device B to forward packets from VLANs 100 and 200, respectively. (Details not shown.)

Verifying the configuration

# Display information about all IP subnet-based VLANs.

[DeviceC] display ip-subnet-vlan vlan all
 VLAN ID: 100
  Subnet index      IP address      Subnet mask
  0                 192.168.5.0     255.255.255.0

 VLAN ID: 200
  Subnet index      IP address      Subnet mask
  0                 192.168.50.0    255.255.255.0

# Display IP subnet-based VLANs on Ten-GigabitEthernet 1/0/1.

[DeviceC] display ip-subnet-vlan interface ten-gigabitethernet 1/0/1
 Interface: Ten-GigabitEthernet1/0/1
  VLAN ID   Subnet index    IP address       Subnet mask       Status
  100       0               192.168.5.0      255.255.255.0     Active
  200       0               192.168.50.0     255.255.255.0     Active