The gif interface is a generic tunnelling device for IPv4 and IPv6. It can tunnel IPv traffic over IPv. Therefore, there can be four possible configurations. The behavior of gif is mainly based on RFC2893 IPv6-over-IPv4 configured tunnel. On
.Nx , gif can also tunnel ISO traffic over IPv using EON encapsulation. Note that gif does not perform GRE encapsulation; use gre(4) for GRE encapsulation.
Each gif interface is created at runtime using interface cloning. This is most easily done with the "ifconfig create" command or using the ifconfig_<interface> variable in rc.conf(5).
To use gif, the administrator needs to configure the protocol and addresses used for the outer header. This can be done by using ifconfig(8) tunnel, or SIOCSIFPHYADDR ioctl. The administrator also needs to configure the protocol and addresses for the inner header, with ifconfig(8). Note that IPv6 link-local addresses (those that start with fe80::) will be automatically configured whenever possible. You may need to remove IPv6 link-local addresses manually using ifconfig(8), 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 gif interface.
The gif device can be configured to be ECN friendly. This can be configured by IFF_LINK1.
ECN friendly behavior
The gif device can be configured to be ECN friendly, as described in draft-ietf-ipsec-ecn-02.txt. This is turned off by default, and can be turned on by the IFF_LINK1 interface flag.
Without IFF_LINK1, gif will show normal behavior, as described in RFC2893. This can be summarized as follows: