2001-06-11 12:39:29 +00:00
|
|
|
.\" $KAME: gif.4,v 1.28 2001/05/18 13:15:56 itojun Exp $
|
2000-07-05 08:15:05 +00:00
|
|
|
.\"
|
2000-01-06 12:40:54 +00:00
|
|
|
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
|
|
|
.\" All rights reserved.
|
2000-07-05 08:15:05 +00:00
|
|
|
.\"
|
2000-01-06 12:40:54 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. Neither the name of the project nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
2000-07-05 08:15:05 +00:00
|
|
|
.\"
|
2000-01-06 12:40:54 +00:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2002-08-13 13:50:36 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2011-08-02 01:48:45 +00:00
|
|
|
.Dd August 1, 2011
|
2000-01-06 12:40:54 +00:00
|
|
|
.Dt GIF 4
|
2000-01-17 15:24:41 +00:00
|
|
|
.Os
|
2000-01-06 12:40:54 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm gif
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd generic tunnel interface
|
2000-01-06 12:40:54 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-09-06 00:27:48 +00:00
|
|
|
.Cd "device gif"
|
2000-01-06 12:40:54 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
2002-08-13 13:50:36 +00:00
|
|
|
interface is a generic tunnelling device for IPv4 and IPv6.
|
2000-01-06 12:40:54 +00:00
|
|
|
It can tunnel IPv[46] traffic over IPv[46].
|
|
|
|
Therefore, there can be four possible configurations.
|
|
|
|
The behavior of
|
|
|
|
.Nm
|
2001-06-11 12:39:29 +00:00
|
|
|
is mainly based on RFC2893 IPv6-over-IPv4 configured tunnel.
|
|
|
|
On
|
|
|
|
.Nx ,
|
|
|
|
.Nm
|
|
|
|
can also tunnel ISO traffic over IPv[46] using EON encapsulation.
|
2005-06-08 01:53:25 +00:00
|
|
|
Note that
|
|
|
|
.Nm
|
|
|
|
does not perform GRE encapsulation; use
|
|
|
|
.Xr gre 4
|
|
|
|
for GRE encapsulation.
|
2000-01-06 12:40:54 +00:00
|
|
|
.Pp
|
2001-12-14 22:55:10 +00:00
|
|
|
Each
|
2001-09-28 00:22:44 +00:00
|
|
|
.Nm
|
2001-12-14 22:55:10 +00:00
|
|
|
interface is created at runtime using interface cloning.
|
2001-10-01 13:06:40 +00:00
|
|
|
This is
|
2001-09-28 00:22:44 +00:00
|
|
|
most easily done with the
|
2003-02-24 22:53:26 +00:00
|
|
|
.Dq Nm ifconfig Cm create
|
2001-12-14 22:55:10 +00:00
|
|
|
command or using the
|
2005-07-26 18:14:22 +00:00
|
|
|
.Va ifconfig_ Ns Aq Ar interface
|
2001-12-14 22:55:10 +00:00
|
|
|
variable in
|
|
|
|
.Xr rc.conf 5 .
|
2001-09-28 00:22:44 +00:00
|
|
|
.Pp
|
2000-01-06 12:40:54 +00:00
|
|
|
To use
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm ,
|
2002-07-15 16:23:56 +00:00
|
|
|
the administrator needs to configure the protocol and addresses used for the outer
|
2000-01-06 12:40:54 +00:00
|
|
|
header.
|
|
|
|
This can be done by using
|
2003-01-04 05:32:48 +00:00
|
|
|
.Xr ifconfig 8
|
|
|
|
.Cm tunnel ,
|
2000-01-06 12:40:54 +00:00
|
|
|
or
|
|
|
|
.Dv SIOCSIFPHYADDR
|
|
|
|
ioctl.
|
2002-07-15 16:23:56 +00:00
|
|
|
The administrator also needs to configure the protocol and addresses for the
|
|
|
|
inner header, with
|
2000-01-06 12:40:54 +00:00
|
|
|
.Xr ifconfig 8 .
|
2002-07-15 16:23:56 +00:00
|
|
|
Note that IPv6 link-local addresses
|
|
|
|
(those that start with
|
2001-08-07 15:48:51 +00:00
|
|
|
.Li fe80:: )
|
2004-09-24 20:09:44 +00:00
|
|
|
will be automatically configured whenever possible.
|
2002-07-15 16:23:56 +00:00
|
|
|
You may need to remove IPv6 link-local addresses manually using
|
2000-01-06 12:40:54 +00:00
|
|
|
.Xr ifconfig 8 ,
|
2002-07-15 16:23:56 +00:00
|
|
|
if you want to disable the use of IPv6 as the inner header
|
|
|
|
(for example, if you need a pure IPv4-over-IPv6 tunnel).
|
|
|
|
Finally, you must modify the routing table to route the packets through the
|
2000-01-06 12:40:54 +00:00
|
|
|
.Nm
|
|
|
|
interface.
|
|
|
|
.Pp
|
2002-07-15 16:23:56 +00:00
|
|
|
The
|
2000-01-06 12:40:54 +00:00
|
|
|
.Nm
|
2002-08-13 13:50:36 +00:00
|
|
|
device can be configured to be ECN friendly.
|
2000-01-06 12:40:54 +00:00
|
|
|
This can be configured by
|
|
|
|
.Dv IFF_LINK1 .
|
|
|
|
.Ss ECN friendly behavior
|
2002-07-15 16:23:56 +00:00
|
|
|
The
|
2000-01-06 12:40:54 +00:00
|
|
|
.Nm
|
2002-08-13 13:50:36 +00:00
|
|
|
device can be configured to be ECN friendly, as described in
|
2000-07-05 08:15:05 +00:00
|
|
|
.Dv draft-ietf-ipsec-ecn-02.txt .
|
2002-07-15 16:23:56 +00:00
|
|
|
This is turned off by default, and can be turned on by the
|
2000-01-06 12:40:54 +00:00
|
|
|
.Dv IFF_LINK1
|
|
|
|
interface flag.
|
|
|
|
.Pp
|
|
|
|
Without
|
|
|
|
.Dv IFF_LINK1 ,
|
|
|
|
.Nm
|
2002-07-15 16:23:56 +00:00
|
|
|
will show normal behavior, as described in RFC2893.
|
2000-01-06 12:40:54 +00:00
|
|
|
This can be summarized as follows:
|
|
|
|
.Bl -tag -width "Ingress" -offset indent
|
|
|
|
.It Ingress
|
|
|
|
Set outer TOS bit to
|
|
|
|
.Dv 0 .
|
|
|
|
.It Egress
|
|
|
|
Drop outer TOS bit.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
With
|
|
|
|
.Dv IFF_LINK1 ,
|
|
|
|
.Nm
|
|
|
|
will copy ECN bits
|
2001-08-07 15:48:51 +00:00
|
|
|
.Dv ( 0x02
|
2000-01-06 12:40:54 +00:00
|
|
|
and
|
|
|
|
.Dv 0x01
|
2001-08-07 15:48:51 +00:00
|
|
|
on IPv4 TOS byte or IPv6 traffic class byte)
|
2000-01-06 12:40:54 +00:00
|
|
|
on egress and ingress, as follows:
|
|
|
|
.Bl -tag -width "Ingress" -offset indent
|
|
|
|
.It Ingress
|
|
|
|
Copy TOS bits except for ECN CE
|
2001-08-07 15:48:51 +00:00
|
|
|
(masked with
|
|
|
|
.Dv 0xfe )
|
2000-01-06 12:40:54 +00:00
|
|
|
from
|
|
|
|
inner to outer.
|
2001-08-10 15:03:10 +00:00
|
|
|
Set ECN CE bit to
|
2000-01-06 12:40:54 +00:00
|
|
|
.Dv 0 .
|
|
|
|
.It Egress
|
|
|
|
Use inner TOS bits with some change.
|
|
|
|
If outer ECN CE bit is
|
|
|
|
.Dv 1 ,
|
|
|
|
enable ECN CE bit on the inner.
|
|
|
|
.El
|
|
|
|
.Pp
|
2001-06-11 12:39:29 +00:00
|
|
|
Note that the ECN friendly behavior violates RFC2893.
|
2000-07-05 08:15:05 +00:00
|
|
|
This should be used in mutual agreement with the peer.
|
|
|
|
.Ss Security
|
2002-07-15 16:23:56 +00:00
|
|
|
A malicious party may try to circumvent security filters by using
|
2000-07-05 08:15:05 +00:00
|
|
|
tunnelled packets.
|
|
|
|
For better protection,
|
|
|
|
.Nm
|
2002-07-15 16:23:56 +00:00
|
|
|
performs both martian and ingress filtering against the outer source address
|
2000-07-05 08:15:05 +00:00
|
|
|
on egress.
|
2002-07-15 16:23:56 +00:00
|
|
|
Note that martian/ingress filters are in no way complete.
|
2000-07-05 08:15:05 +00:00
|
|
|
You may want to secure your node by using packet filters.
|
2004-12-06 19:31:35 +00:00
|
|
|
Ingress filtering can break tunnel operation in an asymmetrically
|
|
|
|
routed network.
|
|
|
|
It can be turned off by
|
2001-06-11 12:39:29 +00:00
|
|
|
.Dv IFF_LINK2
|
|
|
|
bit.
|
2004-12-06 19:31:35 +00:00
|
|
|
.Ss Route caching
|
|
|
|
Processing each packet requires two route lookups: first on the
|
|
|
|
packet itself, and second on the tunnel destination.
|
|
|
|
This second route can be cached, increasing tunnel performance.
|
|
|
|
However, in a dynamically routed network, the tunnel will stick
|
|
|
|
to the cached route, ignoring routing table updates.
|
|
|
|
Route caching can be enabled with the
|
|
|
|
.Dv IFF_LINK0
|
|
|
|
flag.
|
2000-01-06 12:40:54 +00:00
|
|
|
.\"
|
2002-02-26 01:56:56 +00:00
|
|
|
.Ss Miscellaneous
|
2002-03-18 12:34:41 +00:00
|
|
|
By default,
|
2002-02-26 01:56:56 +00:00
|
|
|
.Nm
|
|
|
|
tunnels may not be nested.
|
|
|
|
This behavior may be modified at runtime by setting the
|
|
|
|
.Xr sysctl 8
|
|
|
|
variable
|
|
|
|
.Va net.link.gif.max_nesting
|
|
|
|
to the desired level of nesting.
|
|
|
|
Additionally,
|
|
|
|
.Nm
|
|
|
|
tunnels are restricted to one per pair of end points.
|
|
|
|
Parallel tunnels may be enabled by setting the
|
|
|
|
.Xr sysctl 8
|
|
|
|
variable
|
|
|
|
.Va net.link.gif.parallel_tunnels
|
|
|
|
to 1.
|
2000-01-06 12:40:54 +00:00
|
|
|
.Sh SEE ALSO
|
2005-06-08 01:53:25 +00:00
|
|
|
.Xr gre 4 ,
|
2000-01-06 12:40:54 +00:00
|
|
|
.Xr inet 4 ,
|
|
|
|
.Xr inet6 4 ,
|
2003-01-04 05:32:48 +00:00
|
|
|
.Xr ifconfig 8
|
2000-07-05 08:15:05 +00:00
|
|
|
.Rs
|
2002-08-13 13:50:36 +00:00
|
|
|
.%A R. Gilligan
|
|
|
|
.%A E. Nordmark
|
|
|
|
.%B RFC2893
|
|
|
|
.%T Transition Mechanisms for IPv6 Hosts and Routers
|
|
|
|
.%D August 2000
|
2011-08-02 01:48:45 +00:00
|
|
|
.%U http://tools.ietf.org/html/rfc2893
|
2000-07-05 08:15:05 +00:00
|
|
|
.Re
|
2000-01-06 12:40:54 +00:00
|
|
|
.Rs
|
2002-08-13 13:50:36 +00:00
|
|
|
.%A Sally Floyd
|
|
|
|
.%A David L. Black
|
|
|
|
.%A K. K. Ramakrishnan
|
|
|
|
.%T "IPsec Interactions with ECN"
|
|
|
|
.%D December 1999
|
|
|
|
.%O draft-ietf-ipsec-ecn-02.txt
|
2000-01-06 12:40:54 +00:00
|
|
|
.Re
|
|
|
|
.\"
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2002-07-15 16:23:56 +00:00
|
|
|
device first appeared in the WIDE hydrangea IPv6 kit.
|
2000-07-05 08:15:05 +00:00
|
|
|
.\"
|
|
|
|
.Sh BUGS
|
2002-07-15 16:23:56 +00:00
|
|
|
There are many tunnelling protocol specifications, all
|
2002-08-13 13:50:36 +00:00
|
|
|
defined differently from each other.
|
|
|
|
The
|
2000-07-05 08:15:05 +00:00
|
|
|
.Nm
|
2002-08-13 13:50:36 +00:00
|
|
|
device may not interoperate with peers which are based on different specifications,
|
2000-07-05 08:15:05 +00:00
|
|
|
and are picky about outer header fields.
|
|
|
|
For example, you cannot usually use
|
|
|
|
.Nm
|
|
|
|
to talk with IPsec devices that use IPsec tunnel mode.
|
|
|
|
.Pp
|
|
|
|
The current code does not check if the ingress address
|
2001-08-07 15:48:51 +00:00
|
|
|
(outer source address)
|
2002-07-15 16:23:56 +00:00
|
|
|
configured in the
|
2000-07-05 08:15:05 +00:00
|
|
|
.Nm
|
2002-07-15 16:23:56 +00:00
|
|
|
interface makes sense.
|
|
|
|
Make sure to specify an address which belongs to your node.
|
2000-07-05 08:15:05 +00:00
|
|
|
Otherwise, your node will not be able to receive packets from the peer,
|
2002-07-15 16:23:56 +00:00
|
|
|
and it will generate packets with a spoofed source address.
|
2000-07-05 08:15:05 +00:00
|
|
|
.Pp
|
2001-06-11 12:39:29 +00:00
|
|
|
If the outer protocol is IPv4,
|
|
|
|
.Nm
|
|
|
|
does not try to perform path MTU discovery for the encapsulated packet
|
2001-08-07 15:48:51 +00:00
|
|
|
(DF bit is set to 0).
|
2001-06-11 12:39:29 +00:00
|
|
|
.Pp
|
2002-07-15 16:23:56 +00:00
|
|
|
If the outer protocol is IPv6, path MTU discovery for encapsulated packets
|
2001-06-11 12:39:29 +00:00
|
|
|
may affect communication over the interface.
|
|
|
|
The first bigger-than-pmtu packet may be lost.
|
|
|
|
To avoid the problem, you may want to set the interface MTU for
|
|
|
|
.Nm
|
2002-07-15 16:23:56 +00:00
|
|
|
to 1240 or smaller, when the outer header is IPv6 and the inner header is IPv4.
|
2001-06-11 12:39:29 +00:00
|
|
|
.Pp
|
2002-07-15 16:23:56 +00:00
|
|
|
The
|
2001-06-11 12:39:29 +00:00
|
|
|
.Nm
|
2002-08-13 13:50:36 +00:00
|
|
|
device does not translate ICMP messages for the outer header into the inner header.
|
2001-06-11 12:39:29 +00:00
|
|
|
.Pp
|
|
|
|
In the past,
|
|
|
|
.Nm
|
|
|
|
had a multi-destination behavior, configurable via
|
|
|
|
.Dv IFF_LINK0
|
|
|
|
flag.
|
2002-07-15 16:23:56 +00:00
|
|
|
The behavior is obsolete and is no longer supported.
|
Fix and add a workaround on an issue of EtherIP packet with reversed
version field sent via gif(4)+if_bridge(4). The EtherIP
implementation found on FreeBSD 6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 had
an interoperability issue because it sent the incorrect EtherIP
packets and discarded the correct ones.
This change introduces the following two flags to gif(4):
accept_rev_ethip_ver: accepts both correct EtherIP packets and ones
with reversed version field, if enabled. If disabled, the gif
accepts the correct packets only. This flag is enabled by
default.
send_rev_ethip_ver: sends EtherIP packets with reversed version field
intentionally, if enabled. If disabled, the gif sends the correct
packets only. This flag is disabled by default.
These flags are stored in struct gif_softc and can be set by
ifconfig(8) on per-interface basis.
Note that this is an incompatible change of EtherIP with the older
FreeBSD releases. If you need to interoperate older FreeBSD boxes and
new versions after this commit, setting "send_rev_ethip_ver" is
needed.
Reviewed by: thompsa and rwatson
Spotted by: Shunsuke SHINOMIYA
PR: kern/125003
MFC after: 2 weeks
2009-06-07 23:00:40 +00:00
|
|
|
.Pp
|
|
|
|
On
|
|
|
|
.Fx
|
|
|
|
6.1, 6.2, 6.3, 7.0, 7.1, and 7.2
|
|
|
|
the
|
|
|
|
.Nm
|
|
|
|
sends and receives incorrect EtherIP packets with reversed version
|
|
|
|
field when
|
|
|
|
.Xr if_bridge 4
|
|
|
|
is used together. As a workaround on this interoperability issue, the
|
|
|
|
following two
|
|
|
|
.Xr ifconfig 8
|
|
|
|
flags can be used:
|
|
|
|
.Bl -tag -width "accept_rev_ethip_ver" -offset indent
|
|
|
|
.It accept_rev_ethip_ver
|
|
|
|
accepts both correct EtherIP packets and ones with reversed version
|
|
|
|
field, if enabled. If disabled, the
|
|
|
|
.Nm
|
|
|
|
accepts the correct packets only. This flag is enabled by default.
|
|
|
|
.It send_rev_ethip_ver
|
|
|
|
sends EtherIP packets with reversed version field intentionally, if
|
|
|
|
enabled. If disabled, the
|
|
|
|
.Nm
|
|
|
|
sends the correct packets only. This flag is disabled by default.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If interoperability with the older
|
|
|
|
.Fx
|
|
|
|
machines is needed, both of these two flags must be enabled.
|