Tip

This is the documentation for the 22.02 version. Looking for the documentation of the latest version? Have a look here.

Remove TNSR NIC for Host Use

If TNSR is controlling a network interface that should be used by the host OS, it can be returned to host OS control in a few steps.

Locate the Interface

First, identify the interface in question. The PCI ID and Linux interface name are required to proceed, and Host Interface Name to Dataplane ID Mapping explains the relationship between these interface names and IDs.

In this example, the TNSR interface GigabitEthernet0/14/3 will be returned to the host OS. Based on the name, the PCI ID is 0000:00:14.3, and converting from hexadecimal to decimal yields the Linux interface name enp0s20f3. This is determined based on PCI bus 0, Bus slot 20 (decimal), function 3.

Remove the Interface from TNSR

First, remove any configuration items using the interface. The interface could be present in several places, so inspect the entire running configuration for references to this interface and then remove them.

Next, remove the interface configuration itself:

tnsr# configure
tnsr(config)# no interface GigabitEthernet0/14/3

If the interface was manually specified in the dataplane by PCI ID as mentioned in Configuring Interfaces for TNSR, that must be also be removed. This will be present in the running configuration inside the <dataplane> section, if one exists. To remove the configuration, follow this example using the correct PCI ID:

tnsr(config)# no dataplane dpdk dev 0000:00:14.3

Save the configuration after making these changes, as the next steps will involve actions that may result in the startup configuration being used by TNSR:

tnsr(config)# configuration copy running startup

Exit the TNSR CLI.

Edit the Host Interface Configuration

The netplan interface configuration file is located at /etc/netplan/00-installer-config.yaml. The file name may vary slightly, and may not exist if the installer did not setup at host management interfaces. If it does not exist, create it.

From a shell on the host OS, edit the file for this interface using sudo, for example:

$ sudo vi /etc/netplan/00-installer-config.yaml

Inside that file add a configuration block for the interface:

network:
  ethernets:
    enp3s0:
      dhcp4: true
    enp0s20f3:
      dhcp4: true
  version: 2

Warning

Indentation is critical in this file! Each block indent level must be two (2) spaces.

This example contains interface configurations which indicate that enp3s0 and enp0s20f3 should both be controlled by the host OS with addresses obtained from DHCP.

For a static address, the configuration can be a bit more involved:

network:
  ethernets:
    enp3s0:
      dhcp4: true
    enp0s20f3:
      addresses: [172.19.10.2/24]
      gateway4: 172.19.10.1
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]
  version: 2

Warning

Indentation is critical in this file! Each block indent level must be two (2) spaces.

This configures the enp3s0 interface for DHCP but uses a static IP address configuration for enp0s20f3.

See also

For more information on the format of this file, see the Netplan site.

After making changes, apply them with netplan:

$ sudo netplan apply

Note

The interface may not be available for control by netplan until the device reboots.

Reactivate the Host Interface

At this point, the interface is ready to return to host OS control. There are two methods to complete the process: Reboot the host, or manually reactivate the interface.

Reboot

The fastest and easiest option is to reboot the host. This will allow the host to naturally locate and resume control of the device.

Warning

All traffic processing by TNSR will stop while the host is rebooting!

Reboot the host from the shell as follows:

$ sudo shutdown -r

Manually Reactivate

Warning

The following procedure is advanced and the best practice is to reboot and not follow this method. This should only be attempted in cases where the device cannot be rebooted.

There is also a manual method which may be used if a reboot is not feasible.

First, stop TNSR and related services:

Warning

This command will stop TNSR and all traffic processing!

$ sudo tnsrctl stop

Next, start a root shell and unbind the device from the current driver (TNSR):

$ sudo -s
# echo '0000:00:14.3' > '/sys/bus/pci/devices/0000:00:14.3/driver/unbind'

Warning

Note the use of the PCI ID in both locations in the command, and the use of quotes around parameters.

That leaves the device unbound. Now it must be returned to a host kernel driver. The name of this driver depends on the hardware. For most Netgate TNSR devices this will be igb, as in the following example.

Still using the root shell from the previous command, bind the interface to the driver as follows:

# echo '0000:00:14.3' > '/sys/bus/pci/drivers/igb/bind'

Lastly, start the dataplane and related services:

$ sudo tnsrctl start

Check the Host Interface

At this point the interface is now under host OS control and will be listed in the output of ip and similar commands.

$ ip addr show dev enp0s20f3
5: enp0s20f3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:08:a2:09:95:b4 brd ff:ff:ff:ff:ff:ff