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 network manager interface configuration scripts are located in /etc/sysconfig/network-scripts/. This directory will contain an interface configuration script for the Linux interface name determined above, in the form of ifcfg-<name>. In this example, this is ifcfg-enp0s20f3.

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

$ sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s20f3

Inside that file change ONBOOT to yes:

ONBOOT=yes

Remove the NM_CONTROLLED line. if one is present.

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 we do not recommend using this method. We strongly advise rebooting the host instead.

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

First, stop the dataplane and related services:

Warning

All traffic processing by TNSR will stop while this service is stopped!

$ sudo systemctl stop vpp

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 systemctl start clixon-backend

Configure 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

The interface configuration in the host OS can be used to change the interface behavior as needed. The default behavior is to act as a DHCP client. This can be changed by editing the interface configuration file noted in Edit the Host Interface Configuration. Consult the CentOS documentation for additional details.