This page is being developed, and we welcome any comments or suggestions.
IPv6 code was merged into NetBSD in June 1999, and is part of NetBSD. IPv6 configuration is mostly the same as IPv4 configuration, so you may want to check the documentation for IPv4 networking.
The GENERIC kernel configuration enables IPv6 support by default for most of the architectures (ports). Userland code includes IPv6 support where possible, by default, so no rebuild of userland is necessary even if you switch between an IPv4-only kernel and an IPv4/v6 kernel.
Around 1992, the IETF became aware of a global shortage of IPv4 addresses, and technical obstacles in deploying new protocols due to limitations imposed by IPv4. An IPng (IP next generation) effort was started to solve these issues. The discussion is outlined in a bunch of RFCs, starting from RFC1550. After a large amount of discussion, around 1995, IPv6 (IP version 6) was picked as the final IPng proposal. The IPv6 base specification is specified in RFC2460.
In a single sentence, IPv6 is a re-engineering effort against IP technology. Key features are listed below:
There are number of good books available on IPv6. Be sure to check these if you are interested.
The network configuration is defined in a set of text configuration files. Note that you do not need to edit some of those if you are configuring a host (not a router), by using autoconfiguration.
ifconfig_IF
in /etc/rc.conf
- you can
include IPv6 network setup, using ifconfig(8), into
here.In IPv6, routers and hosts are clearly separated. Nodes that forward packets for others are called routers. Nodes that do not are called hosts. Routers need to be configured manually. Routers will advertise information about subnet using rtadvd(8) daemon. Hosts usually have only one external network interface (some part of this document assumes this), and will be autoconfigured using the advertised subnet information.
There are two separate mechanisms defined for IPv6 host autoconfiguration. One is called stateless address autoconfiguration, and is specified in RFC2462. The other is called DHCPv6, and is being discussed by the IETF dhc working group. NetBSD currently implements the former.
Stateless address configuration basically works as follows. We have two parties here: a host (which is to be autoconfigured) and a router (which emits necessary information to the host).
% ifconfig ne2 ne2: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500 media: Ethernet manual inet6 fe80::a00:5aff:fe38:6f86%ne2 prefixlen 64 scopeid 0x1 |
14:18:20.812850 fe80::240:5ff:fea0:8e08 > ff02::1: icmp6: router advertisement\ (chlim=64, router_ltime=1800, reachable_time=30000, retrans_time=1000)(src\ lladdr: 0:40:5:a0:8e:8)(mtu: mtu=1500)(prefix info: LA valid_ltime=2592000,\ preffered_ltime=604800, prefix=2001:218:420::/64) 6000 0000 00a0 3aff fe80 0000 0000 0000 0240 05ff fea0 8e08 ff02 0000 0000 0000 0000 0000 0000 0001 8600 d38d 4000 0708 0000 7530 0000 03e8 0101 0040 05a0 8e08 0501 0000 0000 05dc 0304 40c0 0027 8d00 0009 3a80 0000 0000 2001 0218 0420 0000 0000 0000 0000 0000 |
% ifconfig ne2 ne2: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500 media: Ethernet manual inet6 fe80::a00:5aff:fe38:6f86%ne2 prefixlen 64 scopeid 0x1 inet6 2001:218:420:0:a00:5aff:fe38:6f86 prefixlen 64 |
14:18:20.300501 fe80::a00:5aff:fe38:6f86 > ff02::2: icmp6: router solicitation\ (src lladdr: 8:0:5a:38:6f:86) (len 16, hlim 255) 6000 0000 0010 3aff fe80 0000 0000 0000 0a00 5aff fe38 6f86 ff02 0000 0000 0000 0000 0000 0000 0002 8500 d7b0 0000 0000 0101 0800 5a38 6f86 |
We call it stateless address autoconfiguration, since we do not need to manage state in the router side. It is a very simple, robust and effective autoconfiguration mechanism.
Note that we cannot autoconfigure routers. Routers really need to be configured manually.
First, you may want to get an IPv6 global address from upstream provider. If you have one, you'll need to perform the following steps.
/etc/ifconfig.{IF}
(rc.conf(5)) or /etc/netstart.local
.
See the following section for
details.ip6mode="router" rtsol="NO" rtadvd="YES" rtadvd_flags="sm1 ne2" # set interfaces to advertise |
/etc/rtadvd.conf
(rtadvd.conf(5)) for fine-tuning
the router advertisement timers.Due to restrictions in the IPv6 specification, it is not possible to autoconfigure routers. Do not attempt to tweak the configuration. You will end up having unexpected behavior as a result.
If you have an IPv6 router on the network, all you have to do is as follows. After the reboot, the host will be autoconfigured by using Router Advertisements from the rtadvd(8) on the adjacent router.
ip6mode="autohost" rtsol="YES" rtsol_flags="sm1" # set your interface here |
up !rtsol $int |
If you do not have an IPv6 router on the network, you'll need to manually configure your system. See the following section for details.
Also, due to restrictions in the IPv6 specification, it is not recommended to autoconfigure a host with multiple external interfaces (like 2 ethernet interfaces). Please perform manual configuration in this case. See the following section for details.
One of the key value-adds of IPv6 is the ubiquitous availability of autoconfiguration. Since IPv6 addresses are 128 bits, there's a higher chance for mistakes in manual configuration. We strongly recommend that you avoid manual configuration whenever possible. For example:
ip6mode=autohost
and rtsol=YES
(see rc.conf(5)).If you think it is easier to do manual configuration, it's not. Manual configuration will impose future maintenance labor upon you.
If you really need a manual configuration, read on.
If you need to configure a node manually, add manual configuration for network interfaces into rc.conf(5).
You will first need to declare the type of the node (host or router)
by setting ip6mode
as per below.
ip6mode="router" # forward packets for others ip6mode="host" # do not forward packets for others |
Then, add interface configuration into rc.conf(5), or
other files sourced by /etc/rc.d/network
such as
/etc/ifconfig.xxN
. You can have multiple lines in
/etc/ifconfig.xxN
, like:
inet 10.1.1.1 netmask 0xffffff00 inet6 3ffe:501:ffff::1 prefixlen 64 alias |
Note "alias"
at the end of the line. As there
are multiple interface addresses with IPv6, the keyword is
mandatory.
If your configuration is not covered by rc.conf(5),
configuration can be added into
/etc/netstart.local
or
/etc/rc.local
.
You will need to use the following programs:
A string hostname will be resolved to IPv6 numeric
addresses by using /etc/hosts
(hosts(5)), and/or DNS. This is much like the same as IPv4
case. yp(8) may be used, however, the author has no
experience using yp(8) with IPv6 addresses.
/etc/hosts
(hosts(5)): For
small networks of a few nodes, the hostname/IP maps can be
manually duplicated in the /etc/hosts files of each node.
/etc/hosts:
3ffe:501:ffff::a:b:c:d host2.mydomain.org.au host2 |
DNS: The hostname maps can be centralized into zone-files which are accessed by the name-server, named(8). (there are many documents at www.dns.net which deal with setting up and maintaining DNS files).
Forward zone file entry
host2 IN AAAA 3ffe:501:ffff::a:b:c:d |
Reverse zone file entry
d.0.0.0.c.0.0.0.b.0.0.0.a.0.0.0.0.0.0.0.f.f.f.f.1.0.5.0.e.f.f.3.ip6.arpa. IN PTR host2.mydomain.org.au. |
Note: If you have heard about A6 records and bitstring labels for DNS – A6 and bitstrings are now in experimental status, so you don't need to worry about them. AAAA is to be used for production service and works fine.
Also note that the reverse DNS table is moving from
ip6.int
to ip6.arpa
; 6Bone (3ffe)
addresses are at the time of this writing only known in ip6.int,
production addresses should be announced under ip6.arpa, as
ip6.int will go away.
Please note that the following addresses MUST NOT appear on global DNS cloud:
This one is not globally reachable.
This one is not globally reachable either. This one somewhat like a private address, so you can put it into your intranet DNS cloud.
This address is only for internal use in a node. Do not put this into DNS database directly.
It is not recommended to put these addresses onto DNS cloud:
For the NetBSD/KAME IPv6 code, putting the following address does not make sense due to lack of support:
NetBSD/KAME does not support RFC2893 auto tunnel.
There are couple of differences between IPv6 and IPv4 address allocation.
The prefix length for an IPv6 subnet will always be /64; no more, no less. It allows you to place as many IPv6 devices as the underlying network medium allows.
With IPv4, prefix length varies between subnets to subnets, and it caused painful costs when renumbering subnets (for example, imagine when you renumber an IPv4 subnet from /28 to /29 or vice versa).
An ordinary leaf site will always get /48 of address space. It will make site renumbering easier, and allows you to switch ISP more easily.
With IPv4, the allocation varies by the size of the site, and made it very painful when you migrated from one ISP to another, for example.
Depending on the ISP situation around you, you may be able to get native IPv6 connectivity (just like you do for IPv4), or you may be able to get tunnelled connectivity (IPv6 packets encapsulated into IPv4 packets). The section talks about the latter case.
You can hook your machine up to experimental IPv6 network, called "6bone". You will need to talk with nearest 6bone site, to get your IPv6 address prefix. Note that you'll need to have a fixed IPv4 global address for this.
If you do not have a fixed IPv4 global address (if you are using dialup ISP connection), don't panic. You can hook yourself up to Freenet6. They provide a web interface to hook up your home network whenever you reconnect to the Internet.
In both cases, you will need to set up an IPv6-over-IPv4 tunneling interface onto your router. Consult gif(4) for details.
Setting up gif tunnel:
create /etc/ifconfig.gif0
with the following content.
The first argument (x.x.x.x
) is your IPv4 address, and the
second one (y.y.y.y
) is the IPv4 address of the other endpoint.
create (only needed on post-1.5) tunnel x.x.x.x y.y.y.y |
Or, add the following lines into
/etc/netstart.local
or
/etc/rc.local
.
# ifconfig gif0 create (only needed on post-1.5) # ifconfig gif0 tunnel x.x.x.x y.y.y.y |
See if the tunnel is working correctly: First try invoking the following command:
# ping6 -n ff02::1%gif0 |
If you see two packets, one from your local node and another from the remote node, the tunnel is working fine. If you have an IPv4 reachability problem between x.x.x.x and y.y.y.y, you will see only one reply or no reply. Here are items to look at if you are having trouble:
Exchange routes: Depending on your upstream configuration, you may need to set up default route to the upstream, or you may need to run a routing daemon.
The above configuration uses an RFC2893 IPv6-over-IPv4 configured tunnel. Note that RFC2893 packets will not be able to go through a NAT router (if your tunnel endpoint itself - a NetBSD box - is a NAT router, it should not be a problem).
See also:
net/hf6to4
Suppose you have obtained your address prefix, 3ffe:0501:ffff::/48 from your upstream for your home network. You have two ethernet segments in your home, like below. Both myrouter A and myrouter B run IPv6-capable NetBSD. IPv4 addresses are assigned like below. You wish to connect to the upstream via IPv6-over-IPv4 tunnel, from myrouter A at x.x.0.1/24 to upstream router at y.y.y.10.
myrouter A | IPv4 x.x.0.1/24 | ==+=== ethernet 0 | | IPv4 x.x.0.2/24 myrouter B | IPv4 x.x.1.2/24 | ==+=== ethernet 1 |
First, you need to configure your tunnel to the upstream from myrouter A. On myrouter A, configure the tunnel by using ifconfig(8), and then confirm the reachability by using ping6(8). "ff02::1" is referred to as an all-node multicast address, which should reach all nodes on the tunnel - in this case, myrouter A and upstream router. If you get answers from two nodes, the tunnel is working fine. If you get answer from only one node (myrouter A itself), something is bad between you and the upstream. It could be IPv4 filtering, it could be misconfiguration on either side, or something else. Track the problem down before proceeding.
# ifconfig gif0 create (only needed on post-1.5) # ifconfig gif0 tunnel x.x.0.1 y.y.y.10 # ping6 -I gif0 -n ff02::1 PING6(56=40+8+8 bytes) fe80::a00:5aff:fe38:6f86 --> ff02::1 16 bytes from fe80::a00:5aff:fe38:6f86%lo0, icmp_seq=0 hlim=64 time=0.334 ms 16 bytes from fe80::240:5ff:fea7:f092%gif0, icmp_seq=0 hlim=64 time=3.416 ms(DUP!) |
Next, you need to assign a subnet address from your address block, 3ffe:0501:ffff::/48, to two of your ethernet segments. Since the prefix length for IPv6 subnet is always /64, you have 65536 subnets available for you! Let's just assign 3ffe:0501:ffff:0000::/64 to ethernet 0, and 3ffe:0501:ffff:0001::/64 to ethernet 1.
myrouter A ---- tunnel -------> upstream | IPv4 x.x.0.1/24 IPv4 y.y.y.10 | ==+=== ethernet 0: x.x.0.0/24, 3ffe:501:ffff:0::/64 | | IPv4 x.x.0.2/24 myrouter B | IPv4 x.x.1.2/24 | ==+=== ethernet 1: x.x.1.0/24, 3ffe:501:ffff:1::/64 |
Let us assign IPv6 global address to your routers. Since routers MUST be manually configured, you need to perform the "ifconfig" as described in manual configuration section. For myrouter A, lookup link-local IPv6 address (it starts with "fe80"), take the lower 64 bits, attach upper 64 bits from the subnet address, and configure it. To preserve configuration across reboot, you may wish to append the setting to /etc/ifconfig.ne2.
# ifconfig ne2 ne2: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500 address: 08:00:5a:38:6f:86 media: Ethernet manual inet x.x.0.1 netmask 0xffffff00 broadcast x.x.0.255 inet6 fe80::a00:5aff:fe38:6f86%ne2 prefixlen 64 scopeid 0x1 # ifconfig ne2 inet6 3ffe:501:ffff:0:a00:5aff:fe38:6f86 prefixlen 64 alias # echo 'inet6 3ffe:501:ffff:0:a00:5aff:fe38:6f86 prefixlen 64 alias' >> /etc/ifconfig.ne2 |
For myrouter B, do the similar thing.
# ifconfig tlp0 inet6 3ffe:501:ffff:0:a00:5aff:fe38:8765 prefixlen 64 alias (ethernet 0 side) # ifconfig tlp1 inet6 3ffe:501:ffff:1:a00:5aff:fe38:9710 prefixlen 64 alias (ethernet 1 side) |
To exchange routing information, run route6d(8) on both routers. If the upstream asks you to aggregate route announcements, please consult the manual page for command line options. Now that connectivity to yourupstream should be okay, try to ping external IPv6 nodes. Do not forget to specify "-n" to ping6(8); IPv6 reverse address lookup can take a very long time and should be avoided when you do tests.
# route6d (on both routers) # ping6 -n www.6bone.net |
If you have end hosts (non-router nodes) on your network, you may want your router to advertise subnet information to end hosts. By doing this, your end hosts will be able to autoconfigure themselves. You will need to prepare /etc/rtadvd.conf, and run rtadvd(8). Note that you should advertise subnet information from the upstream router. In the picture, myrouter A should advertise to ethernet 0, and myrouter B should advertise to ethernet 0 and 1. You may want to disable advertisement from myrouter B to ethernet 0, because B is on the downstream and is not optimal as the default router (but if you disable it, machines on ethernet 0 will not be able to talk with machines on ethernet 1 when myrouter A is dead).
# rtadvd ne2 (from myrouter A to ethernet 0) # rtadvd tlp0 tlp1 (from myrouter B to ethernet 0 and 1) |
Then, you need to run rtsol(8) or rtsold(8) on your end nodes so that they can be autoconfigured.
In some cases, your upstream may ask you to configure differently from the above scenario.
If you have more than one static global IPv4 address, you can use 6to4 mechanism (RFC3056) for your own /48 IPv6 prefix.
There are routers called "public 6to4 relay router" out there, which will behave as the other side of tunnel for you. You will need to configure one of your machines to behave as 6to4 gateway, which will encapsulate IPv6 packets into IPv4 and throw them to public 6to4 relay router (and vice versa). If your IPv4 address is x.y.z.u, your IPv6 prefix will be 2002:xxyy:zzuu::/48 (xx, yy, zz and uu is hexadecimal notation for x, y, z and u, respectively).
If your ISP gave you a private IPv4 address (like 10.x.x.x), unfortunately you cannot use this mechanism. The mechanism does not work across NAT devices.
Let us assume the following topology, and machine myrouter A has an IPv4 address x.y.z.u. IPv4 address for myrouter B does not matter.
myrouter A | IPv4 x.y.z.u | ==+=== ethernet 0 | myrouter B | ==+=== ethernet 1 |
First, you need to configure 6to4 tunnel interface on myrouter A. We have picked an IPv6 subnet prefix, 2002:xxyy:zzuu:0000::/64, for use in the tunnel. With the promulgation of RFC 3068, everyone using 6to4 should now set their default router to 2002:c058:6301:: which is a special magic anycast address for the nearest (in BGP terms, anyhow) Relay Router. There's also a list of public 6to4 relay routers you can choose from. Note that we cannot use ff02::1 test on stf0 interface, as the interface is not capable of IPv6 multicasting. Since stf0 interface is not enabled by default GENERIC kernel, you may need to recompile your kernel (this is due to security reasons - see the stf(4) man page).
# ifconfig stf0 create (only needed on post-1.5) # ifconfig stf0 inet6 2002:xxyy:zzuu:0000::1 prefixlen 16 alias # route add -inet6 default 2002:c058:6301:: (or another one from the list) |
Next, you need to assign a subnet address from your address block, 2002:xxyy:zzuu::/48, to two of your ethernet segments. Since we have already used 2002:xxyy:zzuu:0000::/64 for the tunnel, we cannot use it for our ethernet interfaces. Let us use 2002:xxyy:zzuu:0001::/64 and 2002:xxyy:zzuu:0002::/64 here.
: 6to4 tunnel, 2002:xxyy:zzuu:0000::/64 : myrouter A | IPv4 x.y.z.u | ==+=== ethernet 0: 2002:xxyy:zzuu:0001::/64 | myrouter B | ==+=== ethernet 1: 2002:xxyy:zzuu:0002::/64 |
You can now go back to the previous section and setup myrouter B, RIPng routing, as well as router advertisement.
See also:
To go to a totally IPv6 environment (without IPv4), you'd
need to contact name servers using IPv6 cloud. It's easy: you
just need to put IPv6 addresses into resolv.conf(5). If you
would like to run an IPv6 transport ready DNS server, try
running net/bind9
. Example
configuration would be like this:
nameserver 3ffe:501:4819::42 |
There's a working IPv6-ready DNS server running on the above address, so feel free to try it out.
We cannot connect directly from an IPv6-only client to an IPv4-only server, or vice versa. We need a device called a "translator" to do this.
NetBSD is shipped with the faithd(8) TCP relay
translator, which can be used to enable an IPv6-only (or
IPv4/v6) client to contact IPv4-only servers by using IPv6 TCP.
By using it with net/totd
DNS
proxy server, you can install an IPv6-to-IPv4 translator
environment, like this:
+--IPv6 only cloud------+ | | |IPv6 only | IPv4 only |client == IPv6 ===> translator ----- IPv4 --> servers | tcp runs faithd(8) tcp | | +-----------------------+ |
For actual setup, please refer to the following documents.
See also:
net/totd
If your organization has IPv4-only routers, IPv4 NAT routers, or other things that may become obstacles to direct IPv6 networking, you can overcome these hurdles by following ways. Pick the most suitable one for your network configuration:
outgoing router | ==+=======================+=== IPv4/v6 subnet A | | IPv4-only router IPv6-only router | forward | forward | IPv4 only | IPv6 only ==+=======================+=== IPv4/v6 subnet B |
outgoing router | ==+=======================+=== subnet A: IPv4 global, IPv6 global | | IPv4-only NAT router IPv6-only router | | ==+=======================+=== subnet B: IPv4 private, IPv6 global |
outgoing router | ==+======== ether segment 1: IPv4 subnet A, IPv6 subnet X | IPv4-only router (bridge ether type 0x86dd) | ==+======== ether segment 2: IPv4 subnet B, IPv6 subnet X (same as above) |
+--- IPv4-only cloud -------------------+ | | +<================= IPv6-over-IPv4 tunnel =============>+ | | | | | +---------------------------------------+ | | | IPv4/v6 router IPv4/v6 router | | ==+======= IPv4/v6 segment 1 ==+======= IPv4/v6 segment 2 |
Because IPv6 is still in its infancy, there are several non-standard items or specification holes. The KAME IPv6 implementation tries to address those.
IPv6 specifies "scoped", or not-worldwide-unique, addresses in the specification. To disambiguate a scoped address, we need to explicitly specify the scope of the address. For example, the specification specifies a "link-local address" which is unique on a single link only. You need to specify the outgoing "link" with the address to disambiguate the address.
KAME IPv6 code embeds a scope identifier into the 3rd and 4th byte of a scoped address in the in-kernel structures. Because of this, you sometimes see embedded form, like "fe80:1::abcd:1234:abcd:1234" to mean "fe80:0000:0000:0000:abcd:1234:abcd:1234 on scope 1". You should not specify the embedded form whenever possible.
To disambiguate a scoped address, you have two options:
fe80::1%de0
for specifying the address.
Note that the syntax is available only for certain set of
applications (applications that use getaddrinfo(3) can handle this).Not about the specification, but there are some things worth mentioning:
USE_INET6
to switch between IPv4/v6 builds and IPv4-only builds.
USE_INET6
will automatically be turned on for IPv6-ready NetBSD
systems.AF_INET6
wildcard listening sockets will grab IPv4 connection
only with certain configurations (RFC2553 documents this behavior).
This is for plugging security hole in specification.
Consult inet6(4) and ip6(4) for more details.If you have any questions, do not hesitate to ask on the tech-net mailing list, or users@ipv6.org. When you ask about your configuration, be VERY sure to attach a network diagram for your site. Without a network diagram, nobody can guess your network configuration.
net/tcpdump
- selectively view traffic on a network interfacenet/pim6dd
- PIMv6 dense mode multicast routing daemonnet/pim6sd
- PIMv6 sparse mode multicast routing daemonnet/zebra
- zebra routing daemon, supports RIPng, BGP4+, and OSPFv6See also:
The following programs in the base system are known to be IPv6-enabled:
finger(1),
fstat(1),
ftp(1),
netstat(1),
rlogin(1),
rsh(1),
systat(1),
telnet(1),
tftp(1),
whois(1),
faithd(8),
fingerd(8),
ftpd(8),
ifconfig(8),
inetd(8),
lpd(8) (and friends),
mld6query(8),
ndp(8),
ping6(8),
pppd(8),
rdate(8),
rip6query(8),
rlogind(8),
route6d(8),
rshd(8),
sendmail(8),
syslogd(8),
tcpdchk(8) (and friends),
telnetd(8),
tftpd(8),
traceroute6(8),
trpt(8)
.
RPC and NFS now support IPv6.
An increasing number of packages are also ready for IPv6.
If you want IPv6-ready third-party software, you may need to get an IPv6 patch for the software. There are collections of IPv6 patches on the net.
See also:
This IPv6 Configuration Help site is owned by The NetBSD Project.
[ Previous | Next | Random Site | List Sites ]
</center>