1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
.\" $NetBSD: 6to4.8,v 1.4 2001/11/22 03:00:07 hubertf Exp $
.Dd February 18, 2001
.Dt 6to4 8
.Os
.Sh NAME
.Nm 6to4
.Nd setup automatic 6to4 IPv6 tunnelling
.Sh SYNOPSIS
.Nm
.Op Fl vn
.Ar command
.Sh DESCRIPTION
The
.Nm
script can be used to setup IPv6 on your home machine and
network for exploring IPv6 without any registrations. 6to4 is a
mechanism by which your IPv6 address(es) are derived from an assigned
IPv4 address, and which involves automatic tunnelling to one or more
remove 6to4 hubs, which will then forward your v6 packets on the 6bone
etc. Replies are routed back to you over IPv4 via (possibly) other
6to4 capable remote gateways. As such, IPv6-in-IPv4-encapsulated
packets are accepted from all v4-hosts.
.Pp
From your (single) IPv4 address, you get a whole IPv6 /48 network,
which allows you to split your network in 2^16 subnets, with 2^64
hosts each. You need to setup routing for your internal network
properly, help is provided for setting up the border router here.
.Pp
This script takes the burden to calculate your IPv6 address from
existing IPv4 address and runs the commands to setup (and tear down)
automatic 6to4 IPv6 tunnelling. In a seperate step, router
advertisement for the inside network can be started and stopped.
.Pp
Possible options are:
.Bl -tag -width xxx
.It Fl n
Do not. Only print the commands that would be run, but do not execute
them.
.It Fl v
Verbose operation. Print the commands that are about to be run, before
running them. Displays some additional information.
.It Fl h
Show usage.
.El
.Pp
Possible commands are:
.Bl -tag -width rtadvd-start
.It Sy start
Configure 6to4 IPv6. The
.Xr stf 4
interface is configured, and a default route to a remote 6to4
gateway is established. In addition, the internal
network interface is assigned an address.
.It Sy stop
Stops 6to4 IPv6. All addresses are removed from the
.Xr stf 4
device, and the default route is removed.
.It Sy rtadvd-start
Starts router advertizement and IPv6 packet forwarding,
turning the machine into a IPv6 router.
.Xr rtadvd 8
is invoked with a custom config file created under
.Pa /var/run .
Clients just need to be told to accept router advertizements, i.e.
the
.Sq net.inet6.ip6.accept_rtadv
sysctl needs to be set to
.Sq 1 .
You can arrange that by setting
.Dq ip6mode=autohost
in
.Pa /etc/rc.conf .
.It Sy rtadvd-stop
Stops router advertizement and IPv6 packet forwarding.
.Xr rtadvd 8
is stopped, and the
.Xr rtadvd.conf 5
config file is removed from
.Pa /var/run .
.El
.Sh REQUIREMENTS
Besides IPv4 connectivity, you need support for IPv6 and the
.Xr stf 4
device in your kernel. While the GENERIC NetBSD 1.5 kernel does
support IPv6, it does not contain support for the
.Xr stf 4
device.
.Pp
Make sure you have the following options in your kernel config file:
.Bd -literal -offset
options INET # IP + ICMP + TCP + UDP
options INET6 # IPV6
pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
.Ed
.Pp
In systems that run past-1.5 NetBSD-current, you will have to
explicitly create an
.Xr stf 4
device after compiling it in the kernel. You do this by running
the following command before calling the
.Nm
script:
.Bd -literal -offset
ifconfig stf0 create
.Ed
.Pp
No special values are needed in
.Pa /etc/rc.conf
to run this script, but see comment on setting up IPv6-clients
.Sq behind
your 6to4 router for the
.Sy rtadvd-start
command!
.Sh CONFIGURATION
The
.Nm
script reads it's configuration from a config file named
.Pa 6to4.conf.
The
.Pa 6to4.conf
file is in
.Xr perl 1
syntax, and contains several
variables that can be tuned to adjust your setup. Default values
should work for use on a modem dialup.
.Bl -tag -width rtadvd-stop
.It Sy out_if
The outbound interface that has a valid IPv4 address
assigned, that can be used to derive the IPv6
addresses from. Usually
.Dq ppp0
for a modem setup, or your ethernet interface if you have
IPv4 connectivity via LAN. This
can't be empty, and is assigned the IPv6 address
2002:x:x:v6_net:hostbits6, see below.
.It Sy in_if
The inside interface. If non-empty, this interface is
assigned the IPv6 address
2002:x:x:v6_innernet:hostbits6, see below.
This is only useful on machines that
have more than one network interfaces, e.g. with a modem and a
local ethernet.
.It Sy v6_net
The subnet address you want to use on the address of
your outbound interface. Defaults to
.Dq 1 .
.It Sy v6_innernet
The subnet address you want to use on the address of
your inbound interface. Defaults to
.Dq 2 .
.It Sy hostbits6
The lower 64 bits of both the inbound and outbound interface's
addresses.
.It Sy peer
Name of the remote 6to4 server that'll take our
IPv6-in-IPv4 encapsulated packets and route them on
via IPv6. A special value of
.Dq 6to4-anycast
can be used for the anycast service defined in RFC 3068.
Other possible values are given in the example config file.
.El
.Sh EXAMPLE USAGE
The
.Nm
script can be run automatically by
.Xr pppd 8
when a connection is made. For this, put the following into
.Pa /etc/ppp/ip-up :
.Bd -literal -offset
( /usr/pkg/sbin/6to4 stop
/usr/pkg/sbin/6to4 start ) &
.Ed
.Pp
To shut down properly, put this into
.Pa /etc/ppp/ip-down :
.Bd -literal -offset
/usr/pkg/sbin/6to4 stop
.Ed
.Sh SEE ALSO
.Xr stf 4 ,
.Dq 6to4 IPv6 Explained
at
.Pa http://www.feyrer.de/NetBSD/6to4.html ,
NetBSD IPv6 Documentation at
.Pa http://www.netbsd.org/Documentation/network/ipv6/ ,
RFC 3068.
.Sh HISTORY
The
.Nm
utility and manpage were written by
Hubert Feyrer <hubert@feyrer.de>.
.Sh BUGS
On systems running past-1.5 NetBSD-current, the
.Dq ifconfig stf0 create
should be run automatically.
|