Tip
This is the documentation for the 19.02 version. Looking for the documentation of the latest version? Have a look here.
- orphan:
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.
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
.
A tap interface appears in TNSR using the tap
prefix followed by the
chosen identifier number. For example, with an identifier number of 1
, the
TNSR interface will be tap1
. The instance identifier is required.
Creating tap Interfaces¶
Using the above example values, these commands will create a tap object and interface instance:
tnsr(config)# interface tap mytap
tnsr(config-tap)# instance 1
At this point, the interfaces exist but they contain no configuration:
In TNSR:
tnsr# show int 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
tap Interface Addresses¶
Configuring addresses for the 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 int 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.
Additional tap Configuration¶
Configure the tap as part of a host bridge:
tnsr(config-tap)# host bridge <bridge-name>
Note
A tap object cannot have both and IP address and a bridge name set.
Configure a gateway for the host tap interface:
tnsr(config-tap)# host (ipv4|ipv6) gateway <ipv4-addr>
Configure a namespace inside which the tap will be created on the host:
tnsr(config-tap)# host name-space <netns>
Configure the transmit and receive ring buffer sizes:
tnsr(config-tap)# rx-ring-size <size>
tnsr(config-tap)# tx-ring-size <size>
Note
Default ring size is 256
. The value must be a power of 2 and must
be less than or equal to 32768
.