1f6038661SJun-ichiro itojun Hagino.\" $FreeBSD$ 233841545SHajimu UMEMOTO.\" $KAME: gif.4,v 1.28 2001/05/18 13:15:56 itojun Exp $ 3f6038661SJun-ichiro itojun Hagino.\" 49a4365d0SYoshinobu Inoue.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 59a4365d0SYoshinobu Inoue.\" All rights reserved. 69a4365d0SYoshinobu Inoue.\" 79a4365d0SYoshinobu Inoue.\" Redistribution and use in source and binary forms, with or without 89a4365d0SYoshinobu Inoue.\" modification, are permitted provided that the following conditions 99a4365d0SYoshinobu Inoue.\" are met: 109a4365d0SYoshinobu Inoue.\" 1. Redistributions of source code must retain the above copyright 119a4365d0SYoshinobu Inoue.\" notice, this list of conditions and the following disclaimer. 129a4365d0SYoshinobu Inoue.\" 2. Redistributions in binary form must reproduce the above copyright 139a4365d0SYoshinobu Inoue.\" notice, this list of conditions and the following disclaimer in the 149a4365d0SYoshinobu Inoue.\" documentation and/or other materials provided with the distribution. 159a4365d0SYoshinobu Inoue.\" 3. Neither the name of the project nor the names of its contributors 169a4365d0SYoshinobu Inoue.\" may be used to endorse or promote products derived from this software 179a4365d0SYoshinobu Inoue.\" without specific prior written permission. 189a4365d0SYoshinobu Inoue.\" 199a4365d0SYoshinobu Inoue.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 209a4365d0SYoshinobu Inoue.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 219a4365d0SYoshinobu Inoue.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 229a4365d0SYoshinobu Inoue.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 239a4365d0SYoshinobu Inoue.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 249a4365d0SYoshinobu Inoue.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 259a4365d0SYoshinobu Inoue.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 269a4365d0SYoshinobu Inoue.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 279a4365d0SYoshinobu Inoue.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 289a4365d0SYoshinobu Inoue.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 299a4365d0SYoshinobu Inoue.\" SUCH DAMAGE. 309a4365d0SYoshinobu Inoue.\" 319a4365d0SYoshinobu Inoue.Dd April 10, 1999 329a4365d0SYoshinobu Inoue.Dt GIF 4 3312900fe3SJeroen Ruigrok van der Werven.Os 349a4365d0SYoshinobu Inoue.Sh NAME 359a4365d0SYoshinobu Inoue.Nm gif 36eb083802SRuslan Ermilov.Nd generic tunnel interface 379a4365d0SYoshinobu Inoue.Sh SYNOPSIS 38fe403d8dSBrooks Davis.Cd "device gif" 399a4365d0SYoshinobu Inoue.Sh DESCRIPTION 409a4365d0SYoshinobu InoueThe 419a4365d0SYoshinobu Inoue.Nm 429a4365d0SYoshinobu Inoueinterface is a generic tunnelling pseudo device for IPv4 and IPv6. 439a4365d0SYoshinobu InoueIt can tunnel IPv[46] traffic over IPv[46]. 449a4365d0SYoshinobu InoueTherefore, there can be four possible configurations. 459a4365d0SYoshinobu InoueThe behavior of 469a4365d0SYoshinobu Inoue.Nm 4733841545SHajimu UMEMOTOis mainly based on RFC2893 IPv6-over-IPv4 configured tunnel. 4833841545SHajimu UMEMOTOOn 4933841545SHajimu UMEMOTO.Nx , 5033841545SHajimu UMEMOTO.Nm 5133841545SHajimu UMEMOTOcan also tunnel ISO traffic over IPv[46] using EON encapsulation. 529a4365d0SYoshinobu Inoue.Pp 53f823d4a6SBrooks Davis.Nm 540787ca52SRuslan Ermilovinterfaces are allocated at runtime using interface cloning. 550787ca52SRuslan ErmilovThis is 56f823d4a6SBrooks Davismost easily done with the 57f823d4a6SBrooks Davis.Xr ifconfig 8 58f823d4a6SBrooks Davis.Cm create 59f823d4a6SBrooks Daviscommand. 60f823d4a6SBrooks Davis.Pp 619a4365d0SYoshinobu InoueTo use 624b66483fSRuslan Ermilov.Nm , 639a4365d0SYoshinobu Inoueadministrator needs to configure protocol and addresses used for the outer 649a4365d0SYoshinobu Inoueheader. 659a4365d0SYoshinobu InoueThis can be done by using 669a4365d0SYoshinobu Inoue.Xr gifconfig 8 , 679a4365d0SYoshinobu Inoueor 689a4365d0SYoshinobu Inoue.Dv SIOCSIFPHYADDR 699a4365d0SYoshinobu Inoueioctl. 709a4365d0SYoshinobu InoueAlso, administrator needs to configure protocol and addresses used for the 719a4365d0SYoshinobu Inoueinner header, by using 729a4365d0SYoshinobu Inoue.Xr ifconfig 8 . 739a4365d0SYoshinobu InoueNote that IPv6 link-local address 74c4d9468eSRuslan Ermilov(those start with 75c4d9468eSRuslan Ermilov.Li fe80:: ) 769a4365d0SYoshinobu Inouewill be automatically configured whenever possible. 779a4365d0SYoshinobu InoueYou may need to remove IPv6 link-local address manually using 789a4365d0SYoshinobu Inoue.Xr ifconfig 8 , 799a4365d0SYoshinobu Inouewhen you would like to disable the use of IPv6 as inner header 80c4d9468eSRuslan Ermilov(like when you need pure IPv4-over-IPv6 tunnel). 819a4365d0SYoshinobu InoueFinally, use routing table to route the packets toward 829a4365d0SYoshinobu Inoue.Nm 839a4365d0SYoshinobu Inoueinterface. 849a4365d0SYoshinobu Inoue.Pp 859a4365d0SYoshinobu Inoue.Nm 869a4365d0SYoshinobu Inouecan be configured to be ECN friendly. 879a4365d0SYoshinobu InoueThis can be configured by 889a4365d0SYoshinobu Inoue.Dv IFF_LINK1 . 899a4365d0SYoshinobu Inoue.Pp 909a4365d0SYoshinobu Inoue.Ss ECN friendly behavior 919a4365d0SYoshinobu Inoue.Nm 929a4365d0SYoshinobu Inouecan be configured to be ECN friendly, as described in 93f6038661SJun-ichiro itojun Hagino.Dv draft-ietf-ipsec-ecn-02.txt . 949a4365d0SYoshinobu InoueThis is turned off by default, and can be turned on by 959a4365d0SYoshinobu Inoue.Dv IFF_LINK1 969a4365d0SYoshinobu Inoueinterface flag. 979a4365d0SYoshinobu Inoue.Pp 989a4365d0SYoshinobu InoueWithout 999a4365d0SYoshinobu Inoue.Dv IFF_LINK1 , 1009a4365d0SYoshinobu Inoue.Nm 10133841545SHajimu UMEMOTOwill show a normal behavior, like described in RFC2893. 1029a4365d0SYoshinobu InoueThis can be summarized as follows: 1039a4365d0SYoshinobu Inoue.Bl -tag -width "Ingress" -offset indent 1049a4365d0SYoshinobu Inoue.It Ingress 1059a4365d0SYoshinobu InoueSet outer TOS bit to 1069a4365d0SYoshinobu Inoue.Dv 0 . 1079a4365d0SYoshinobu Inoue.It Egress 1089a4365d0SYoshinobu InoueDrop outer TOS bit. 1099a4365d0SYoshinobu Inoue.El 1109a4365d0SYoshinobu Inoue.Pp 1119a4365d0SYoshinobu InoueWith 1129a4365d0SYoshinobu Inoue.Dv IFF_LINK1 , 1139a4365d0SYoshinobu Inoue.Nm 1149a4365d0SYoshinobu Inouewill copy ECN bits 115c4d9468eSRuslan Ermilov.Dv ( 0x02 1169a4365d0SYoshinobu Inoueand 1179a4365d0SYoshinobu Inoue.Dv 0x01 118c4d9468eSRuslan Ermilovon IPv4 TOS byte or IPv6 traffic class byte) 1199a4365d0SYoshinobu Inoueon egress and ingress, as follows: 1209a4365d0SYoshinobu Inoue.Bl -tag -width "Ingress" -offset indent 1219a4365d0SYoshinobu Inoue.It Ingress 1229a4365d0SYoshinobu InoueCopy TOS bits except for ECN CE 123c4d9468eSRuslan Ermilov(masked with 124c4d9468eSRuslan Ermilov.Dv 0xfe ) 1259a4365d0SYoshinobu Inouefrom 1269a4365d0SYoshinobu Inoueinner to outer. 127c75526d5SRuslan ErmilovSet ECN CE bit to 1289a4365d0SYoshinobu Inoue.Dv 0 . 1299a4365d0SYoshinobu Inoue.It Egress 1309a4365d0SYoshinobu InoueUse inner TOS bits with some change. 1319a4365d0SYoshinobu InoueIf outer ECN CE bit is 1329a4365d0SYoshinobu Inoue.Dv 1 , 1339a4365d0SYoshinobu Inoueenable ECN CE bit on the inner. 1349a4365d0SYoshinobu Inoue.El 1359a4365d0SYoshinobu Inoue.Pp 13633841545SHajimu UMEMOTONote that the ECN friendly behavior violates RFC2893. 137f6038661SJun-ichiro itojun HaginoThis should be used in mutual agreement with the peer. 1389a4365d0SYoshinobu Inoue.Pp 139f6038661SJun-ichiro itojun Hagino.Ss Security 140f6038661SJun-ichiro itojun HaginoMalicious party may try to circumvent security filters by using 141f6038661SJun-ichiro itojun Haginotunnelled packets. 142f6038661SJun-ichiro itojun HaginoFor better protection, 1439a4365d0SYoshinobu Inoue.Nm 144f6038661SJun-ichiro itojun Haginoperforms martian filter and ingress filter against outer source address, 145f6038661SJun-ichiro itojun Haginoon egress. 146f6038661SJun-ichiro itojun HaginoNote that martian/ingress filters are no way complete. 147f6038661SJun-ichiro itojun HaginoYou may want to secure your node by using packet filters. 14833841545SHajimu UMEMOTOIngress filter can be turned off by 14933841545SHajimu UMEMOTO.Dv IFF_LINK2 15033841545SHajimu UMEMOTObit. 1519a4365d0SYoshinobu Inoue.\" 1529a4365d0SYoshinobu Inoue.Sh SEE ALSO 1539a4365d0SYoshinobu Inoue.Xr inet 4 , 1549a4365d0SYoshinobu Inoue.Xr inet6 4 , 155f6038661SJun-ichiro itojun Hagino.Xr gifconfig 8 156f6038661SJun-ichiro itojun Hagino.Rs 157f6038661SJun-ichiro itojun Hagino.%A R. Gilligan 158f6038661SJun-ichiro itojun Hagino.%A E. Nordmark 15933841545SHajimu UMEMOTO.%B RFC2893 160f6038661SJun-ichiro itojun Hagino.%T Transition Mechanisms for IPv6 Hosts and Routers 16133841545SHajimu UMEMOTO.%D August 2000 16233841545SHajimu UMEMOTO.%O ftp://ftp.isi.edu/in-notes/rfc2893.txt 163f6038661SJun-ichiro itojun Hagino.Re 1649a4365d0SYoshinobu Inoue.Rs 1659a4365d0SYoshinobu Inoue.%A Sally Floyd 1669a4365d0SYoshinobu Inoue.%A David L. Black 1679a4365d0SYoshinobu Inoue.%A K. K. Ramakrishnan 1689a4365d0SYoshinobu Inoue.%T "IPsec Interactions with ECN" 169f6038661SJun-ichiro itojun Hagino.%D December 1999 170f6038661SJun-ichiro itojun Hagino.%O draft-ietf-ipsec-ecn-02.txt 1719a4365d0SYoshinobu Inoue.Re 1729a4365d0SYoshinobu Inoue.\" 1739a4365d0SYoshinobu Inoue.Sh HISTORY 1749a4365d0SYoshinobu InoueThe 1759a4365d0SYoshinobu Inoue.Nm 1769a4365d0SYoshinobu Inouedevice first appeared in WIDE hydrangea IPv6 kit. 177f6038661SJun-ichiro itojun Hagino.\" 178f6038661SJun-ichiro itojun Hagino.Sh BUGS 179f6038661SJun-ichiro itojun HaginoThere are many tunnelling protocol specifications, 180f6038661SJun-ichiro itojun Haginodefined differently from each other. 181f6038661SJun-ichiro itojun Hagino.Nm 182f6038661SJun-ichiro itojun Haginomay not interoperate with peers which are based on different specifications, 183f6038661SJun-ichiro itojun Haginoand are picky about outer header fields. 184f6038661SJun-ichiro itojun HaginoFor example, you cannot usually use 185f6038661SJun-ichiro itojun Hagino.Nm 186f6038661SJun-ichiro itojun Haginoto talk with IPsec devices that use IPsec tunnel mode. 187f6038661SJun-ichiro itojun Hagino.Pp 188f6038661SJun-ichiro itojun HaginoThe current code does not check if the ingress address 189c4d9468eSRuslan Ermilov(outer source address) 190f6038661SJun-ichiro itojun Haginoconfigured to 191f6038661SJun-ichiro itojun Hagino.Nm 192f6038661SJun-ichiro itojun Haginomakes sense. 193f6038661SJun-ichiro itojun HaginoMake sure to configure an address which belongs to your node. 194f6038661SJun-ichiro itojun HaginoOtherwise, your node will not be able to receive packets from the peer, 195f6038661SJun-ichiro itojun Haginoand your node will generate packets with a spoofed source address. 196f6038661SJun-ichiro itojun Hagino.Pp 19733841545SHajimu UMEMOTOIf the outer protocol is IPv4, 19833841545SHajimu UMEMOTO.Nm 19933841545SHajimu UMEMOTOdoes not try to perform path MTU discovery for the encapsulated packet 200c4d9468eSRuslan Ermilov(DF bit is set to 0). 20133841545SHajimu UMEMOTO.Pp 20233841545SHajimu UMEMOTOIf the outer protocol is IPv6, path MTU discovery for encapsulated packet 20333841545SHajimu UMEMOTOmay affect communication over the interface. 20433841545SHajimu UMEMOTOThe first bigger-than-pmtu packet may be lost. 20533841545SHajimu UMEMOTOTo avoid the problem, you may want to set the interface MTU for 20633841545SHajimu UMEMOTO.Nm 20733841545SHajimu UMEMOTOto 1240 or smaller, when outer header is IPv6 and inner header is IPv4. 20833841545SHajimu UMEMOTO.Pp 20933841545SHajimu UMEMOTO.Nm 21033841545SHajimu UMEMOTOdoes not translate ICMP messages for outer header into inner header. 21133841545SHajimu UMEMOTO.Pp 21233841545SHajimu UMEMOTOIn the past, 21333841545SHajimu UMEMOTO.Nm 21433841545SHajimu UMEMOTOhad a multi-destination behavior, configurable via 21533841545SHajimu UMEMOTO.Dv IFF_LINK0 21633841545SHajimu UMEMOTOflag. 21733841545SHajimu UMEMOTOThe behavior was obsoleted and is no longer supported. 218