xref: /freebsd/share/man/man4/if_ipsec.4 (revision 780fb4a2)
1.\" Copyright (c) 2017 Andrey V. Elsukov <ae@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd February 6, 2017
28.Dt if_ipsec 4
29.Os
30.Sh NAME
31.Nm if_ipsec
32.Nd IPsec virtual tunneling interface
33.Sh SYNOPSIS
34The
35.Cm if_ipsec
36network interface is a part of the
37.Fx
38IPsec implementation.
39To compile it into the kernel, place this line in the kernel
40configuration file:
41.Bd -ragged -offset indent
42.Cd "options IPSEC"
43.Ed
44.Pp
45It can also be loaded as part of the
46.Cm ipsec
47kernel module if the kernel was compiled with
48.Bd -ragged -offset indent
49.Cd "options IPSEC_SUPPORT"
50.Ed
51.Sh DESCRIPTION
52The
53.Nm
54network interface is targeted for creating route-based VPNs.
55It can tunnel IPv4 and IPv6 traffic over either IPv4 or IPv6 and secure
56it with ESP.
57.Pp
58.Nm
59interfaces are dynamically created and destroyed with the
60.Xr ifconfig 8
61.Cm create
62and
63.Cm destroy
64subcommands.
65The administrator must configure IPsec
66.Cm tunnel
67endpoint addresses.
68These addresses will be used for the outer IP header of ESP packets.
69The administrator can also configure the protocol and addresses for the inner
70IP header with
71.Xr ifconfig 8 ,
72and modify the routing table to route the packets through the
73.Nm
74interface.
75.Pp
76When the
77.Nm
78interface is configured, it automatically creates special security policies.
79These policies can be used to acquire security associations from the IKE daemon,
80which are needed for establishing an IPsec tunnel.
81It is also possible to create needed security associations manually with the
82.Xr setkey 8
83utility.
84.Pp
85Each
86.Nm
87interface has an additional numeric configuration option
88.Cm reqid Ar id .
89This
90.Ar id
91is used to distinguish traffic and security policies between several
92.Nm
93interfaces.
94The
95.Cm reqid
96can be specified on interface creation and changed later.
97If not specified, it is automatically assigned.
98Note that changing
99.Cm reqid
100will lead to generation of new security policies, and this
101may require creating new security associations.
102.Sh EXAMPLES
103The example below shows manual configuration of an IPsec tunnel
104between two FreeBSD hosts.
105Host A has the IP address 192.168.0.3, and host B has the IP address
106192.168.0.5.
107.Pp
108On host A:
109.Bd -literal -offset indent
110ifconfig ipsec0 create reqid 100
111ifconfig ipsec0 inet tunnel 192.168.0.3 192.168.0.5
112ifconfig ipsec0 inet 172.16.0.3/16 172.16.0.5
113setkey -c
114add 192.168.0.3 192.168.0.5 esp 10000 -m tunnel -u 100 -E rijndael-cbc "VerySecureKey!!1";
115add 192.168.0.5 192.168.0.3 esp 10001 -m tunnel -u 100 -E rijndael-cbc "VerySecureKey!!2";
116^D
117.Ed
118.Pp
119On host B:
120.Bd -literal -offset indent
121ifconfig ipsec0 create reqid 200
122ifconfig ipsec0 inet tunnel 192.168.0.5 192.168.0.3
123ifconfig ipsec0 inet 172.16.0.5/16 172.16.0.3
124setkey -c
125add 192.168.0.3 192.168.0.5 esp 10000 -m tunnel -u 200 -E rijndael-cbc "VerySecureKey!!1";
126add 192.168.0.5 192.168.0.3 esp 10001 -m tunnel -u 200 -E rijndael-cbc "VerySecureKey!!2";
127^D
128.Ed
129.Pp
130Note the value 100 on host A and value 200 on host B are used as reqid.
131The same value must be used as identifier of the policy entry in the
132.Xr setkey 8
133command.
134.Sh SEE ALSO
135.Xr gif 4 ,
136.Xr gre 4 ,
137.Xr ipsec 4 ,
138.Xr ifconfig 8 ,
139.Xr setkey 8
140.Sh AUTHORS
141.An Andrey V. Elsukov Aq Mt ae@FreeBSD.org
142