xref: /openbsd-src/share/man/man4/eoip.4 (revision d9302c3bb1e1616a3630dbeec32399a2e0d8271e)
1.\" $OpenBSD: eoip.4,v 1.8 2023/07/26 20:23:22 jmc Exp $
2.\" $NetBSD: gre.4,v 1.10 1999/12/22 14:55:49 kleink Exp $
3.\"
4.\" Copyright 1998 (c) The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by Heiko W. Rupp <hwr@pilhuhn.de>
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21.\" TO, THE  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27.\" CONTRACT, STRICT  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28.\" ARISING IN ANY WAY  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29.\" POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd $Mdocdate: July 26 2023 $
32.Dt EOIP 4
33.Os
34.Sh NAME
35.Nm eoip
36.Nd MikroTik Ethernet over IP tunnel network device
37.Sh SYNOPSIS
38.Cd "pseudo-device gre"
39.Sh DESCRIPTION
40The
41.Nm
42interface provides tunnelling of Ethernet frames across
43IPv4 and IPv6 networks using the
44MikroTik Ethernet over IP (EoIP) encapsulation protocol.
45.Pp
46The protocol is based on the Generic Routing and Encapsulation (GRE)
47protocol.
48GRE datagrams (IP protocol number 47) consist of a GRE header
49and an outer IP header for encapsulating another protocol's datagram.
50The GRE header specifies a version and the type of the encapsulated datagram,
51allowing for the tunnelling of multiple protocols.
52EoIP uses GRE version 1, its own protocol identifier (0x6400)
53for Ethernet, and has its own keepalive semantics,
54making it distinct from the Ethernet over GRE version 0 protocol
55supported by
56.Xr egre 4 .
57However, it is implemented as part of the same driver providing
58.Xr egre 4 .
59.Pp
60Different tunnels between the same endpoints are distinguished
61by a 16-bit tunnel identifier field in the header.
62.Pp
63All GRE packet processing in the system is allowed or denied by setting the
64.Va net.inet.gre.allow
65.Xr sysctl 8
66variable.
67To allow GRE packet processing, set
68.Va net.inet.gre.allow
69to 1.
70.Pp
71.Nm
72interfaces can be created at runtime using the
73.Ic ifconfig eoip Ns Ar N Ic create
74command or by setting up a
75.Xr hostname.if 5
76configuration file for
77.Xr netstart 8 .
78.Pp
79For correct operation, encapsulated traffic must not be routed
80over the interface itself.
81This can be implemented by adding a distinct or a more specific
82route to the tunnel destination than the hosts or networks routed
83via the tunnel interface.
84Alternatively, the tunnel traffic may be configured in a separate
85routing table to the encapsulated traffic.
86.Ss Programming Interface
87.Nm
88interfaces support the following
89.Xr ioctl 2
90calls for configuring tunnel options:
91.Bl -tag -width indent -offset 3n
92.It Dv SIOCSLIFPHYADDR Fa "struct if_laddrreq *"
93Set the unicast IPv4 or IPv6 addresses for the encapsulating IP packets.
94The addresses may only be configured while the interface is down.
95.It Dv SIOCGLIFPHYADDR Fa "struct if_laddrreq *"
96Get the addresses used for the encapsulating IP packets.
97.It Dv SIOCDIFPHYADDR Fa "struct ifreq *"
98Clear the addresses used for the encapsulating IP packets.
99The addresses may only be cleared while the interface is down.
100.It Dv SIOCSVNETID Fa "struct ifreq *"
101Configure a virtual network identifier for use as the Tunnel Identifier.
102The virtual network identifier may only be configured while the
103interface is down.
104The Tunnel Identifier is a 16-bit value.
105.It Dv SIOCGVNETID Fa "struct ifreq *"
106Get the virtual network identifier used in the GRE Key header.
107.It Dv SIOCSLIFPHYRTABLE Fa "struct ifreq *"
108Set the routing table the tunnel traffic operates in.
109The routing table may only be configured while the interface is down.
110.It Dv SIOCGLIFPHYRTABLE Fa "struct ifreq *"
111Get the routing table the tunnel traffic operates in.
112.It Dv SIOCSLIFPHYTTL Fa "struct ifreq *"
113Set the Time-To-Live field in IPv4 encapsulation headers, or the
114Hop Limit field in IPv6 encapsulation headers.
115.It Dv SIOCGLIFPHYTTL Fa "struct ifreq *"
116Get the value used in the Time-To-Live field in an IPv4 encapsulation
117header or the Hop Limit field in an IPv6 encapsulation header.
118.It Dv SIOCSLIFPHYDF Fa "struct ifreq *"
119Configure whether the tunnel traffic sent by the interface can be
120fragmented or not.
121This sets the Don't Fragment (DF) bit on IPv4 packets,
122and disables fragmentation of IPv6 packets.
123.It Dv SIOCGLIFPHYDF Fa "struct ifreq *"
124Get whether the tunnel traffic sent by the interface can be fragmented
125or not.
126.It Dv SIOCSTXHPRIO Fa "struct ifreq *"
127Set the priority value used in the Type of Service field in IPv4
128headers, or the Traffic Class field in IPv6 headers.
129Values may be from 0 to 7, or
130.Dv IF_HDRPRIO_PACKET
131to specify that the current priority of a packet should be used.
132.It Dv SIOCGTXHPRIO Fa "struct ifreq *"
133Get the priority value used in the Type of Service field in IPv4
134headers, or the Traffic Class field in IPv6 headers.
135.It Dv SIOCSETKALIVE Fa "struct ifkalivereq *"
136Enable the transmission of keepalive packets to detect tunnel failure.
137Keepalives may only be configured while the interface is down.
138.Pp
139Setting the keepalive period or count to 0 disables keepalives on
140the tunnel.
141.It Dv SIOCGETKALIVE Fa "struct ifkalivereq *"
142Get the configuration of keepalive packets.
143.El
144.Ss Security Considerations
145EoIP does not provide any integrated security features.
146It should only be deployed on trusted private networks,
147or protected with IPsec to add authentication and encryption for
148confidentiality.
149IPsec is especially recommended when transporting EoIP over the
150public internet.
151.Pp
152The Packet Filter
153.Xr pf 4
154can be used to filter tunnel traffic with endpoint policies
155.Xr pf.conf 5 .
156.Pp
157The Time-to-Live (TTL) value of a tunnel can be set to 1 or a low
158value to restrict the traffic to the local network:
159.Bd -literal -offset indent
160# ifconfig eoipN tunnelttl 1
161.Ed
162.Sh EXAMPLES
163.Bd -literal
164Host X ---- Host A ------------ tunnel ----------- MikroTik D --- Host E
165               \e                                      /
166                \e                                    /
167                 +------ Host B ------ Host C ------+
168.Ed
169.Pp
170On Host A
171.Pq Ox :
172.Bd -literal -offset indent
173# route add default B
174# ifconfig eoipN create
175# ifconfig eoipN tunnel A D
176# ifconfig eoipN up
177# route add E D
178.Ed
179.Pp
180On Host D (MikroTik):
181.Bd -literal -offset indent
182[admin@MikroTik] > interface eoip
183[admin@MikroTik] /interface eoip> add name="eoipN" \e
184\e... local-address=D remote-address=A
185[admin@MikroTik] /interface eoip> enable eoipN
186.Ed
187.Sh SEE ALSO
188.Xr egre 4 ,
189.Xr inet 4 ,
190.Xr ip 4 ,
191.Xr netintro 4 ,
192.Xr options 4 ,
193.Xr hostname.if 5 ,
194.Xr protocols 5 ,
195.Xr ifconfig 8 ,
196.Xr netstart 8 ,
197.Xr sysctl 8
198.Sh STANDARDS
199.Rs
200.%A S. Hanks
201.%A "T. Li"
202.%A D. Farinacci
203.%A P. Traina
204.%D October 1994
205.%R RFC 1701
206.%T Generic Routing Encapsulation (GRE)
207.Re
208.Sh AUTHORS
209.An David Gwynne Aq Mt dlg@openbsd.org
210