xref: /netbsd-src/share/man/man4/stf.4 (revision 08c81a9c2dc8c7300e893321eb65c0925d60871c)
1.\"     $NetBSD: stf.4,v 1.16 2002/06/20 09:12:08 itojun Exp $
2.\"     $KAME: stf.4,v 1.38 2002/06/20 09:11:33 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 April 27, 2001
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 stf
55interface may be created.
56.Pp
57For ordinary nodes in 6to4 site, you do not need
58.Nm
59interface.
60The
61.Nm
62interface is necessary for site border router
63.Po
64called
65.Dq 6to4 router
66in the specification
67.Pc .
68.Pp
69Due to the way 6to4 protocol is specified,
70.Nm
71interface requires certain configuration to work properly.
72Single
73.Pq no more than 1
74valid 6to4 address needs to be configured to 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 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 a hexadecimal notation of an IPv4 address for the node.
88IPv4 address can be taken from any of interfaces 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 certain IPv4 prefix,
104you may want to configure IPv6 prefix length as
105.Dq 16 + IPv4 prefix length .
106.Nm
107interface will check the IPv4 source address on packets,
108if the IPv6 prefix length is larger than 16.
109.Pp
110.Nm
111can be configured to be ECN friendly.
112This can be configured by
113.Dv IFF_LINK1 .
114See
115.Xr gif 4
116for details.
117.Pp
118Please note that 6to4 specification is written as
119.Dq accept tunnelled packet from everyone
120tunnelling device.
121By enabling
122.Nm
123device, you are making it much easier for malicious parties to inject
124fabricated IPv6 packet to your node.
125Also, malicious party can inject an IPv6 packet with fabricated source address
126to make your node generate improper tunnelled packet.
127Administrators must take caution when enabling the interface.
128To prevent possible attacks,
129.Nm
130interface filters out the following packets.
131Note that the checks are no way complete:
132.Bl -bullet
133.It
134Packets with IPv4 unspecified address as outer IPv4 source/destination
135.Pq Li 0.0.0.0/8
136.It
137Packets with loopback address as outer IPv4 source/destination
138.Pq Li 127.0.0.0/8
139.It
140Packets with IPv4 multicast address as outer IPv4 source/destination
141.Pq Li 224.0.0.0/4
142.It
143Packets with limited broadcast address as outer IPv4 source/destination
144.Pq Li 255.0.0.0/8
145.It
146Packets with private address as outer IPv4 source/destination
147.Pq Li 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
148.It
149Packets with subnet broadcast address as outer IPv4 source/destination.
150The check is made against subnet broadcast addresses for
151all of the directly connected subnets.
152.It
153Packets that does not pass ingress filtering.
154Outer IPv4 source address must meet the IPv4 topology on the routing table.
155Ingress filter can be turned off by
156.Dv IFF_LINK2
157bit.
158.It
159The same set of rules are applied against the IPv4 address embedded into
160inner IPv6 address, if the IPv6 address matches 6to4 prefix.
161.El
162.Pp
163It is recommended to filter/audit
164incoming IPv4 packet with IP protocol number 41, as necessary.
165It is also recommended to filter/audit encapsulated IPv6 packets as well.
166You may also want to run normal ingress filter against inner IPv6 address
167to avoid spoofing.
168.Pp
169By setting the
170.Dv IFF_LINK0
171flag on the
172.Nm
173interface, it is possible to disable the input path,
174making the direct attacks from the outside impossible.
175Note, however, there are other security risks exist.
176If you wish to use the configuration,
177you must not advertise your 6to4 address to others.
178.\"
179.Sh EXAMPLES
180Note that
181.Li 8504:0506
182is equal to
183.Li 133.4.5.6 ,
184written in hexadecimals.
185.Bd -literal
186# ifconfig ne0 inet 133.4.5.6 netmask 0xffffff00
187# ifconfig stf0 create inet6 2002:8504:0506:0000:a00:5aff:fe38:6f86 \\
188	prefixlen 16 alias
189.Ed
190.Pp
191The following configuration accepts packets from IPv4 source
192.Li 9.1.0.0/16
193only.
194It emits 6to4 packet only for IPv6 destination 2002:0901::/32
195.Pq IPv4 destination will match Li 9.1.0.0/16 .
196.Bd -literal
197# ifconfig ne0 inet 9.1.2.3 netmask 0xffff0000
198# ifconfig stf0 create inet6 2002:0901:0203:0000:a00:5aff:fe38:6f86 \\
199	prefixlen 32 alias
200.Ed
201.Pp
202The following configuration uses the
203.Nm
204interface as an output-only device.
205You need to have alternative IPv6 connectivity
206.Pq other than 6to4
207to use this configuration.
208For outbound traffic, you can reach other 6to4 networks efficiently via
209.Nm stf .
210For inbound traffic, you will not receive any 6to4-tunneled packets
211.Pq less security drawbacks .
212Be careful not to advertise your 6to4 prefix to others
213.Pq Li 2002:8504:0506::/48 ,
214and not to use your 6to4 prefix as a source.
215.Bd -literal
216# ifconfig ne0 inet 133.4.5.6 netmask 0xffffff00
217# ifconfig stf0 create inet6 2002:8504:0506:0000:a00:5aff:fe38:6f86 \\
218	prefixlen 16 alias deprecated link0
219# route add -inet6 2002:: -prefixlen 16 ::1 -ifp stf0
220.Ed
221.\"
222.Sh SEE ALSO
223.Xr gif 4 ,
224.Xr inet 4 ,
225.Xr inet6 4
226.Pp
227.Pa http://www.6bone.net/6bone_6to4.html
228.Rs
229.%A Brian Carpenter
230.%A Keith Moore
231.%T "Connection of IPv6 Domains via IPv4 Clouds"
232.%D February 2001
233.%R RFC
234.%N 3056
235.Re
236.Rs
237.%A Jun-ichiro itojun Hagino
238.%T "Possible abuse against IPv6 transition technologies"
239.%D July 2000
240.%N draft-itojun-ipv6-transition-abuse-01.txt
241.%O work in progress
242.Re
243.\"
244.Sh HISTORY
245The
246.Nm
247device first appeared in WIDE/KAME IPv6 stack.
248.\"
249.Sh BUGS
250No more than one
251.Nm
252interface is allowed for a node,
253and no more than one IPv6 interface address is allowed for an
254.Nm
255interface.
256It is to avoid source address selection conflicts
257between IPv6 layer and IPv4 layer,
258and to cope with ingress filtering rule on the other side.
259This is a feature to make
260.Nm
261work right for all occasions.
262