IPv6 configuration in NetBSD


NetBSD is a UNIX-like operating system that focuses on compatibility with many different processor architectures and hardware vendors. I found the documentation a bit lacking in instructions on how to configure IPv6 with static IP addresses, so i've documented it here myself for future reference.

The rc.conf file

In most BSD-flavours, system-wide configuration is managed through the /etc/rc.conf file. This is also the case with NetBSD. rtsold(8) is the router solicitation daemon. It will send out router sollicitation packets and configure the network interface using the information it received.

Make sure the following is set in /etc/rc.conf.

# Autohost with special tweak to /etc/ifconfig.wm0, ref. that
# so that we force the lower 64 bits of the address
ip6mode=autohost				# host, autohost or router
ip6uniquelocal=NO				# IPv6 unique-local forwarding
rtsol=YES		rtsol_flags="-a"	# for ip6mode=autohost only
rtsold=YES		rtsold_flags="-a"	# for ip6mode=autohost only

This will enable IPv6 support for the host, as long as it has one non-local interface (and no more than that). If you have a setup where you have multiple interfaces, you may need to configure rtsold(8) yourself.

Find out the name of your network interface. You can use the ifconfig(8) utility. In my case, the name of the interface is wm0.

Now create a file called /etc/ifconfig.wm0 (using the name of your interface). The contents of the file should be as follows:

# Force the choice of local part of inet6 address.
inet6 fe80::db8
inet6 -alias fe80::250:56ff:fedb:8db8%pcn0
inet6 2001:db8::db8

Where you replace all instances of db8 with your own values. The fe80:: addresses are link-local, so they will only work within the same broadcast network.

Finally, you can apply your changes using the following command:

service network restart

If you need legacy IPv4 addresses, you may add a line like this to the ifconfig file:

inet netmask up

See also