Tip
This is the documentation for the 23.11 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
The manual specification in the dataplane by PCI ID as mentioned
in Configuring Interfaces for TNSR must 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.
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
or igc
depending on the interface involved.
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'
Note
For different types of interfaces, replace igb
in that command with the
name of the appropriate driver, e.g. igc
.
Lastly, start the dataplane and related services:
$ sudo tnsrctl start
Configure the Host Interface¶
With the interface returned to host OS control, now it can be configured for use by the TNSR host. This can be done one of two ways: At the TNSR CLI, or manually with Netplan.
Using the TNSR CLI¶
Using the TNSR CLI to manage host interfaces is the best practice as the configuration will be managed by and visible from within TNSR, offering a more consistent experience and avoiding the need for tracking down or manually configuring items in the host OS. Any required changes in the host OS configuration can be accounted for in TNSR updates, so this is also more likely to work properly between OS updates.
DHCP¶
For an interface receiving its IP address and routes from DHCP, the configuration is fairly simple:
tnsr(config)# host interface enp0s20f3
tnsr(config-host-if)# enable
tnsr(config-host-if)# ip dhcp-client enable
tnsr(config-host-if)# exit
The interface will start at this point and request an address.
Now save the configuration:
tnsr(config)# configuration copy running startup
Static IP Address¶
First set the interface address:
tnsr(config)# host interface enp0s20f3
tnsr(config-host-if)# enable
tnsr(config-host-if)# ip address 172.19.10.2/24
tnsr(config-host-if)# exit
The interface will be up and configured at this point but without any routes.
Next, set the default route:
tnsr(config)# host route table default
tnsr(config-host-route-table)# interface enp0s20f3
tnsr(config-host-route)# route 0.0.0.0/0
tnsr(config-host-route-ip4)# via 172.19.10.1
tnsr(config-host-route-ip4)# end config
After exiting the route configuration, the routes will be present in the host OS routing table.
Now save the configuration:
tnsr(config)# configuration copy running startup
Using Netplan¶
The interface configuration can also be manually managed in Netplan. 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]
routes:
- to: default
via: 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.
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