xref: /netbsd-src/share/man/man4/stf.4 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"     $NetBSD: stf.4,v 1.21 2006/06/17 04:58:14 reed Exp $
2.\"     $KAME: stf.4,v 1.39 2002/11/17 19:34:02 itojun Exp $
3.\"
4.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the project nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.Dd March 24, 2004
32.Dt STF 4
33.Os
34.Sh NAME
35.Nm stf
36.Nd 6to4 tunnel interface
37.Sh SYNOPSIS
38.Cd "pseudo-device stf"
39.Sh DESCRIPTION
40The
41.Nm
42interface supports
43.Dq 6to4
44IPv6 in IPv4 encapsulation.
45It can tunnel IPv6 traffic over IPv4, as specified in
46.Li RFC3056 .
47.Nm
48interfaces are dynamically created and destroyed with the
49.Xr ifconfig 8
50.Cm create
51and
52.Cm destroy
53subcommands.  Only one
54.Nm
55interface may be created.
56.Pp
57For ordinary nodes in 6to4 sites, you do not need a
58.Nm
59interface.
60The
61.Nm
62interface is only necessary on the site border router
63.Po
64called the
65.Dq 6to4 router
66in the specification
67.Pc .
68.Pp
69Due to the way the 6to4 protocol is specified,
70.Nm
71interfaces require certain configuration to work properly.
72A single
73.Pq no more than one
74valid 6to4 address needs to be configured on the interface.
75.Dq A valid 6to4 address
76is an address which has the following properties.
77If any of the following properties are not satisfied,
78.Nm stf
79raises a runtime error on packet transmission.
80Read the specification for more details.
81.Bl -bullet
82.It
83matches
84.Li 2002:xxyy:zzuu::/48 ,
85where
86.Li xxyy:zzuu
87is the hexadecimal notation of an IPv4 address for the node.
88The IPv4 address used can be taken from any interface your node has.
89Since the specification forbids the use of IPv4 private address,
90the address needs to be a global IPv4 address.
91.It
92Subnet identifier portion
93.Pq 48th to 63rd bit
94and interface identifier portion
95.Pq lower 64 bits
96are properly filled to avoid address collisions.
97.El
98.Pp
99If you would like the node to behave as a relay router,
100the prefix length for the IPv6 interface address needs to be 16 so that
101the node would consider any 6to4 destination as
102.Dq on-link .
103If you would like to restrict 6to4 peers to be inside a certain IPv4 prefix,
104you may want to configure the IPv6 prefix length to be
105.Dq 16 + IPv4 prefix length .
106The
107.Nm
108interface will check the IPv4 source address on packets
109if the IPv6 prefix length is larger than 16.
110.Pp
111.Nm
112can be configured to be ECN (Explicit Congestion Notification) friendly.
113This can be configured by
114.Dv IFF_LINK1 .
115See
116.Xr gif 4
117for details.
118.Pp
119Please note that the 6to4 specification is written as an
120.Dq accept tunneled packet from everyone
121tunneling device.
122By enabling the
123.Nm
124device, you are making it much easier for malicious parties to inject
125fabricated IPv6 packets to your node.
126Also, malicious parties can inject IPv6 packets with fabricated source addresses
127to make your node generate improper tunneled packets.
128Administrators must be cautious when enabling the interface.
129To prevent possible attacks, the
130.Nm
131interface filters out the following packets (note that the checks are
132in no way complete):
133.Bl -bullet
134.It
135Packets with IPv4 unspecified addresses as outer IPv4 source/destination
136.Pq Li 0.0.0.0/8
137.It
138Packets with the loopback address as outer IPv4 source/destination
139.Pq Li 127.0.0.0/8
140.It
141Packets with IPv4 multicast addresses as outer IPv4 source/destination
142.Pq Li 224.0.0.0/4
143.It
144Packets with limited broadcast addresses as outer IPv4 source/destination
145.Pq Li 255.0.0.0/8
146.It
147Packets with private addresses as outer IPv4 source/destination
148.Pq Li 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
149.It
150Packets with IPv4 link-local addresses as outer IPv4 source/destination
151.Pq Li 169.254.0.0/16
152.It
153Packets with subnet broadcast addresses as outer IPv4 source/destination.
154The check is made against subnet broadcast addresses for
155all of the directly connected subnets.
156.It
157Packets that do not pass ingress filtering.
158Outer IPv4 source addresses must meet the IPv4 topology on the routing table.
159Ingress filtering can be turned off by
160.Dv IFF_LINK2
161bit.
162.It
163The same set of rules are applied against the IPv4 address embedded into
164the inner IPv6 address, if the IPv6 address matches the 6to4 prefix.
165.It
166Packets with site-local or link-local unicast addresses as
167inner IPv6 source/destination
168.It
169Packets with node-local or link-local multicast addresses as
170inner IPv6 source/destination
171.El
172.Pp
173It is recommended to filter/audit
174incoming IPv4 packets with IP protocol number 41, as necessary.
175It is also recommended to filter/audit encapsulated IPv6 packets as well.
176You may also want to run normal ingress filtering against inner IPv6 addresses
177to avoid spoofing.
178.Pp
179By setting the
180.Dv IFF_LINK0
181flag on the
182.Nm
183interface, it is possible to disable the input path,
184making direct attacks from the outside impossible.
185Note, however, that other security risks exist.
186If you wish to use the configuration,
187you must not advertise your 6to4 addresses to others.
188.\"
189.Sh EXAMPLES
190Note that
191.Li 8504:0506
192is equal to
193.Li 133.4.5.6 ,
194written in hexadecimal.
195.Bd -literal
196# ifconfig ne0 inet 133.4.5.6 netmask 0xffffff00
197# ifconfig stf0 create inet6 2002:8504:0506:0000:a00:5aff:fe38:6f86 \\
198	prefixlen 16 alias
199.Ed
200.Pp
201The following configuration accepts packets from IPv4 source address
202.Li 9.1.0.0/16
203only.
204It emits 6to4 packets only for IPv6 destination 2002:0901::/32
205.Pq IPv4 destination will match Li 9.1.0.0/16 .
206.Bd -literal
207# ifconfig ne0 inet 9.1.2.3 netmask 0xffff0000
208# ifconfig stf0 create inet6 2002:0901:0203:0000:a00:5aff:fe38:6f86 \\
209	prefixlen 32 alias
210.Ed
211.Pp
212The following configuration uses the
213.Nm
214interface as an output-only device.
215You need to have alternative IPv6 connectivity
216.Pq other than 6to4
217to use this configuration.
218For outbound traffic, you can reach other 6to4 networks efficiently via
219.Nm stf .
220For inbound traffic, you will not receive any 6to4-tunneled packets
221.Pq less security drawbacks .
222Be careful not to advertise your 6to4 prefix to others
223.Pq Li 2002:8504:0506::/48 ,
224and not to use your 6to4 prefix as a source address.
225.Bd -literal
226# ifconfig ne0 inet 133.4.5.6 netmask 0xffffff00
227# ifconfig stf0 create inet6 2002:8504:0506:0000:a00:5aff:fe38:6f86 \\
228	prefixlen 16 alias deprecated link0
229# route add -inet6 2002:: -prefixlen 16 ::1 -ifp stf0
230.Ed
231.\"
232.Sh SEE ALSO
233.Xr gif 4 ,
234.Xr inet 4 ,
235.Xr inet6 4
236.Pp
237.Pa http://www.6bone.net/6bone_6to4.html
238.Rs
239.%A Brian Carpenter
240.%A Keith Moore
241.%T "Connection of IPv6 Domains via IPv4 Clouds"
242.%D February 2001
243.%R RFC
244.%N 3056
245.Re
246.Rs
247.%A F. Baker
248.%A P. Savola
249.%T "Ingress Filtering for Multihomed Networks"
250.%D March 2004
251.%R RFC
252.%N 3704
253.Re
254.Rs
255.%A Jun-ichiro itojun Hagino
256.%T "Possible abuse against IPv6 transition technologies"
257.%D July 2000
258.%N draft-itojun-ipv6-transition-abuse-01.txt
259.%O work in progress
260.Re
261.\"
262.Sh HISTORY
263The
264.Nm
265device first appeared in WIDE/KAME IPv6 stack.
266.\"
267.Sh BUGS
268No more than one
269.Nm
270interface is allowed for a node,
271and no more than one IPv6 interface address is allowed for an
272.Nm
273interface.
274This is to avoid source address selection conflicts
275between the IPv6 layer and the IPv4 layer,
276and to cope with ingress filtering rules on the other side.
277This is a feature to make
278.Nm
279work right for all occasions.
280