PAIR(4) - Device Drivers Manual #
PAIR(4) - Device Drivers Manual
NAME #
pair - virtual Ethernet interface pair
SYNOPSIS #
pseudo-device pair
DESCRIPTION #
The pair interface simulates a normal Ethernet interface by encapsulating standard network frames with an Ethernet header, specifically for use in a pair of interfaces that are interconnected with each other.
To use it, the administrator needs to create two pair interfaces and connect them; the interfaces are ‘patched’, as would be done with physical network ports. All packets that are sent on the first interface are received on the second interface.
EXAMPLES #
Set up a pair of interfaces where each of them is a member of a different rdomain(4):
# ifconfig pair1 rdomain 1 10.1.1.1/24 up
# ifconfig pair2 rdomain 2 10.1.1.2/24 up
# ifconfig pair1 patch pair2
# route -T 1 exec ping 10.1.1.2
When adding multiple pair to multiple bridge(4) interfaces, it is possible to create a loop; the system load will go up while it is busy sending packets from one bridge to another and back. By design, the driver does not prevent such loops by itself, but it is possible to use the Spanning Tree Protocol (STP) to detect and remove loops in the virtual network topology:
# ifconfig pair0 up
# ifconfig pair1 rdomain 1 patch pair0 up
# ifconfig pair2 up
# ifconfig pair3 rdomain 1 patch pair2 up
# ifconfig bridge0 add pair0 add pair2 stp pair0 stp pair2 up
# ifconfig bridge1 add pair1 add pair3 stp pair1 stp pair3 up
SEE ALSO #
bridge(4), inet(4), inet6(4), rdomain(4), vether(4), hostname.if(5), ifconfig(8), netstart(8)
HISTORY #
The pair interface first appeared in OpenBSD 5.9.
AUTHORS #
The
pair
driver is based on
vether(4)
by
Theo de Raadt <deraadt@openbsd.org>.
It has been extended and turned into
pair
by
Reyk Floeter <reyk@openbsd.org>.
CAVEATS #
Unlike vether(4), the pair interface cannot be used as a stand-alone member in a bridge(4): the link state remains down until it is connected to the second interface. Any associated routes will be marked down until it is patched. Use vether(4) as a bridge endpoint for routing purposes instead.
BUGS #
Like tun(4), the Ethernet address chosen will be partially random, and may occasionally collide with another address.
OpenBSD 7.5 - October 30, 2015