1.\" $FreeBSD: src/usr.sbin/gifconfig/gifconfig.8,v 1.1.2.11 2003/03/11 21:13:49 trhodes Exp $ 2.\" $DragonFly: src/usr.sbin/gifconfig/gifconfig.8,v 1.4 2006/03/01 08:08:45 swildner Exp $ 3.\" $KAME: gifconfig.8,v 1.6 2000/11/22 11:10:09 itojun Exp $ 4.\" 5.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6.\" All rights reserved. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. Neither the name of the project nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.Dd May 17, 1998 33.Dt GIFCONFIG 8 34.Os 35.Sh NAME 36.Nm gifconfig 37.Nd configure generic IP tunnel 38.\" 39.Sh SYNOPSIS 40.Nm 41.Ar interface 42.Op Ar af 43.Op Ar physsrc physdest 44.Nm 45.Ar interface 46.Ic delete 47.Nm 48.Fl a 49.Sh DESCRIPTION 50The 51.Nm 52utility configures the physical address for the generic IP tunnel 53interface, such as "gif0". 54Argument 55.Ar physsrc 56and 57.Ar physdest 58are interpreted as the outer source/destination address for 59encapsulating IPv4/v6 header. 60Argument 61.Ar af 62specifies the address family for 63.Ar physsrc 64and 65.Ar physdest . 66.Ar af 67can be 68.Li inet 69or 70.Li inet6 , 71and will be treated as 72.Li inet 73if ommitted. 74.Pp 75If a special argument 76.Ic delete 77is specified, 78.Nm 79just deletes the existing source and destination addresses on 80.Ar interface . 81If no outer addresses are specified, this usage has no effect. 82.Pp 83The 84.Nm 85utility takes the following optional argument: 86.Bl -tag -width Ds 87.It Fl a 88Display information associated with all 89.Xr gif 4 90interfaces. 91.El 92.Pp 93Please note that it is very easy to create infinite routing loop, 94when you configure tunnel over same address family 95(e.g. IPv4-over-IPv4). 96.Pp 97Each 98.Xr gif 4 99interface is created at runtime using interface cloning. 100This is 101most easily done with the 102.Xr ifconfig 8 103.Cm create 104command or using the 105.Va gifconfig_ Ns Aq Ar interface 106variable in 107.Xr rc.conf 5 . 108.Sh EXAMPLES 109If you would like to configure IPv6 over IPv4 110(aka IPv6 in IPv4) 111tunnel between 112.Li 10.1.1.1 113and 114.Li 10.2.3.4 , 115you should perform the following command: 116.Bd -literal -offset 117# gifconfig gif0 inet 10.1.1.1 10.2.3.4 118.Ed 119.Pp 120.\" To use the 121.\" .Li 0.0.0.0 122.\" feature to establish a tunnel from host1 to host3 123.\" which will encapsulate and carry packets from host2, on host1 do: 124.\" .Bd -literal -offset 125.\" # ifconfig gif0 inet host1 127.0.0.2 # assign an address to gif0 126.\" # gifconfig gif0 inet host1 0.0.0.0 # assign encapsulation addresses 127.\" # route add host2 host3 -ifp gif0: # encap host2 packets, send to host3 128.\" .Ed 129.\" .Pp 130.\" Note: the 131.\" .Fl ifp 132.\" option to route does not work as documented in 133.\" most versions of FreeBSD. 134.\" .Pp 135.\" On host3 do: 136.\" .Bd -literal -offset 137.\" # ifconfig gif0 inet host3 127.0.0.2 # assign an address to gif0 138.\" # gifconfig gif0 inet host3 0.0.0.0 # assign encapsulation addresses 139.\" .Ed 140.\" .Pp 141.\" Now if you ping host2 from host1, the packets should be encapsulated 142.\" with outer source address = host1 and outer destination address = host3, 143.\" and delivered to host3. 144.\" host3 will decapsulate the packet and deliver it normally to host2. 145.\" .Pp 146This is also possible to use IPv6 as outer proto, by replacing 147.Li inet 148to 149.Li inet6 , 150and IPv4 addresses to some appropriate IPv6 addresses in above example. 151.Sh DIAGNOSTICS 152The command exits with exit status of 1 on errors, 0 on success. 153.Sh SEE ALSO 154.Xr gif 4 , 155.Xr ifconfig 8 156.Sh HISTORY 157The 158.Nm 159utility first appeared in WIDE Hydrangea IPv6 protocol stack kit. 160.Pp 161IPv6 and IPsec support based on the KAME Project (http://www.kame.net/) stack 162was initially integrated into 163.Fx 4.0 164