Solved IPv6 acts weird on tap interface

To me this makes no sense at all.

Version: FreeBSD 11.1-RELEASE-p6

On the tap interface is running an openvpn server

Code:
ifconfig tap0
tap0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 00:bd:4f:8f:f7:xx
        hwaddr 00:bd:4f:8f:f7:xx
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.2
        inet6 fc00::1 prefixlen 64
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        groups: tap
        Opened by PID 60533
# route get -inet6 fc00::10
   route to: fc00::10
destination: default
       mask: default
    gateway: xxxxx.tunnel.tserv10.par1.ipv6.he.net
        fib: 0
  interface: gif0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1280         1         0
# ifconfig tap0 inet6 fc00::1/64
# ifconfig tap0
tap0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 00:bd:4f:8f:f7:xx
        hwaddr 00:bd:4f:8f:f7:xx
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.2
        inet6 fc00::1 prefixlen 64
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        groups: tap
        Opened by PID 60533
# route get -inet6 fc00::10
   route to: fc00::10
destination: fc00::
       mask: ffff:ffff:ffff:ffff::
        fib: 0
  interface: tap0
      flags: <UP,DONE>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0
 
What doesn't make sense? You just added a directly connected network to an interface, and because it's directly connected the route via that interface is implied. The reason it was first on gif0 is probably because it too has an address in the fc00::/64 range. Two interfaces connected to the same network is going to cause problems as the order in the routing table will determine which one to use. Because you added the address to tap0 last (by hand) the order in the routing table changed (putting tap0 before gif0).

I'm sure this difference shows up if you look at netstat -rn -6
 
Yes, that's a directly connected network, so that route is implied. Looking a little closer I see that the first route via gif0 is the default gateway. If tap0 was up and fc00::/64 range bound to it it should go through there, as it's the most "strict" route.
 
Exactly so why doesn't it?

I mean I haven't set anything special, just default router that's it.

like:

route add -n add -inet6 default 2001:1:1:1::1

At boot even, .. and sometimes the issue only shows up later. The tap() interface is a openvpn interface though. Maybe that's useful to know?
 
I don't think it matters how the tap(4) interface is used, it's basically just a virtual interface like any other interface.

How and where are you setting the IPv6 default route?
 
Cron @reboot:
Code:
#!/bin/sh
/sbin/ifconfig gif0 create
/sbin/ifconfig gif0 tunnel x.x.x.x x.x.x.x
/sbin/ifconfig gif0 inet6 2001:470:x:x::2 2001:470:x:x::1 prefixlen 128
/sbin/route -n add -inet6 default 2001:470:x:x::1
/sbin/ifconfig gif0 up
/sbin/sysctl net.inet6.ip6.forwarding=1
/usr/sbin/service sshd restart

I know its probably beter through rc.conf however for some reason couldn't get that to work.
 
Yeah, there's absolutely no reason for this, use the proper rc.conf entries. I suspect this is the reason why it's working strangely right now.

Code:
cloned_interfaces="gif0"
create_args_gif0="tunnel x.x.x.x x.x.x.x"
ifconfig_gif0_ipv6="inet6 2001:470:x:x::2 2001:470:x:x::1 prefixlen 128"
ipv6_defaultrouter="2001:470:x:x::1"
ipv6_gateway_enable="YES"

Judging by the configuration, I suspect this is a he.net tunnelbroker? The above rc.conf entries work for my HE tunnel.
 
Yep, .. it's a he.net tunnelbroker, I'll give your configuration a shot and see what happens.

edit result:
Code:
# route -n get -inet6 fc00::1
   route to: fc00::1
destination: fc00::1
        fib: 0
  interface: lo0
      flags: <UP,HOST,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0     16384         1         0
# route -n get -inet6 fc00::10
   route to: fc00::10
destination: fc00::
       mask: ffff:ffff:ffff:ffff::
        fib: 0
  interface: tap0
      flags: <UP,DONE>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0
# route -n get -inet6 google.be
   route to: 2a00:1450:400e:803::2003
destination: ::
       mask: ::
    gateway: 2001:470:x:x::1
        fib: 0
  interface: gif0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1280         1         0
 
Back
Top