| VXLAN(4) | Device Drivers Manual | VXLAN(4) |
vxlan — Virtual
eXtensible Local Area Network tunnel interface
pseudo-device vxlan
The vxlan pseudo-device provides
interfaces for tunnelling or overlaying Ethernet networks on top of IPv4 and
IPv6 networks using the Virtual eXtensible Local Area Network (VXLAN)
protocol.
VXLAN datagrams consist of an Ethernet payload encapsulated by an 8-byte VXLAN header, which in turn is encapsulated by UDP and IP headers. Different VXLAN tunnels or overlays between the same VXLAN Tunnel Endpoints (VTEPs) can be distinguished by an optional 24-bit Virtual Network Identifier (VNI).
A vxlan interface can be created using the
ifconfig vxlanN
create command or by setting up a
hostname.if(5) configuration
file for netstart(8).
For correct operation, encapsulated traffic must not be routed over the interface itself. This can be implemented by adding a distinct or a more specific route to the tunnel destination than the hosts or networks routed via the tunnel interface. Alternatively, the tunnel traffic may be configured in a separate routing table to the encapsulated traffic.
The interface can operate in the following tunnel modes:
point-to-point
modelearning
modevxlan operates as a learning bridge. Broadcast,
multicast, and unknown unicast packets are sent to the specified multicast
group. Packets received by the tunnel source address are used to
dynamically learn the endpoint addresses for the encapsulated Ethernet
source addresses.endpoint
modevxlan operates as a bridge, but with learning
disabled. Endpoints for Ethernet addresses must be added explicitly before
packets will be encapsulated for those addresses. All valid VXLAN packets
sent to the local address will be accepted.vxlan supports the following
ioctl(2) calls for
configuration:
SIOCSLIFPHYADDR
struct if_laddrreq *SIOCGLIFPHYADDR
struct if_laddrreq *SIOCDIFPHYADDR
struct ifreq *SIOCSVNETID
struct ifreq *SIOCGVNETID
struct ifreq *SIOCDVNETID
struct ifreq *SIOCSLIFPHYRTABLE
struct ifreq *SIOCGLIFPHYRTABLE
struct ifreq *SIOCSLIFPHYTTL
struct ifreq *SIOCGLIFPHYTTL
struct ifreq *SIOCSLIFPHYDF
struct ifreq *SIOCGLIFPHYDF
struct ifreq *SIOCSRXHPRIO
struct ifreq *IF_HDRPRIO_PACKET to specify that the current
priority of a packet should be kept, or
IF_HDRPRIO_OUTER to use the value in the Type of
Service field in IPv4 or the Traffic Class field in IPv6 encapsulation
headers.SIOCGRXHPRIO
struct ifreq *SIOCSTXHPRIO
struct ifreq *IF_HDRPRIO_PACKET to specify that the current
priority of a packet should be used.SIOCGTXHPRIO
struct ifreq *SIOCSIFPARENT
struct if_parent *SIOCGIFPARENT
struct if_parent *SIOCDIFPARENT
struct ifreq *Create a point-to-point tunnel using Virtual Network Identifier 5:
# ifconfig vxlan0 tunnel 192.168.1.100 192.168.1.200 vnetid 5 # ifconfig vxlan0 10.1.1.100/24
The following examples creates a learning overlay network:
# ifconfig vxlan0 tunnel 192.168.1.100 239.1.1.100 # ifconfig vxlan0 parent ix0 # ifconfig vxlan0 vnetid 7395 # ifconfig vxlan0 10.1.2.100/24
Prior to the assignment of UDP port 4789 by IANA, some early VXLAN implementations used port 8472. A non-standard port can be specified with the tunnel source address:
# ifconfig vxlan0 tunnel 192.168.1.100:8472 239.1.1.100
vxlan does not provide any integrated
security features. It is designed to be a simple protocol that can be used
in trusted data center environments, to carry VM traffic between virtual
machine hypervisors, and provide virtualized layer 2 networks in Cloud
infrastructures.
To protect vxlan tunnels, the traffic can
be protected with IPsec to add authentication and encryption for
confidentiality.
The Packet Filter (PF) can be used to filter tunnel traffic with endpoint policies in pf.conf(5):
table <vxlantep> { 192.168.1.200, 192.168.1.201 }
block in on em0
pass out on em0
pass in on em0 proto udp from <vxlantep> to port vxlan
The Time-to-Live (TTL) value of the tunnel can be set to 1 or a low value to restrict the traffic to the local network:
# ifconfig vxlan0 tunnelttl 1
M. Mahalingam, D. Dutt, K. Duda, P. Agarwal, L. Kreeger, T. Sridhar, M. Bursell, and C. Wright, Virtual eXtensible Local Area Network (VXLAN): A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks, RFC 7348, August 2014.
The vxlan device first appeared in
OpenBSD 5.5.
The vxlan interface requires at least 50
bytes for the IP, UDP and VXLAN protocol overhead and optionally 4 bytes for
the encapsulated VLAN tag. The default MTU is set to 1500 bytes but can be
adjusted if the transport interfaces carrying the tunnel traffic do not
support larger MTUs, the tunnel traffic is leaving the local network, or if
interoperability with another implementation requires running a decreased
MTU of 1450 bytes. In any other case, it is commonly recommended to set the
MTU of the transport interfaces to at least 1600 bytes.
| November 23, 2023 | openbsd |