L2 mode

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

In L2 mode NGRaff works as a transparent “wire” inserted into a link. Frames with any VLAN tag or untagged pass between ports unchanged. IP addressing, gateways, routes and VLANs in the network stay the same, and NGRaff is invisible to the network. Where traffic goes is set by FlexPath rules.

TransparencyAny VLANs and untagged frames, ARP, IPv6, STP, broadcast and multicast pass through unchanged.
FlexPathRules define what goes where: a whole port, individual VLANs, subnets or protocols.
ProtectionIPv4 traffic gets the same protection as in L3: ACL, blacklists, TCP, UDP and ICMP protection.

How it works

Router 1 Router 2 Protectednetwork NGRaff · L2 Protection and filteringIPv4: ACL, TCP, UDP, ICMP FlexPathport 0 | port 1 port 0 port 1 Any VLANs, ARP, IPv6, STP, broadcast and multicast pass unchanged NGRaff replies → uplink

A frame arriving on a port is looked up in the FlexPath rules. The rule port 0 | port 1 passes everything received on port 0 to port 1 unchanged, and the reverse rule port 1 | port 0 does the same in the other direction. On the way IPv4 traffic goes through protection and filtering; illegitimate traffic is dropped.

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.

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.

​
Symmetric scheme
Router 1uplink 1 Router 2uplink 2 Protectednetwork NGRaff · L2 port 0 port 1 All VLANs and untagged frames pass unchanged

The classic inline insertion: NGRaff sits between the router and the switch and passes everything between two ports.

Setup steps

LACP and LLDP frames are blocked by default.

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

  2. Rules. Write the following rules to flexpath.cfg in the NGRaff configuration directory:

    port 0 | port 1
    port 1 | port 0
  3. Apply. Reload the rules and make sure they loaded without errors:

    flexpath check flexpath.cfg
    flexpath reload
    flexpath status
    flexpath list
    
  4. Uplink. First create an interface for the uplink port and VLAN, then select it and set the upstream router MAC for NGRaff replies:

    interface add vlan trunk 0 100 vlan100 vlan100
    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    
  5. Verification. See which rule matches a frame and whether frames are dropped on the port:

    flexpath classify port 0 vlan 100 dst 192.0.2.10
    port stats 0
    
  6. Per-VLAN statistics. To collect detailed statistics, including GEO statistics, for a specific VLAN, create an interface with that VLAN:

    interface add vlan trunk 0 200 vlan200 vlan200
    
Symmetric scheme
Router 1uplink 1 Router 2uplink 2 Protectednetwork NGRaff · L2 port 0 · VLAN 100, 200 port 1 · VLAN 100, 200 Only VLANs from the rules pass, the rest are dropped

Only the listed VLANs pass through NGRaff. Frames of other VLANs and untagged frames match no rule and are dropped.

Setup steps

LACP and LLDP frames are blocked by default.

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

  2. Rules. Write the following rules to flexpath.cfg in the NGRaff configuration directory:

    port 0 vlan 100 | port 1
    port 1 vlan 100 | port 0
    port 0 vlan 200 | port 1
    port 1 vlan 200 | port 0
  3. Apply. Reload the rules and make sure they loaded without errors:

    flexpath check flexpath.cfg
    flexpath reload
    flexpath status
    flexpath list
    
  4. Uplink. First create an interface for the uplink port and VLAN, then select it and set the upstream router MAC for NGRaff replies:

    interface add vlan trunk 0 100 vlan100 vlan100
    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    
  5. Verification. See which rule matches a frame and whether frames are dropped on the port:

    flexpath classify port 0 vlan 100 dst 192.0.2.10
    port stats 0
    
  6. Per-VLAN statistics. To collect detailed statistics, including GEO statistics, for a specific VLAN, create an interface with that VLAN:

    interface add vlan trunk 0 200 vlan200 vlan200
    
Symmetric scheme
Router 1 Router 2 Uplinkswitch bond0 · port_id 3 port 0port 1 NGRaff · L2 port 2 Protectednetwork FlexPath: port 3 ↔ port 2

NGRaff ports 0 and 1 form a bond to the uplink switch, while port 2 connects to the protected network. The bond terminates on NGRaff and the switch; the protected side uses a separate physical port.

Setup steps

  1. Bond. Group ports 0 and 1 in the NGRaff startup configuration and configure LACP or active-backup consistently on the switch. Find the logical bond port ID:

    bond list
    port list
    

    In this example it is 3, after physical ports 0, 1 and 2. Rules use the logical bond ID rather than member port IDs.

  2. Rules. Save bidirectional forwarding between the bond and port 2 in flexpath.cfg:

    port 3 | port 2
    port 2 | port 3
  3. Apply. Check and reload the rules:

    flexpath check flexpath.cfg
    flexpath reload
    flexpath status
    
  4. Uplink. Create an interface on the logical bond port and set the upstream router MAC:

    interface add vlan trunk 3 100 vlan100 vlan100
    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    
  5. Verification.

    bond status
    flexpath classify port 3 vlan 100 dst 192.0.2.10
    port stats 3
    port stats 2
    
  6. Per-VLAN statistics. To collect detailed statistics, including GEO statistics, for a specific VLAN, create an interface with that VLAN:

    interface add vlan trunk 0 200 vlan200 vlan200
    
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 / LACP

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.

A bond is built between two switches: the upstream routers are behind one, the protected network behind the other. Each of its links goes through a separate NGRaff instance, so protection scales with the number of links.

  • For an LACP bond, configure explicit FlexPath rules to forward LACP and LLDP frames.
  • Both directions of a flow must go through the same instance, which requires consistent symmetric hashing on both switches.

Setup steps

Run these steps on every NGRaff instance.

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

  2. Rules. Write the following rules to flexpath.cfg in the NGRaff configuration directory:

    port 0 | port 1
    port 1 | port 0
    port 0 lacp | port 1
    port 1 lacp | port 0
    port 0 lldp | port 1
    port 1 lldp | port 0
  3. Apply. Reload the rules and make sure they loaded without errors:

    flexpath check flexpath.cfg
    flexpath reload
    flexpath status
    flexpath list
    
  4. Uplink. First create an interface for the uplink port and VLAN, then select it and set the upstream router MAC for NGRaff replies:

    interface add vlan trunk 0 100 vlan100 vlan100
    uplink interface vlan100 mac 02:00:00:00:00:11
    uplink
    
  5. Verification. See which rule matches a frame and whether frames are dropped on the port:

    flexpath classify port 0 vlan 100 dst 192.0.2.10
    port stats 0
    
  6. Per-VLAN statistics. To collect detailed statistics, including GEO statistics, for a specific VLAN, create an interface with that VLAN:

    interface add vlan trunk 0 200 vlan200 vlan200
    
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 FlexPath · frames forwarded unchanged

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 FlexPath rules to forward frames transparently.

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.