Tip
This is the documentation for the 21.07 version. Looking for the documentation of the latest version? Have a look here.
Tap Interfaces¶
Virtual network tap interfaces give daemons and clients in the host operating system access to send and receive network traffic through TNSR to other networks. A tap interface can carry layer 2 and layer 3 frames between the host OS and TNSR, and be a bridge member.
Tap Configuration¶
The interface tap <name>
command creates a tap object with the given name.
This name is also used to create the tap interface in the host OS. For example,
if a tap object was created with interface tap mytap
, then the interface in
the host OS is named mytap
.
This command enters config-tap
mode, which contains the following commands:
- instance <instance>:
Required instance identifier for the tap interface. A tap interface appears in TNSR using the
tap
prefix followed by the chosen identifier number. For example, with an identifier number of1
, the TNSR interface will betap1
.- mac-address <mac>:
The MAC address for the TNSR side of the tap interface.
- (rx-ring-size|tx-ring-size) <size>:
Configures the receive (
rx
) or transmit (tx
) ring buffer size.Note
Default ring size is
256
. The value must be a power of2
and must be less than or equal to32768
.- host bridge <bridge-name>:
Configure the tap as part of a host bridge.
Note
A tap object cannot have both an IP address and a bridge name set.
- host (ipv4|ipv6) gateway <ip-addr>:
Configure a gateway for the host tap interface.
- host (ipv4|ipv6) prefix <ip-addr>:
Configures the host IPv4 or IPv6 address for the tap interface.
- host mac-address <mac>:
The MAC address for the host side of the tap interface.
- host namespace <ns>:
Configure a namespace inside which the tap will be created on the host.
TAP Examples¶
Example tap Interface¶
The following commands create a tap object named mytap
with an instance id
of 1
:
tnsr(config)# interface tap mytap
tnsr(config-tap)# instance 1
At this point, the TNSR and host OS interfaces exist but contain no configuration:
In TNSR:
tnsr# show interface tap1
Interface: tap1
Admin status: down
Link up, unknown, unknown duplex
Link MTU: 9216 bytes
MAC address: 02:fe:77:d9:be:1e
IPv4 Route Table: ipv4-VRF:0
IPv6 Route Table: ipv6-VRF:0
In the host OS:
$ ip address show mytap
300: mytap: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group
default qlen 1000
link/ether 42:5a:f0:6f:d9:77 brd ff:ff:ff:ff:ff:ff
inet6 fe80::405a:f0ff:fe6f:d977/64 scope link
valid_lft forever preferred_lft forever
Example Tap Interface Addresses¶
Configuring addresses for tap interfaces depends on the location of the interface.
For the interface visible in TNSR, configure it in the same manner as other TNSR interfaces:
tnsr# configure
tnsr(config)# int tap1
tnsr(config-interface)# ip address 10.2.99.2/24
tnsr(config-interface)# enable
tnsr(config-interface)# exit
tnsr(config)# exit
tnsr#
The MAC address of the tap interface may also be set on the tap
object:
tnsr# configure
tnsr(config)# interface tap mytap
tnsr(config-tap)# mac-address 02:fe:77:d9:be:ae
tnsr(config-tap)# exit
tnsr(config)# exit
tnsr#
The address for the host OS interface is configured by the host
command under
the tap object instance:
tnsr# configure
tnsr(config)# interface tap mytap
tnsr(config-tap)# host ipv4 prefix 10.2.99.1/24
tnsr(config-tap)# exit
tnsr(config)# exit
tnsr#
At this point, the interfaces will show the configured addresses:
In TNSR:
tnsr# show interface tap1
Interface: tap1
Admin status: up
Link up, unknown, unknown duplex
Link MTU: 9216 bytes
MAC address: 02:fe:77:d9:be:ae
IPv4 Route Table: ipv4-VRF:0
IPv4 addresses:
10.2.99.2/24
IPv6 Route Table: ipv6-VRF:0
In the host OS:
$ ip address show mytap
308: mytap: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group
default qlen 1000
link/ether 02:fe:77:d9:be:ae brd ff:ff:ff:ff:ff:ff
inet 10.2.99.1/24 scope global mytap
valid_lft forever preferred_lft forever
inet6 fe80::02fe:77d9:beae/64 scope link
valid_lft forever preferred_lft forever
The host <family> prefix <address>
syntax works similarly for IPv6 with
an appropriate address.