L2 VLAN retag mode

Enter the NGRaff commands below in the ngcli console. Run Linux commands in the Linux shell.

In L2 VLAN retag mode NGRaff is inserted into a link and replaces the outer VLAN tag when passing a frame. It does not route traffic and does not change IP addressing, gateways or routes in the network. Frames are passed between “port + VLAN” pairs only by configured 1:1 bindings; everything else is dropped.

TransparencyAddresses, gateways and routes in the network stay the same. ARP, IPv6, STP, broadcast and multicast pass through.
RetaggingOnly the outer VLAN tag changes: it is removed, added or replaced. Inner tags, TPID and PCP are kept.
ProtectionTraffic gets the same protection as in L3: ACL, blacklists, TCP, UDP and ICMP protection.

How it works

Router 1 Router 2 Protectednetwork NGRaff · L2 vlan100/101interface ProtectionACL, TCP, UDP, ICMP VLAN retag100→200, 101→201 port 0 port 1VLAN 200, 201 NGRaff replies → uplink traffic through NGRaff NGRaff own replies

An NGRaff interface in L2 VLAN retag mode is a “port + outer VLAN” pair. The interface binding defines which port and outer VLAN a frame is sent to. With the bidirectional flag one binding works both ways.

  • Traffic through NGRaff (blue arrows) goes through protection and filtering, then leaves by the binding with the new outer VLAN.
  • NGRaff’s own replies (purple arrows), such as TCP protection SYN cookies, follow the FIB route, and if there is none — the uplink: the port and VLAN of a given interface towards the upstream router MAC. Replies towards the protected network go back to the port and VLAN of the request.

Frame path

Port+ outer VLAN binding? yes Protectionand filtering Outer VLANretag Egressport + VLAN no Dropped illegitimatetraffic Dropped
  1. A frame arrives on a port. NGRaff finds the interface by port and outer VLAN.
  2. If there is no interface or binding, the frame is dropped right away, before protection.
  3. The frame goes through protection and filtering. Illegitimate traffic is dropped right here.
  4. NGRaff replaces the outer VLAN and sends the frame to the port from the binding.

FlexPath rules for LACP and LLDP forwarding are needed when a bond passes through multiple NGRaff instances; they are shown in the corresponding tab.

Connection options

A connection scheme can be symmetric or asymmetric. In a symmetric scheme both directions of a connection — request and reply — pass through the same NGRaff node. In an asymmetric one they go through different nodes. Currently TCP, UDP and ICMP protection works only in a symmetric scheme: it needs to see both directions of a connection. The type of each scheme is shown above it.

VLAN numbers in the diagrams are examples. The last interface add parameter is the interface name in Linux.

​
Symmetric scheme
Router 1uplink 1 Router 2uplink 2 Protectednetwork NGRaff · L2 port 0 · VLAN 100, 101 port 1 · VLAN 200, 201 Outer VLANs 100 ↔ 200 and 101 ↔ 201 are swapped by NGRaff

The same inline insertion, but the link sides use different VLANs: a frame from VLAN 100 on port 0 leaves port 1 in VLAN 200, from VLAN 101 in VLAN 201, and back. Each uplink has its own VLAN pair.

Setup steps

  1. Ports. Make sure NGRaff sees the required ports: port list.

  2. Interfaces. Add an interface for the source port/VLAN pair: interface add vlan trunk <port> <VLAN> <name> <Linux name>. For untagged frames use interface add vlan access <port> <name> <Linux name>.

    interface add vlan trunk 0 100 vlan100 vlan100
    interface add vlan trunk 0 101 vlan101 vlan101
    
  3. Bindings. Specify the egress port and new VLAN: interface set retag <name> <egress port> <new VLAN> bidirectional. VLAN 0 means sending untagged. With bidirectional, the reverse port/VLAN pair is defined by the same binding and needs no separate interface. Without that flag, the reverse side needs a separate interface with its own binding.

    interface set retag vlan100 1 200 bidirectional
    interface set retag vlan101 1 201 bidirectional
    
  4. Uplink. Set where NGRaff’s own replies go when there is no route to the destination: the port and VLAN of an interface and the upstream router MAC.

    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    

    With the out flag the uplink uses the opposite side of a bidirectional binding: uplink interface vlan100 out mac ….

  5. Verification. Make sure the binding is set (the Retag line) and there are no drops for ports and VLANs without an interface:

    interface list vlan100
    port stats 0
    
Symmetric scheme
Router 1uplink 1 Router 2uplink 2 Protectednetwork Switch VLAN 100, 101 VLAN 200, 201 NGRaff · L2 port 0 · trunk100 ↔ 200, 101 ↔ 201

NGRaff is connected to the switch with one trunk port. The routers and the protected network are in different VLANs, and the only path between them goes through NGRaff: a frame arrives in VLAN 100 or 101 and returns through the same port in VLAN 200 or 201.

Setup steps

  1. Ports. Make sure NGRaff sees the required ports: port list.

  2. Interfaces. Add an interface for the source port/VLAN pair: interface add vlan trunk <port> <VLAN> <name> <Linux name>. For untagged frames use interface add vlan access <port> <name> <Linux name>.

    interface add vlan trunk 0 100 vlan100 vlan100
    interface add vlan trunk 0 101 vlan101 vlan101
    
  3. Bindings. Specify the egress port and new VLAN: interface set retag <name> <egress port> <new VLAN> bidirectional. VLAN 0 means sending untagged. With bidirectional, the reverse port/VLAN pair is defined by the same binding and needs no separate interface. Without that flag, the reverse side needs a separate interface with its own binding.

    interface set retag vlan100 0 200 bidirectional
    interface set retag vlan101 0 201 bidirectional
    
  4. Uplink. Set where NGRaff’s own replies go when there is no route to the destination: the port and VLAN of an interface and the upstream router MAC.

    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    

    With the out flag the uplink uses the opposite side of a bidirectional binding: uplink interface vlan100 out mac ….

  5. Verification. Make sure the binding is set (the Retag line) and there are no drops for ports and VLANs without an interface:

    interface list vlan100
    port stats 0
    
Symmetric scheme
Router 1uplink 1 Router 2uplink 2 Protectednetwork Switch VLAN 100, 101 VLAN 200, 201 NGRaff · L2 port 0port 1 bond0 · port_id 2 · LACP 100 ↔ 200, 101 ↔ 201

NGRaff connects to the switch through a bond of multiple physical ports. VLANs 100 and 101 arrive on the logical bond port and, after filtering, return through the same bond in VLANs 200 and 201.

Create the bond in the startup configuration first and configure aggregation consistently on the switch. In this example it is 2; use the ID shown by bond list, rather than physical member IDs.

Setup steps

  1. Ports. Make sure NGRaff sees the required ports: port list, bond list.

  2. Interfaces. Add an interface for the source port/VLAN pair: interface add vlan trunk <port> <VLAN> <name> <Linux name>. For untagged frames use interface add vlan access <port> <name> <Linux name>.

    interface add vlan trunk 2 100 vlan100 vlan100
    interface add vlan trunk 2 101 vlan101 vlan101
    
  3. Bindings. Specify the egress port and new VLAN: interface set retag <name> <egress port> <new VLAN> bidirectional. VLAN 0 means sending untagged. With bidirectional, the reverse port/VLAN pair is defined by the same binding and needs no separate interface. Without that flag, the reverse side needs a separate interface with its own binding.

    interface set retag vlan100 2 200 bidirectional
    interface set retag vlan101 2 201 bidirectional
    
  4. Uplink. Set where NGRaff’s own replies go when there is no route to the destination: the port and VLAN of an interface and the upstream router MAC.

    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    

    With the out flag the uplink uses the opposite side of a bidirectional binding: uplink interface vlan100 out mac ….

  5. Verification. Make sure the binding is set (the Retag line) and there are no drops for ports and VLANs without an interface:

    interface list vlan100
    port stats 2
    
Symmetric only with symmetric bond hashing
Router 1uplink 1 Router 2uplink 2 Switchbond Switchbond NGRaff · L2 Ainstance 1 NGRaff · L2 Binstance 2 link 1link 2 Bond · VLAN retag port 1 · VLAN 200, 201 port 1 · VLAN 200, 201 port 0 · VLAN 100, 101 port 0 · VLAN 100, 101

This scheme is symmetric only with symmetric bond hashing: both directions of a flow must reach the same NGRaff instance. Bonding the links alone does not guarantee this.

The bond is established between two switches. Each physical member link passes through a separate NGRaff instance in L2 VLAN retag mode: VLANs 100/101 on port 0 are rewritten to 200/201 on port 1, and vice versa. Traffic is distributed across instances. Protection requires both directions of a flow to pass through the same instance, so configure consistent symmetric hashing on the switches.

Setup steps

Run these steps on every NGRaff instance.

  1. Ports. Make sure NGRaff sees the required ports: port list.

  2. Interfaces. Add an interface for the source port/VLAN pair: interface add vlan trunk <port> <VLAN> <name> <Linux name>. For untagged frames use interface add vlan access <port> <name> <Linux name>.

    interface add vlan trunk 0 100 vlan100 vlan100
    interface add vlan trunk 0 101 vlan101 vlan101
    
  3. Bindings. Specify the egress port and new VLAN: interface set retag <name> <egress port> <new VLAN> bidirectional. VLAN 0 means sending untagged. With bidirectional, the reverse port/VLAN pair is defined by the same binding and needs no separate interface. Without that flag, the reverse side needs a separate interface with its own binding.

    interface set retag vlan100 1 200 bidirectional
    interface set retag vlan101 1 201 bidirectional
    
  4. LACP and LLDP. On every instance, add bidirectional forwarding rules for control frames between the switches to flexpath.cfg:

    port 0 lacp | port 1
    port 1 lacp | port 0
    port 0 lldp | port 1
    port 1 lldp | port 0

    Check and apply the rules:

    flexpath check flexpath.cfg
    flexpath reload
    flexpath status
    
  5. Uplink. Set where NGRaff’s own replies go when there is no route to the destination: the port and VLAN of an interface and the upstream router MAC.

    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    

    With the out flag the uplink uses the opposite side of a bidirectional binding: uplink interface vlan100 out mac ….

  6. Verification. Make sure the binding is set (the Retag line) and there are no drops for ports and VLANs without an interface:

    interface list vlan100
    port stats 0
    
Symmetric with consistent flow distribution
Router 1uplink 1 Router 2uplink 2 Arista switchkeepalive daemon Protectednetwork NGRaff · L2node 1 NGRaff · L2node 2 NGRaff · L2node 3 keepalive VLAN 100 ↔ 200, 101 ↔ 201

Multiple NGRaff instances connect to one Arista switch and share traffic processing. The switch distributes flows across nodes; both directions of a flow must reach the same instance for TCP, UDP and ICMP protection to work.

Nodes use matching retag bindings: outer VLANs 100/101 are rewritten to 200/201 and vice versa.

A daemon in the switch control plane checks node availability by sending keepalive packets. During an instance failure or upgrade, traffic is redirected to the remaining nodes.

Detailed cluster configuration is outside the scope of this article.