rewrite map

Function

The rewrite map command sets a traffic behavior to "map" for packets that an EVC Layer 2 sub-interface receives.

The undo rewrite command deletes a traffic behavior configured on an EVC Layer 2 sub-interface.

By default, no traffic behavior is configured on an EVC Layer 2 sub-interface. The EVC Layer 2 sub-interface transparently forwards all received packets without processing them.

Format

rewrite map offset { increase | decrease } offset-vid

rewrite map { 1-to-1 | 2-to-1 } vid pe-vid

rewrite map { 1-to-1 | 2-to-1 } vid pe-vid 8021p pe-8021p-value

rewrite map { 1-to-2 | 2-to-2 } vid pe-vid ce-vid ce-vid

rewrite map { 1-to-2 | 2-to-2 } vid pe-vid [ 8021p pe-8021p-value ] ce-vid ce-vid ce-8021p ce-8021p-value

rewrite map { 1-to-2 | 2-to-2 } vid pe-vid 8021p pe-8021p-value ce-vid ce-vid [ ce-8021p ce-8021p-value ]

rewrite map single outbound

undo rewrite

undo rewrite map single outbound

Parameters

Parameter Description Value
increase

Enables an EVC Layer 2 sub-interface to increase a tag value in each received packet by valoffset.

-

decrease

Enables an EVC Layer 2 sub-interface to decrease a tag value in each received packet by valoffset.

-

offset-vid

Specifies the offset value.

The value is an integer ranging from 1 to 4093.

1-to-1

Configures 1 to 1 VLAN mapping to enable an EVC Layer 2 sub-interface to map a single tag in each received single-tagged packet or an outer tag in each received double-tagged packet to a specified tag.

For example, an EVC Layer 2 sub-interface with 1 to 1 VLAN mapping configured receives double-tagged packets. The sub-interface maps the outer tag to a specified VLAN tag and the inner tag remains.

-

2-to-1

Configures 2 to 1 VLAN mapping to enable an EVC Layer 2 sub-interface to map two tags in each received packet to a specified tag.

This parameter can be configured only after QinQ encapsulation is enabled using the encapsulation qinq vid pe-vid ce-vid { low-ce-vid [ to high-ce-vid ] | default } command on a specific EVC Layer 2 sub-interface.

-

vid pe-vid

Specifies the VLAN ID in the single tag to which a single tag or double tags in each received packet are mapped when 1 to 1 or 2 to 1 VLAN tag mapping is used.

The value is an integer ranging from 1 to 4094.

8021p pe-8021p-value

Specifies an 802.1p value for packets after a single tag or double tags in each received packet are mapped to a single tag.

802.1p is represented by a 3-bit PRI (priority) field in an 802.1q frame. If traffic is congested on a device, the device forwards frames in descending order by priority values.

The value is an integer ranging from 0 to 7.

1-to-2

Configures 1 to 2 VLAN mapping to enable an EVC Layer 2 sub-interface to map a single tag in each received single-tagged packet or an outer tag in each received double-tagged packet to the specified two tags.

-

2-to-2

Configures 2 to 2 VLAN mapping to enable an EVC Layer 2 sub-interface to map two tags in each received packet to the specified two tags.

This parameter can be configured only after QinQ encapsulation is enabled using the encapsulation qinq vid pe-vid ce-vid { low-ce-vid [ to high-ce-vid ] | default } command on a specific EVC Layer 2 sub-interface.

-

ce-vid ce-vid

Specifies the VLAN ID in the inner tag after a single tag or double tags in each received packet are mapped to two tags when 1 to 2 or 2 to 2 VLAN tag mapping is used.

The value is an integer ranging from 1 to 4094.

ce-8021p ce-8021p-value

Specifies an 802.1p value for packets after a single tag or double tags in each received packet are mapped to two tags when 1 to 2 or 2 to 2 VLAN tag mapping is used.

The value is an integer ranging from 0 to 7.

single

Specifies VLAN transparent transmission as the inbound direction of an EVC Layer 2 sub-interface on a PE. In the outbound direction of the PE, the VLAN ID of packets is mapped to the VLAN ID associated with the traffic encapsulation type on the EVC Layer 2 sub-interface. The mapping is as follows:

  • An EVC Layer 2 sub-interface discards outgoing untagged packets.
  • Replaces the outer VLAN tag of outgoing packets with the configured VLAN tag of the EVC Layer 2 sub-interface.
  • Replaces the outer VLAN tag of outgoing packets with the VLAN tag of the configured EVC Layer 2 sub-interface if the packets carry double VLAN tags.

-

offset

Configures VLAN tag mapping based on a specified offset for an EVC Layer 2 sub-interface.

-

Views

400GE Layer 2 sub-interface view, 50GE Layer 2 sub-interface view, Eth-Trunk Layer 2 sub-interface view, GE Layer 2 sub-interface view, Global-VE layer2 subinterface view, VE layer2 subinterface view, Layer 2 sub-interface view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
ethernet write

Usage Guidelines

Usage Scenario

A network needs to be expanded with the growth of access users and data services, which poses the following challenges to the administrator:

  • Existing and new sites assigned different VLAN IDs need to communicate.
  • Inconsistent VLAN plans among sites access the public network causes VLAN ID conflicts. Therefore, VLANs at a site need to be isolated with those at another site.
  • VLAN IDs on both ends of public network connection are asymmetric.

    To face these challenges, run the rewrite map command on devices on the public network edge to map VLAN tags in access packets to public network VLAN tags. The traffic mapping behavior isolates VLAN tags in various VLANs and implements inter-VLAN communication.

Prerequisites

  • An EVC Layer 2 sub-interface has been created using the interface interface-type interface-number.subnum mode l2 command in the system view.
  • The EVC Layer 2 sub-interface is not added to a bridge domain. If the EVC Layer 2 sub-interface has been added to a bridge domain, run the undo bridge-domain bd-id command to remove the EVC Layer 2 sub-interface from the bridge domain.

Precautions

A maximum of one traffic behavior can be specified on each EVC Layer 2 sub-interface. If a traffic behavior has been configured on an EVC Layer 2 sub-interface, perform the following operations on the EVC Layer 2 sub-interface to change the traffic behavior:

  • When the undo bridge-domain command is run to exit from a BD and a sub-interface is bound to the BD, the traffic behavior cannot be modified.
  • Run the undo rewrite command to delete the original traffic behavior and configure a new traffic behavior, or configure a new traffic behavior to overwrite the original one.

Example

# Configure GE 0/1/1.2 to perform 1 to 2 VLAN tag mapping after receiving packets.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/1.2 mode l2
[*HUAWEI-GigabitEthernet0/1/1.2] rewrite map 1-to-2 vid 20 ce-vid 100 ce-8021p 4
# Configure GE 0/1/1.5 to perform offset-based VLAN tag mapping after receiving packets.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/1.5 mode l2
[*HUAWEI-GigabitEthernet0/1/1.5] rewrite map offset increase 10
# Configure GE 0/1/1.4 to perform 2 to 2 VLAN tag mapping after receiving packets.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/1.4 mode l2
[*HUAWEI-GigabitEthernet0/1/1.4] rewrite map 2-to-2 vid 30 8021p 3 ce-vid 300 ce-8021p 4
# Configure GE 0/1/1.1 to perform 1 to 1 VLAN tag mapping after receiving packets
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/1.1 mode l2
[*HUAWEI-GigabitEthernet0/1/1.1] rewrite map 1-to-1 vid 10 8021p 4
# Configure GE 0/1/1.3 to perform 2 to 1 VLAN tag mapping after receiving packets.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/1.3 mode l2
[*HUAWEI-GigabitEthernet0/1/1.3] rewrite map 2-to-1 vid 10 8021p 2
# Configure the EVC Layer 2 sub-interface GE 0/1/1.3 to replace the VLAN tag in outgoing packets with the configured VLAN tag.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/1.3 mode l2
[*HUAWEI-GigabitEthernet0/1/1.3] rewrite map single outbound
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >