xref: /freebsd/share/man/man4/epair.4 (revision 046c625e9382e17da953767b881aaa782fa73af8)
1.\"-
2.\" Copyright (c) 2008 The FreeBSD Foundation
3.\"
4.\" This software was developed by CK Software GmbH under sponsorship
5.\" from the FreeBSD Foundation.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd September 4, 2025
29.Dt EPAIR 4
30.Os
31.Sh NAME
32.Nm epair
33.Nd A pair of virtual back-to-back connected Ethernet interfaces
34.Sh SYNOPSIS
35To compile this driver into the kernel,
36place the following line in your
37kernel configuration file:
38.Bd -ragged -offset indent
39.Cd "device epair"
40.Ed
41.Pp
42Alternatively, to load the driver as a
43module at boot time, place the following line in
44.Xr loader.conf 5 :
45.Bd -literal -offset indent
46if_epair_load="YES"
47.Ed
48.Sh DESCRIPTION
49The
50.Nm
51is a pair of Ethernet-like software interfaces,
52which are connected back-to-back with a virtual cross-over cable.
53.Pp
54Each
55.Nm
56interface pair is created at runtime using interface cloning.
57This is most easily done with the
58.Xr ifconfig 8
59.Cm create
60command or using the
61.Va cloned_interfaces
62variable in
63.Xr rc.conf 5 .
64While for cloning you only give either
65.Pa epair
66or
67.Pa epair<n>
68the
69.Nm
70pair will be named like
71.Pa epair<n>[ab] .
72This means the names of the first
73.Nm
74interfaces will be
75.Pa epair0a
76and
77.Pa epair0b .
78.Pp
79Like any other Ethernet interface, an
80.Nm
81needs to have a network address.
82If the tunable
83.Va net.link.epair.ether_gen_addr Ns
84=0, each
85.Nm
86will be assigned a random locally administered address,
87that is only guaranteed to be unique within one network stack.
88The tunable
89.Va net.link.epair.ether_gen_addr Ns
90=1 will generate a stable MAC address with
91.Fx
92OUI using
93.Xr ether_gen_addr 9 .
94This tunable defaults to 1 in
95.Fx 15.0 and might be removed in
96.Fx 16.0 .
97To change the default addresses one may use the SIOCSIFADDR
98.Xr ioctl 2 or
99.Xr ifconfig 8 utility.
100.Pp
101The basic intent is to provide connectivity between two virtual
102network stack instances.
103When connected to an
104.Xr if_bridge 4 ,
105one end of the interface pair can also be part of another (virtual) LAN.
106As with any other Ethernet interface,
107.Nm epair
108can have a
109.Xr vlan 4
110configured on top of it.
111.Pp
112The
113.Nm
114has RXCSUM and RXCSUM6 enabled because it may receive a packet where the
115checksum has already been validated by a physical interface.
116The
117.Nm
118supports TXCSUM and TXCSUM6 for TCP and UDP, but only by forwarding the order
119to compute the checksum.
120Thus, when using an
121.Nm
122interface, a TCP or UDP sender can offload checksum computation
123to a physical interface.
124Note that, in case the packet does not leave the host, the checksum is
125unnecessary and will be ignored if offloaded.
126Such packets contain an incorrect checksum, since it is not computed yet.
127TXCSUM and TXCSUM6 are synchronized between the
128.Nm
129interface pair (i.e., enabling/disabling the capability on one end
130enables/disables it on the other end).
131In case one end is in a bridge and the bridge disabled TXCSUM or TXCSUM6,
132this avoids a sender to send packets with checksum offloading into the
133bridge by using the other end.
134.Sh SEE ALSO
135.Xr ioctl 2 ,
136.Xr altq 4 ,
137.Xr bpf 4 ,
138.Xr if_bridge 4 ,
139.Xr vlan 4 ,
140.Xr loader.conf 5 ,
141.Xr rc.conf 5 ,
142.Xr ifconfig 8
143.Sh HISTORY
144The
145.Nm
146interface first appeared in
147.Fx 8.0 .
148.Sh AUTHORS
149The
150.Nm
151interface was written by
152.An Bjoern A. Zeeb, CK Software GmbH,
153under sponsorship from the FreeBSD Foundation.
154