Tuesday, August 11, 2020

OpenBSD IPv6 on TinyKVM

I had a lot of trouble getting IPv6 to work under OpenBSD 6.7 on a TinyKVM instance. So here, for reference, is how I finally made it work:

  1. In your control panel, note the IP addresses for your instance and its gateways; for the IPv6 address of your instance, you get to pick the last 16 bits yourself, but obviously you can't pick the IPv6 of your gateway.
  2. Edit /etc/hostname.em0 and put in the IPv4 (keyword inet) and IPv6 (keyword inet6) addresses (and netmasks) for your instance, nothing else.
  3. Edit /etc/mygate and put in the IPv4 and IPv6 addresses for your gateways, nothing else.
  4. Stop and disable the slaacd daemon using rcctl; I guess the OpenBSD folks are hopeful that most networks support SLAAC but I had no luck here.
  5. Try restarting the network using sh /etc/netstart but if that doesn't fix things for you, reboot the instance and hope for the best.

Note that I had to add a "mystical" invocation of ifconfig to /etc/rc.local as well. Without that, the instance wouldn't pick up either of its IPs immediately on boot but only after a roughly 5 minute delay. No idea what the TinyKVM folks are doing there, but hey, with this "all static" configuration and the weird ifconfig trick things now work roughly as they should. If you figure out a better way of doing this, please let me know!