]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/if_ipsec.4
MFC r304572 (by bz):
[FreeBSD/FreeBSD.git] / share / man / man4 / if_ipsec.4
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
34 The
35 .Cm if_ipsec
36 network interface is a part of the
37 .Fx
38 IPsec implementation.
39 To compile it into the kernel, place this line in the kernel
40 configuration file:
41 .Bd -ragged -offset indent
42 .Cd "options IPSEC"
43 .Ed
44 .Pp
45 It can also be loaded as part of the
46 .Cm ipsec
47 kernel module if the kernel was compiled with
48 .Bd -ragged -offset indent
49 .Cd "options IPSEC_SUPPORT"
50 .Ed
51 .Sh DESCRIPTION
52 The
53 .Nm
54 network interface is targeted for creating route-based VPNs.
55 It can tunnel IPv4 and IPv6 traffic over either IPv4 or IPv6 and secure
56 it with ESP.
57 .Pp
58 .Nm
59 interfaces are dynamically created and destroyed with the
60 .Xr ifconfig 8
61 .Cm create
62 and
63 .Cm destroy
64 subcommands.
65 The administrator must configure IPsec
66 .Cm tunnel
67 endpoint addresses.
68 These addresses will be used for the outer IP header of ESP packets.
69 The administrator can also configure the protocol and addresses for the inner
70 IP header with
71 .Xr ifconfig 8 ,
72 and modify the routing table to route the packets through the
73 .Nm
74 interface.
75 .Pp
76 When the
77 .Nm
78 interface is configured, it automatically creates special security policies.
79 These policies can be used to acquire security associations from the IKE daemon,
80 which are needed for establishing an IPsec tunnel.
81 It is also possible to create needed security associations manually with the
82 .Xr setkey 8
83 utility.
84 .Pp
85 Each
86 .Nm
87 interface has an additional numeric configuration option
88 .Cm reqid Ar id .
89 This
90 .Ar id
91 is used to distinguish traffic and security policies between several
92 .Nm
93 interfaces.
94 The
95 .Cm reqid
96 can be specified on interface creation and changed later.
97 If not specified, it is automatically assigned.
98 Note that changing
99 .Cm reqid
100 will lead to generation of new security policies, and this
101 may require creating new security associations.
102 .Sh EXAMPLES
103 The example below shows manual configuration of an IPsec tunnel
104 between two FreeBSD hosts.
105 Host A has the IP address 192.168.0.3, and host B has the IP address
106 192.168.0.5.
107 .Pp
108 On host A:
109 .Bd -literal -offset indent
110 ifconfig ipsec0 create reqid 100
111 ifconfig ipsec0 inet tunnel 192.168.0.3 192.168.0.5
112 ifconfig ipsec0 inet 172.16.0.3/16 172.16.0.5
113 setkey -c
114 add 192.168.0.3 192.168.0.5 esp 10000 -m tunnel -u 100 -E rijndael-cbc "VerySecureKey!!1";
115 add 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
119 On host B:
120 .Bd -literal -offset indent
121 ifconfig ipsec0 create reqid 200
122 ifconfig ipsec0 inet tunnel 192.168.0.5 192.168.0.3
123 ifconfig ipsec0 inet 172.16.0.5/16 172.16.0.3
124 setkey -c
125 add 192.168.0.3 192.168.0.5 esp 10000 -m tunnel -u 200 -E rijndael-cbc "VerySecureKey!!1";
126 add 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
130 Note the value 100 on host A and value 200 on host B are used as reqid.
131 The same value must be used as identifier of the policy entry in the
132 .Xr setkey 8
133 command.
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