OpenBSD default gateway outside subnet
My ISP offers IPv6 by default. However, my ISPs IPv6 setup appears to be a bit strange because the default IPv6 gateway is located outside of my servers subnet. Under linux it is possible to setup a static route to that gateway using ip -6 route add <gateway ip> dev <interface>
. However, this doesn't work on openbsd, does anybody know the equivalent of that command on openbsd or does anyone know know another approach to fix this problem?
Add the following to /etc/rc.conf:
ipv6_defaultrouter="<v6-gateway-ip>"
then reset networking by either rebooting or running
/etc/rc.d/network_ipv6 restart
Or you can do it by hand:
route -n add -inet6 default <v6-gateway-ip>
I know three approaches to solve this:
- Find another IPv6 address of the gateway. It might have multiple assigned to the interface. Which one you use as gateway does not make any difference, as long as neighbor discovery can resolve it to the correct MAC address.
- Add a static route specifying that the prefix containing that MAC address is directly connected to the given Ethernet interface. This should work even if you don't have an address in that prefix yourself. You should use a /128 for that static route, unless you have a very specific reason to do otherwise.
- Make up an IPv6 address for the gateway and insert it manually in the neighbor cache. This approach will only work if you know the MAC address of the gateway and it remains fixed. This should work on any OS where you can manually create neighbor cache entries, but I have only tested it on Linux.