OpenBSD IPv6 setup
Summary: Getting IPv6 working on OpenBSD is no magic…
Created on:
-----
First things first: Figure out what the IPv6 subnet is assigned to you by your
provider or hoster. For demonstration purposes, I’ll use 2001:DB8::/32
, you
probably got a /64
subnet, but it makes no difference for the setup. Just
REMEMBER: change the IP address to the one you got assigned.
Next, you need to decide on an IP address to use. I’ll use 2001:DB8::5/32
as
my server IPv6 address. After that, you need to identify what the address for
your default gateway is. It will almost always be fe80::1
; However, check
with your provider or hoster.
Temporary setup
To test the IPv6 setup, you can assign the IP address manually to the interface and add the route.
- Set the IP address on the
vio0
interfaceifconfig vio0 inet6 2001:DB8::5/32
- Add the default route
route add -net ::/0 fe80::1%vio0
Permanent setup
To make the changes permanent, you need to create/edit a /etc/hostname.<interface>
file (hostname.if(5)) mine for example
would be /etc/hostname.vio0
. In this file, you can specify the IP addresses associated with interface as well as defining the route(s):
inet6 2001:DB8::5/32
!route add -inet6 ::/0 fe80::1%vio0
Update
[2023-11-22]
If you use PF firewall and have, for example a web server, you most likely
want to allow ICMPv6: pass proto ipv6-icmp from any to any
[2024-07-10]
Update the Permanent setup section, and improve the example with the proper
configuration.