CX320 Switch Module V100R001 Configuration Guide 15

Configuring a Sub-interface

Configuring a Sub-interface

A sub-interface is a virtual interface configured on a physical interface to allow users belong to different VLANs to communicate with each other.

Configuring an Ethernet Sub-interface

Context

Users belong to different VLANs and are located on different network segments can communicate with each other by configuring sub-interfaces.

As shown in Figure 5-11, PC1 and PC2 belong to VLAN 10 and VLAN 20 respectively and they are located on the different network segments. PC1 and PC2 connect to the Layer 3 device Switch ModuleB through the Layer 2 device Switch ModuleA. If only one IP address is configured for 10GE1/17/4 on Switch ModuleB, PC1 and PC2 cannot communicate across VLANs. Although you can configure a secondary IP address to solve this problem, the secondary IP address becomes invalid after the primary IP address becomes invalid.

In this case, you can configure sub-interfaces on 10GE1/17/4. A sub-interface is independent from a main interface. Although a sub-interface uses the same physical parameters as the main interface, the IP address of the sub-interface is not affected by the change of the main interface IP address. For example, you can create two sub-interfaces 10GE1/17/4.10 and 10GE1/17/4.20 and specify IP addresses 10.10.10.10/24 and 10.20.20.20/24 for them. The two IP addresses server as the gateway addresses for users in VLAN 10 and VLAN 20 respectively. In this way, PC1 and PC2 on different network segments can communicate across VLANs.
Figure 5-11 Configuring an Ethernet sub-interface

Pre-configuration Tasks

Before configuring an Ethernet sub-interface, complete the following tasks:

  • Correctly connecting the physical interface of the sub-interface

  • Configuring a Layer 3 main interface

Procedure

  1. Run:

    system-view

    The system view is displayed.

  2. Run:

    interface interface-type interface-number.subinterface-number

    The Ethernet sub-interface view is displayed.

    subinterface-number specifies the number of a sub-interface after the Ethernet interface is switched to Layer 3 mode.

    The number of a sub-interface ranges from 1 to 4094. Currently, the device supports a maximum of 2000 sub-interfaces.

  3. Run:

    ip address ip-address { mask | mask-length } [ sub ]

    The IP address of the Ethernet sub-interface is configured.

    Specify the sub parameter when you need to configure a secondary IP address for the Ethernet sub-interface.

  4. Run:

    dot1q termination vid vid

    The sub-interface is configured to terminate single-tagged packets.

  5. Run:

    commit

    The configuration is committed.

Checking the Configuration

Run the display interface [ interface-type [ interface-number [.subnumber ] ] ] command to check the status of the specified Ethernet sub-interface.

Configuring an Eth-Trunk Sub-interface

Context

Sub-interfaces can be configured on a Layer 3 Eth-Trunk. When Layer 3 devices connect to Layer 2 devices in different VLANs through the Layer 3 Eth-Trunk, sub-interfaces must be configured on the Eth-Trunk to identify packets from different VLANs and to enable users in different VLANs to communicate with each other.

Procedure

  1. Run:

    system-view

    The system view is displayed.

  2. Run:

    interface eth-trunk trunk-id

    An Eth-Trunk is created and the Eth-Trunk interface view is displayed.

  3. Run:

    undo portswitch

    A Layer 3 Eth-Trunk is configured.

  4. Run:

    quit

    The system view is displayed.

  5. Run:

    interface eth-trunk trunk-id.subnumber

    An Eth-Trunk sub-interface is created.

    subnumber specifies the number of a sub-interface. The value ranges from 1 to 4094.

  6. Run:

    ip address ip-address { mask | mask-length } [ sub ]

    An IP address is configured for the sub-interface.

    When configuring multiple IP addresses for an Eth-Trunk sub-interface, use the sub keyword to indicate the IP addresses configured after the first one.

  7. Run:

    dot1q termination vid vid

    The Eth-trunk sub-interface is configured to terminate single-tagged packets.

  8. Run:

    commit

    The configuration is committed.

Translation
Favorite
Download
Update Date:2025-08-30
Document ID:EDOC1000128406
Views:2726393
Downloads:4188
Average rating:4.5Points

Digital Signature File

digtal sigature tool