L3 mode
Enter the NGRaff commands below in the ngcli console. Run Linux commands in the Linux shell.
In L3 mode NGRaff is a router split into two parts. A DPDK data plane forwards packets, while a familiar Linux control plane builds routes. Routing protocols and ARP run in Linux; filtering and forwarding run in NGRaff.
How it works
Every NGRaff L3 interface has a matching virtual interface in Linux. To Linux these are ordinary network interfaces: IP addresses are assigned to them and BGP and OSPF sessions run over them.
- Transit traffic (blue arrows) never reaches Linux: NGRaff checks the packet, looks up the route in its FIB and sends it to the egress port.
- Traffic to the router itself (orange arrows) — broadcast, multicast, ARP, all IP traffic for the router (including BGP, OSPF) — is passed by NGRaff to the matching Linux virtual interface. It is filtered first, so the control plane is protected from attacks.
- Manul (dashed) watches the Linux network stack and immediately passes every change to NGRaff.
Packet path
- A packet arrives on an NGRaff port.
- It goes through protection and filtering: ACL, blacklists, TCP, UDP and ICMP protection. Illegitimate traffic is dropped right here.
- If the packet is addressed to the router itself, it goes to Linux — to FRR, BIRD or the network stack.
- Otherwise NGRaff looks up the route in the FIB and the next hop MAC in ARP, and sends the packet to the egress port.
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.
Addresses and VLAN numbers in the diagrams are examples. Check port numbers with port list.
The simplest option: external and internal networks are connected to separate physical ports. NGRaff becomes the gateway of the protected network, and the upstream routers route to it via NGRaff. Each router is connected through its own uplink: VLAN 100 and VLAN 101 on port 0.
Setup steps
-
Ports and bonds. Make sure NGRaff sees the required ports:
port list,bond list. -
L3 interfaces. Add interfaces with the commands of the chosen option. Matching virtual interfaces appear in Linux.
interface add vlan trunk 0 100 uplink100 interface add vlan trunk 0 101 uplink101 interface add vlan trunk 1 200 lan200 -
Addresses. Assign IP addresses to the virtual interfaces in Linux. The most convenient way is interface scripts: after creating an interface NGRaff runs
ifup.<name>.sh, and before removing itifdown.<name>.sh, from the configuration directory. The script gets one argument: the interface name. Scripts are called when NGRaff starts. A script has 30 seconds to complete. -
Routing. Configure FRR or BIRD: BGP with the upstream routers, static routes or OSPF.
-
Synchronization. Start Manul and check its connection to NGRaff:
vrf status. -
Verification. See where NGRaff will send a packet and whether the next hop has an ARP entry:
interface list fib 192.0.2.10 arp table
NGRaff is connected to the switch with a single port; external and internal networks are separated by VLAN. A packet arrives in one VLAN, is routed and leaves through the same port in another. The switch port towards NGRaff must carry both VLANs.
Setup steps
-
Ports and bonds. Make sure NGRaff sees the required ports:
port list,bond list. -
L3 interfaces. Add interfaces with the commands of the chosen option. Matching virtual interfaces appear in Linux.
interface add vlan trunk 0 100 uplink100 interface add vlan trunk 0 101 uplink101 interface add vlan trunk 0 200 lan200 -
Addresses. Assign IP addresses to the virtual interfaces in Linux. The most convenient way is interface scripts: after creating an interface NGRaff runs
ifup.<name>.sh, and before removing itifdown.<name>.sh, from the configuration directory. The script gets one argument: the interface name. Scripts are called when NGRaff starts. A script has 30 seconds to complete. -
Routing. Configure FRR or BIRD: BGP with the upstream routers, static routes or OSPF.
-
Synchronization. Start Manul and check its connection to NGRaff:
vrf status. -
Verification. See where NGRaff will send a packet and whether the next hop has an ARP entry:
interface list fib 192.0.2.10 arp table
Several physical ports are combined into one logical bond with LACP or active-backup, giving both more bandwidth and link redundancy. The bond is created in the startup configuration. Commands use the bond number from bond list — 2 in this example — not the numbers of its member ports.
Setup steps
-
Ports and bonds. Make sure NGRaff sees the required ports:
port list,bond list.bond list -
L3 interfaces. Add interfaces with the commands of the chosen option. Matching virtual interfaces appear in Linux.
interface add vlan trunk 2 100 uplink100 interface add vlan trunk 2 101 uplink101 interface add vlan trunk 2 200 lan200 -
Addresses. Assign IP addresses to the virtual interfaces in Linux. The most convenient way is interface scripts: after creating an interface NGRaff runs
ifup.<name>.sh, and before removing itifdown.<name>.sh, from the configuration directory. The script gets one argument: the interface name. Scripts are called when NGRaff starts. A script has 30 seconds to complete. -
Routing. Configure FRR or BIRD: BGP with the upstream routers, static routes or OSPF.
-
Synchronization. Start Manul and check its connection to NGRaff:
vrf status. -
Verification. See where NGRaff will send a packet and whether the next hop has an ARP entry:
interface list fib 192.0.2.10 arp table
Two NGRaff nodes are connected to the same segments: two uplinks — VLAN 100 to router 1 and VLAN 101 to router 2 — and internal VLAN 200. Virtual MAC addresses are grouped with priorities, and a group’s traffic flows through the node that owns it.
- Normal operation: NGRaff A owns the group, NGRaff B keeps it on standby.
- A fails: NGRaff B stops receiving its heartbeat, takes over the group, and traffic flows through B.
The built-in multicast heartbeat runs over multiple interfaces: a node is considered alive while messages arrive on at least one of them. It is better to dedicate a separate VLAN to the link between nodes (VLAN 900 in the example) and not to use uplinks for heartbeat. The quorum sets the minimum number of alive nodes, including the node itself. On quorum loss a node releases its groups and does not take over others automatically. There can be several groups, each with its own owner by priority, so load can be spread across nodes.
Example for a pair of nodes. First set the shared pair key in config.ini: it signs heartbeat frames, must be the same on both nodes and is read when NGRaff starts. Without the key heartbeat does not work.
Setup steps
Commands are the same on both nodes except the group priority: the node with the higher priority takes the group; the default is 100.
The following commands are available in the ngcli console:
# Interfaces: two uplinks, the internal network and a dedicated VLAN for node links
interface add vlan trunk 0 100 uplink100
interface add vlan trunk 0 101 uplink101
interface add vlan trunk 1 200 lan200
interface add vlan trunk 1 900 hb900
# Heartbeat: dedicated VLAN 900 and the internal network, uplinks are not used
cluster interface add hb900
cluster interface add lan200
cluster timeout 500 # ms of silence after which a neighbour is dead
cluster quorum 1 # how many alive nodes are needed, counting itself
# Virtual MACs of group 1 on both uplinks and in the internal network
vmac add uplink100 02:00:00:00:01:00 group 1
vmac add uplink101 02:00:00:00:01:01 group 1
vmac add lan200 02:00:00:00:02:00 group 1
vmac group 1 priority 200 # on NGRaff A; keep 100 on NGRaff B
vmac auto on # take over and release groups automatically
# Verification
cluster
vmacFor a pair of two nodes use quorum 1: otherwise, when the neighbour fails, the remaining node loses quorum and does not take over the group.
Three NGRaff nodes work at the same time and back each other up. Virtual MACs are split into three groups, each with its own owner: NGRaff A owns group 1, NGRaff B group 2, NGRaff C group 3. Each group has its own uplink: group 1 is VLAN 100, group 2 VLAN 101, group 3 VLAN 102. Every node is connected to all uplinks, and an uplink’s traffic is received by whichever node currently owns its group. In normal operation the load is shared between the nodes.
- Normal operation: each node serves its own group and its own uplink.
- A fails: the neighbours stop receiving its heartbeat, and group 1 is taken over by the node with the next highest priority — NGRaff B in this example. Traffic of uplinks 1 and 2 goes through B.
This is an asymmetric scheme: a request can come through one node and the reply leave through another. TCP, UDP and ICMP protection is not supported in it yet.
A vMAC is set on an interface, so every node gets an interface in each uplink, and a group’s vMAC goes on the interface of its uplink. A group’s uplink must be connected to all nodes that can take the group over, otherwise the node that takes it will not see its traffic. Groups can also share one VLAN: then each group has its own address in that VLAN.
The key is set in config.ini and must be the same on all three nodes. It signs heartbeat frames and is read when NGRaff starts; without the key heartbeat does not work.
Setup steps
Heartbeat and vMAC groups are configured the same way on all nodes. Quorum 2: a node cut off from the others does not take over other nodes’ groups.
# Interfaces: three uplinks, the internal network and a dedicated VLAN for node links
interface add vlan trunk 0 100 uplink100
interface add vlan trunk 0 101 uplink101
interface add vlan trunk 0 102 uplink102
interface add vlan trunk 1 200 lan200
interface add vlan trunk 1 900 hb900
# Heartbeat: dedicated VLAN 900 and the internal network, uplinks are not used
cluster interface add hb900
cluster interface add lan200
cluster quorum 2
# vMAC groups: one per uplink
vmac add uplink100 02:00:00:00:01:01 198.51.100.2 group 1
vmac add uplink101 02:00:00:00:01:02 198.51.101.2 group 2
vmac add uplink102 02:00:00:00:01:03 198.51.102.2 group 3
vmac add lan200 02:00:00:00:02:01 192.0.2.1 group 1
vmac add lan200 02:00:00:00:02:02 192.0.2.2 group 2
vmac add lan200 02:00:00:00:02:03 192.0.2.3 group 3
vmac auto onOnly the priorities differ. They define who owns a group and who takes it over when the owner fails; the default priority is 100.
| Group | NGRaff A | NGRaff B | NGRaff C |
|---|---|---|---|
| 1 | 200 | 150 | 100 |
| 2 | 100 | 200 | 150 |
| 3 | 150 | 100 | 200 |
# NGRaff A
vmac group 1 priority 200
vmac group 3 priority 150
# NGRaff B
vmac group 2 priority 200
vmac group 1 priority 150
# NGRaff C
vmac group 3 priority 200
vmac group 2 priority 150Several NGRaff nodes are connected to one Arista switch and process traffic together. The control plane runs on a separate Linux server. The switch diverts transit IP traffic to the NGRaff instances, and IP traffic for the router plus all other traffic (broadcast, multicast, ARP) to the control plane server. Manul sends routes and ARP entries over the network to all nodes at once. How traffic is spread across nodes is set in the switch configuration.
A keepalive daemon in the Arista switch control plane checks every node. If a node hangs or is taken down for an upgrade, the switch stops sending traffic to it and the remaining nodes keep working.
Detailed cluster configuration is outside the scope of this article.
Two separate Linux machines run their own BGP sessions. Manul on the first one sends routes to VRF 1 on all NGRaff nodes, Manul on the second one to VRF 2 on the same nodes. All cluster nodes process traffic, while the routing tables of different VRFs stay isolated.
Detailed cluster configuration is outside the scope of this article.
Two upstream routers, each with its own NGRaff node. A request can come through router 1 and NGRaff A while the reply leaves through NGRaff B and router 2: each node sees only one direction of the connection.
This is an asymmetric scheme. Routing works in it, but TCP, UDP and ICMP protection is not supported yet. For protection to work, both directions of a connection must pass through one node, for example with vMAC redundancy.
Interfaces on each node:
Setup steps
-
Ports and bonds. Make sure NGRaff sees the required ports:
port list,bond list. -
L3 interfaces. Add interfaces with the commands of the chosen option. Matching virtual interfaces appear in Linux.
interface add vlan trunk 0 100 uplink100 interface add vlan trunk 0 101 uplink101 interface add vlan trunk 1 200 lan200 -
Addresses. Assign IP addresses to the virtual interfaces in Linux. The most convenient way is interface scripts: after creating an interface NGRaff runs
ifup.<name>.sh, and before removing itifdown.<name>.sh, from the configuration directory. The script gets one argument: the interface name. Scripts are called when NGRaff starts. A script has 30 seconds to complete. -
Routing. Configure FRR or BIRD: BGP with the upstream routers, static routes or OSPF.
-
Synchronization. Start Manul and check its connection to NGRaff:
vrf status. -
Verification. See where NGRaff will send a packet and whether the next hop has an ARP entry:
interface list fib 192.0.2.10 arp table