xref: /freebsd/share/man/man4/gif.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
133841545SHajimu UMEMOTO.\"	$KAME: gif.4,v 1.28 2001/05/18 13:15:56 itojun Exp $
2f6038661SJun-ichiro itojun Hagino.\"
39a4365d0SYoshinobu Inoue.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
49a4365d0SYoshinobu Inoue.\" All rights reserved.
59a4365d0SYoshinobu Inoue.\"
69a4365d0SYoshinobu Inoue.\" Redistribution and use in source and binary forms, with or without
79a4365d0SYoshinobu Inoue.\" modification, are permitted provided that the following conditions
89a4365d0SYoshinobu Inoue.\" are met:
99a4365d0SYoshinobu Inoue.\" 1. Redistributions of source code must retain the above copyright
109a4365d0SYoshinobu Inoue.\"    notice, this list of conditions and the following disclaimer.
119a4365d0SYoshinobu Inoue.\" 2. Redistributions in binary form must reproduce the above copyright
129a4365d0SYoshinobu Inoue.\"    notice, this list of conditions and the following disclaimer in the
139a4365d0SYoshinobu Inoue.\"    documentation and/or other materials provided with the distribution.
149a4365d0SYoshinobu Inoue.\" 3. Neither the name of the project nor the names of its contributors
159a4365d0SYoshinobu Inoue.\"    may be used to endorse or promote products derived from this software
169a4365d0SYoshinobu Inoue.\"    without specific prior written permission.
179a4365d0SYoshinobu Inoue.\"
189a4365d0SYoshinobu Inoue.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
199a4365d0SYoshinobu Inoue.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
209a4365d0SYoshinobu Inoue.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
219a4365d0SYoshinobu Inoue.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
229a4365d0SYoshinobu Inoue.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
239a4365d0SYoshinobu Inoue.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
249a4365d0SYoshinobu Inoue.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
259a4365d0SYoshinobu Inoue.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
269a4365d0SYoshinobu Inoue.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
279a4365d0SYoshinobu Inoue.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
289a4365d0SYoshinobu Inoue.\" SUCH DAMAGE.
299a4365d0SYoshinobu Inoue.\"
30*009d82eeSAndrey V. Elsukov.Dd October 21, 2018
319a4365d0SYoshinobu Inoue.Dt GIF 4
3212900fe3SJeroen Ruigrok van der Werven.Os
339a4365d0SYoshinobu Inoue.Sh NAME
349a4365d0SYoshinobu Inoue.Nm gif
35eb083802SRuslan Ermilov.Nd generic tunnel interface
369a4365d0SYoshinobu Inoue.Sh SYNOPSIS
37fe403d8dSBrooks Davis.Cd "device gif"
389a4365d0SYoshinobu Inoue.Sh DESCRIPTION
399a4365d0SYoshinobu InoueThe
409a4365d0SYoshinobu Inoue.Nm
415faba7efSRuslan Ermilovinterface is a generic tunnelling device for IPv4 and IPv6.
429a4365d0SYoshinobu InoueIt can tunnel IPv[46] traffic over IPv[46].
439a4365d0SYoshinobu InoueTherefore, there can be four possible configurations.
449a4365d0SYoshinobu InoueThe behavior of
459a4365d0SYoshinobu Inoue.Nm
4633841545SHajimu UMEMOTOis mainly based on RFC2893 IPv6-over-IPv4 configured tunnel.
4733841545SHajimu UMEMOTOOn
4833841545SHajimu UMEMOTO.Nx ,
4933841545SHajimu UMEMOTO.Nm
5033841545SHajimu UMEMOTOcan also tunnel ISO traffic over IPv[46] using EON encapsulation.
51bf11e8eaSGreg LeheyNote that
52bf11e8eaSGreg Lehey.Nm
53bf11e8eaSGreg Leheydoes not perform GRE encapsulation; use
54bf11e8eaSGreg Lehey.Xr gre 4
55bf11e8eaSGreg Leheyfor GRE encapsulation.
569a4365d0SYoshinobu Inoue.Pp
57601404ecSBrooks DavisEach
58f823d4a6SBrooks Davis.Nm
59601404ecSBrooks Davisinterface is created at runtime using interface cloning.
600787ca52SRuslan ErmilovThis is
61f823d4a6SBrooks Davismost easily done with the
62ace5be68SRuslan Ermilov.Dq Nm ifconfig Cm create
63601404ecSBrooks Daviscommand or using the
64d8d65971STom Rhodes.Va ifconfig_ Ns Aq Ar interface
65601404ecSBrooks Davisvariable in
66601404ecSBrooks Davis.Xr rc.conf 5 .
67f823d4a6SBrooks Davis.Pp
689a4365d0SYoshinobu InoueTo use
694b66483fSRuslan Ermilov.Nm ,
70f7560bd3STom Rhodesthe administrator needs to configure the protocol and addresses used for the outer
719a4365d0SYoshinobu Inoueheader.
729a4365d0SYoshinobu InoueThis can be done by using
734a9054abSHajimu UMEMOTO.Xr ifconfig 8
744a9054abSHajimu UMEMOTO.Cm tunnel ,
759a4365d0SYoshinobu Inoueor
769a4365d0SYoshinobu Inoue.Dv SIOCSIFPHYADDR
779a4365d0SYoshinobu Inoueioctl.
78f7560bd3STom RhodesThe administrator also needs to configure the protocol and addresses for the
79f7560bd3STom Rhodesinner header, with
809a4365d0SYoshinobu Inoue.Xr ifconfig 8 .
81f7560bd3STom RhodesNote that IPv6 link-local addresses
82f7560bd3STom Rhodes(those that start with
83c4d9468eSRuslan Ermilov.Li fe80:: )
84813ec9a8SMarc Fonvieillewill be automatically configured whenever possible.
85f7560bd3STom RhodesYou may need to remove IPv6 link-local addresses manually using
869a4365d0SYoshinobu Inoue.Xr ifconfig 8 ,
87f7560bd3STom Rhodesif you want to disable the use of IPv6 as the inner header
88f7560bd3STom Rhodes(for example, if you need a pure IPv4-over-IPv6 tunnel).
89f7560bd3STom RhodesFinally, you must modify the routing table to route the packets through the
909a4365d0SYoshinobu Inoue.Nm
919a4365d0SYoshinobu Inoueinterface.
929a4365d0SYoshinobu Inoue.Pp
93f7560bd3STom RhodesThe
949a4365d0SYoshinobu Inoue.Nm
955faba7efSRuslan Ermilovdevice can be configured to be ECN friendly.
969a4365d0SYoshinobu InoueThis can be configured by
979a4365d0SYoshinobu Inoue.Dv IFF_LINK1 .
989a4365d0SYoshinobu Inoue.Ss ECN friendly behavior
99f7560bd3STom RhodesThe
1009a4365d0SYoshinobu Inoue.Nm
1015faba7efSRuslan Ermilovdevice can be configured to be ECN friendly, as described in
102f6038661SJun-ichiro itojun Hagino.Dv draft-ietf-ipsec-ecn-02.txt .
103f7560bd3STom RhodesThis is turned off by default, and can be turned on by the
1049a4365d0SYoshinobu Inoue.Dv IFF_LINK1
1059a4365d0SYoshinobu Inoueinterface flag.
1069a4365d0SYoshinobu Inoue.Pp
1079a4365d0SYoshinobu InoueWithout
1089a4365d0SYoshinobu Inoue.Dv IFF_LINK1 ,
1099a4365d0SYoshinobu Inoue.Nm
110f7560bd3STom Rhodeswill show normal behavior, as described in RFC2893.
1119a4365d0SYoshinobu InoueThis can be summarized as follows:
1129a4365d0SYoshinobu Inoue.Bl -tag -width "Ingress" -offset indent
1139a4365d0SYoshinobu Inoue.It Ingress
1149a4365d0SYoshinobu InoueSet outer TOS bit to
1159a4365d0SYoshinobu Inoue.Dv 0 .
1169a4365d0SYoshinobu Inoue.It Egress
1179a4365d0SYoshinobu InoueDrop outer TOS bit.
1189a4365d0SYoshinobu Inoue.El
1199a4365d0SYoshinobu Inoue.Pp
1209a4365d0SYoshinobu InoueWith
1219a4365d0SYoshinobu Inoue.Dv IFF_LINK1 ,
1229a4365d0SYoshinobu Inoue.Nm
1239a4365d0SYoshinobu Inouewill copy ECN bits
124c4d9468eSRuslan Ermilov.Dv ( 0x02
1259a4365d0SYoshinobu Inoueand
1269a4365d0SYoshinobu Inoue.Dv 0x01
127c4d9468eSRuslan Ermilovon IPv4 TOS byte or IPv6 traffic class byte)
1289a4365d0SYoshinobu Inoueon egress and ingress, as follows:
1299a4365d0SYoshinobu Inoue.Bl -tag -width "Ingress" -offset indent
1309a4365d0SYoshinobu Inoue.It Ingress
1319a4365d0SYoshinobu InoueCopy TOS bits except for ECN CE
132c4d9468eSRuslan Ermilov(masked with
133c4d9468eSRuslan Ermilov.Dv 0xfe )
1349a4365d0SYoshinobu Inouefrom
1359a4365d0SYoshinobu Inoueinner to outer.
136c75526d5SRuslan ErmilovSet ECN CE bit to
1379a4365d0SYoshinobu Inoue.Dv 0 .
1389a4365d0SYoshinobu Inoue.It Egress
1399a4365d0SYoshinobu InoueUse inner TOS bits with some change.
1409a4365d0SYoshinobu InoueIf outer ECN CE bit is
1419a4365d0SYoshinobu Inoue.Dv 1 ,
1429a4365d0SYoshinobu Inoueenable ECN CE bit on the inner.
1439a4365d0SYoshinobu Inoue.El
1449a4365d0SYoshinobu Inoue.Pp
14533841545SHajimu UMEMOTONote that the ECN friendly behavior violates RFC2893.
146f6038661SJun-ichiro itojun HaginoThis should be used in mutual agreement with the peer.
147f6038661SJun-ichiro itojun Hagino.Ss Security
148f7560bd3STom RhodesA malicious party may try to circumvent security filters by using
149f6038661SJun-ichiro itojun Haginotunnelled packets.
150f6038661SJun-ichiro itojun HaginoFor better protection,
1519a4365d0SYoshinobu Inoue.Nm
152f7560bd3STom Rhodesperforms both martian and ingress filtering against the outer source address
153f6038661SJun-ichiro itojun Haginoon egress.
154f7560bd3STom RhodesNote that martian/ingress filters are in no way complete.
155f6038661SJun-ichiro itojun HaginoYou may want to secure your node by using packet filters.
156fc2857adSGleb SmirnoffIngress filtering can break tunnel operation in an asymmetrically
157fc2857adSGleb Smirnoffrouted network.
158fc2857adSGleb SmirnoffIt can be turned off by
15933841545SHajimu UMEMOTO.Dv IFF_LINK2
16033841545SHajimu UMEMOTObit.
161872f786aSBrooks Davis.Ss Miscellaneous
162d0f16f93SRuslan ErmilovBy default,
163872f786aSBrooks Davis.Nm
164872f786aSBrooks Davistunnels may not be nested.
165872f786aSBrooks DavisThis behavior may be modified at runtime by setting the
166872f786aSBrooks Davis.Xr sysctl 8
167872f786aSBrooks Davisvariable
168872f786aSBrooks Davis.Va net.link.gif.max_nesting
169872f786aSBrooks Davisto the desired level of nesting.
1709a4365d0SYoshinobu Inoue.Sh SEE ALSO
171bf11e8eaSGreg Lehey.Xr gre 4 ,
1729a4365d0SYoshinobu Inoue.Xr inet 4 ,
1739a4365d0SYoshinobu Inoue.Xr inet6 4 ,
1744a9054abSHajimu UMEMOTO.Xr ifconfig 8
175f6038661SJun-ichiro itojun Hagino.Rs
176f6038661SJun-ichiro itojun Hagino.%A R. Gilligan
177f6038661SJun-ichiro itojun Hagino.%A E. Nordmark
17833841545SHajimu UMEMOTO.%B RFC2893
179f6038661SJun-ichiro itojun Hagino.%T Transition Mechanisms for IPv6 Hosts and Routers
18033841545SHajimu UMEMOTO.%D August 2000
18112eab787SGlen Barber.%U http://tools.ietf.org/html/rfc2893
182f6038661SJun-ichiro itojun Hagino.Re
1839a4365d0SYoshinobu Inoue.Rs
1849a4365d0SYoshinobu Inoue.%A Sally Floyd
1859a4365d0SYoshinobu Inoue.%A David L. Black
1869a4365d0SYoshinobu Inoue.%A K. K. Ramakrishnan
1879a4365d0SYoshinobu Inoue.%T "IPsec Interactions with ECN"
188f6038661SJun-ichiro itojun Hagino.%D December 1999
189f6038661SJun-ichiro itojun Hagino.%O draft-ietf-ipsec-ecn-02.txt
1909a4365d0SYoshinobu Inoue.Re
1919a4365d0SYoshinobu Inoue.\"
1929a4365d0SYoshinobu Inoue.Sh HISTORY
1939a4365d0SYoshinobu InoueThe
1949a4365d0SYoshinobu Inoue.Nm
195f7560bd3STom Rhodesdevice first appeared in the WIDE hydrangea IPv6 kit.
196f6038661SJun-ichiro itojun Hagino.\"
197f6038661SJun-ichiro itojun Hagino.Sh BUGS
198f7560bd3STom RhodesThere are many tunnelling protocol specifications, all
1995faba7efSRuslan Ermilovdefined differently from each other.
2005faba7efSRuslan ErmilovThe
201f6038661SJun-ichiro itojun Hagino.Nm
2025faba7efSRuslan Ermilovdevice may not interoperate with peers which are based on different specifications,
203f6038661SJun-ichiro itojun Haginoand are picky about outer header fields.
204f6038661SJun-ichiro itojun HaginoFor example, you cannot usually use
205f6038661SJun-ichiro itojun Hagino.Nm
206f6038661SJun-ichiro itojun Haginoto talk with IPsec devices that use IPsec tunnel mode.
207f6038661SJun-ichiro itojun Hagino.Pp
20833841545SHajimu UMEMOTOIf the outer protocol is IPv4,
20933841545SHajimu UMEMOTO.Nm
21033841545SHajimu UMEMOTOdoes not try to perform path MTU discovery for the encapsulated packet
211c4d9468eSRuslan Ermilov(DF bit is set to 0).
21233841545SHajimu UMEMOTO.Pp
213f7560bd3STom RhodesIf the outer protocol is IPv6, path MTU discovery for encapsulated packets
21433841545SHajimu UMEMOTOmay affect communication over the interface.
21533841545SHajimu UMEMOTOThe first bigger-than-pmtu packet may be lost.
21633841545SHajimu UMEMOTOTo avoid the problem, you may want to set the interface MTU for
21733841545SHajimu UMEMOTO.Nm
218f7560bd3STom Rhodesto 1240 or smaller, when the outer header is IPv6 and the inner header is IPv4.
21933841545SHajimu UMEMOTO.Pp
220f7560bd3STom RhodesThe
22133841545SHajimu UMEMOTO.Nm
2225faba7efSRuslan Ermilovdevice does not translate ICMP messages for the outer header into the inner header.
22333841545SHajimu UMEMOTO.Pp
22433841545SHajimu UMEMOTOIn the past,
22533841545SHajimu UMEMOTO.Nm
22633841545SHajimu UMEMOTOhad a multi-destination behavior, configurable via
22733841545SHajimu UMEMOTO.Dv IFF_LINK0
22833841545SHajimu UMEMOTOflag.
229f7560bd3STom RhodesThe behavior is obsolete and is no longer supported.
230