Interfaces
NGRaff interfaces associate a physical port or bond with a logical name and VLAN. NGRaff port numbers and Linux network device names are separate parameters.
Before configuring
Open the ngcli console and inspect available ports with port list.
Port 0 and VLAN IDs 100, 200, and 300 below are examples. Replace them with your values. For a bond, use its port number from port list. See Bonding for port aggregation.
Creating interfaces
Enter these commands in the ngcli console for an L3 build. They do not take a separate Linux interface name.
| Command | Description |
|---|---|
interface add vlan access <PORT> <NAME> |
Create an Access interface for untagged traffic. |
interface add vlan trunk <PORT> <VLAN> <NAME> |
Create an interface for one 802.1Q VLAN. |
interface add vlan trunk 8021ad <PORT> <OUTER_VLAN> <NAME> |
Create a parent interface with an outer 802.1ad tag (0x88a8). |
interface add vlan trunk qinq <PARENT> <INNER_VLAN> <NAME> |
Create a QinQ interface with an inner VLAN on an existing 802.1ad parent. |
interface add vlan trunk double <PARENT> <INNER_VLAN> <NAME> |
Create an interface with two 802.1Q tags on an existing Trunk parent. |
interface list |
Show interfaces, status and current traffic rates. |
interface info <NAME> |
Show interface parameters. |
interface stats <NAME> |
Show packet processing and drop counters for the selected interface. |
<PORT> is the NGRaff or bond port number; <NAME> is the interface name; <VLAN> is the VLAN ID; <PARENT> is the parent interface name; <OUTER_VLAN> and <INNER_VLAN> are the outer and inner VLAN IDs. Do not type the angle brackets.
Access: untagged traffic
interface add vlan access 0 uplinkCreates uplink for untagged traffic on port 0.
Trunk: a single VLAN
interface add vlan trunk 0 100 vlan100Creates vlan100 for VLAN 100 on port 0. Create a separate named interface for each additional VLAN.
QinQ: outer 802.1ad and inner 802.1Q
Create the parent interface first, then the child:
interface add vlan trunk 8021ad 0 200 provider200
interface add vlan trunk qinq provider200 100 customer100The customer100 interface uses outer VLAN 200 (EtherType 0x88a8) and inner VLAN 100 (EtherType 0x8100). The second command references the parent by name.
Double VLAN: two 802.1Q tags
interface add vlan trunk 0 300 outer300
interface add vlan trunk double outer300 100 double100The double100 interface uses outer VLAN 300 and inner VLAN 100, both with EtherType 0x8100.
Example parameter output for the created VLAN interface:
interface info vlan100
Interface Name: vlan100
Status: active
Kernel interface Name: vlan100
Kernel interface ID: 12
Type: TRUNK VLAN 100
Port: 0
TTL action: no ip unreachable
Routes: 0 interface list
NAME KERNEL_NAME STATUS ROUTES GEOIP PPS IN BPS IN PPS OUT BPS OUT
vlan100 vlan100 active 0 none 0pps 0bps 0pps 0bpsIP addresses and interface scripts
In L3 mode, creating a NGRaff interface also creates a corresponding virtual interface in Linux. Assign IP addresses in the Linux stack; routes can be configured using BIRD or FRR.
For the vlan100 example, assign an address manually from the Linux command line:
To assign the address when NGRaff starts, create scripts in its configuration directory:
| Script | When it runs |
|---|---|
ifup.<name>.sh |
After the interface is created. |
ifdown.<name>.sh |
Before the interface is removed. |
The name in the filename must match the NGRaff interface name. The script receives the interface name as its first argument ($1) and has 30 seconds to complete.
Example /etc/ngraff/ifup.vlan100.sh:
Make the script executable:
The /etc/ngraff path and IP address are examples. Use your own configuration directory and addressing.
In L2 mode, interfaces are used to collect traffic statistics and rewrite VLAN tags. Create an interface for the required port and VLAN to track its traffic and configure VLAN tag rewriting.
In an L2 build, access and trunk commands also take a Linux interface name. This name identifies the interface when operating in a cluster. If no cluster is used, this parameter can contain any text.
| Command | Description |
|---|---|
interface add vlan access <PORT> <NAME> <LINUX_NAME> |
Create an Access interface to collect statistics for untagged traffic. |
interface add vlan trunk <PORT> <VLAN> <NAME> <LINUX_NAME> |
Create a VLAN interface for statistics and tag rewriting. |
interface set name <NAME> <LINUX_NAME> |
Change the Linux interface name used for cluster identification. |
interface list |
Show interfaces, status and current traffic rates. |
interface info <NAME> |
Show interface parameters. |
interface stats <NAME> |
Show packet processing and drop counters for the selected interface. |
<PORT> is the NGRaff or bond port number; <NAME> is the interface name; <VLAN> is the VLAN ID; <LINUX_NAME> identifies the interface in a cluster. Do not type the angle brackets.
Access: untagged traffic
interface add vlan access 0 uplink eth0Creates uplink for untagged traffic on port 0. The Linux interface name used for cluster identification is eth0.
Trunk: a single VLAN
interface add vlan trunk 0 100 vlan100 eth0.100Creates vlan100 for VLAN 100 on port 0. The Linux interface name used for cluster identification is eth0.100. Create a separate named interface for each additional VLAN.
Changing the Linux interface name
interface set name vlan100 eth0.100Sets the Linux interface name of vlan100 to eth0.100 for identification when operating in a cluster.
Command availability depends on the build. See the L3 tab for QinQ and Double VLAN examples.
Example parameter output for the created VLAN interface:
interface info vlan100
Interface Name: vlan100
Status: active
Kernel interface Name: eth0.100
Kernel interface ID: -
Type: TRUNK VLAN 100
Port: 0
TTL action: -
Routes: 0 interface list
NAME KERNEL_NAME STATUS ROUTES GEOIP PPS IN BPS IN PPS OUT BPS OUT
vlan100 eth0.100 active 0 none 0pps 0bps 0pps 0bpsSaving and removal
After verification, save the configuration:
saveInterface settings are saved to interface.cli in the NGRaff configuration directory.
To remove an interface:
interface remove vlan100