zerotier / ZeroTierOne

A Smart Ethernet Switch for Earth
https://zerotier.com
Other
14.24k stars 1.66k forks source link

FreeBSD 12.0-CURRENT fails to create tap interface on startup #530

Closed dch closed 6 years ago

dch commented 7 years ago

While trying to debug why no tap interface is created on 12.0-CURRENT, I On 11.0R amd64 using ZT 1.2.4 I see the tap interface created correctly:

ztebjbqsam9id7m: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 5000 mtu 2800
        options=80000<LINKSTATE>
        ether f6:88:82:8d:ae:de
        inet6 fe80::1234:fcff:fe5f:9c09%ztebjbqsam9id7m prefixlen 64 scopeid 0x5 
        inet6 fcf9:1234:68bc:1b91:30a4::1 prefixlen 40
        inet 10.123.131.88 netmask 0xffff0000 broadcast 10.244.255.255 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        groups: tap 
        Opened by PID 36500
$ 

But on 12.0-CURRENT I don't see this created anymore - no interface at all is shown in ifconfig and there's no connectivity either as one would expect. Suggestions?

adamierymenko commented 7 years ago

Has there been some change in tun/tap for FreeBSD between 11 and 12? We don't have a 12 VM at the moment.

dch commented 7 years ago

I checked upstream changes & there are none; https://svnweb.freebsd.org/base/head/sys/net/if_tap.c and set up a new machine to check. The issue appears to be one of configuration - if there is an existing config in place, then the tap interface is not created.

However if that config is destroyed and re-created then the interface re-appears:

# service zerotier stop
# rm -rf /var/db/zerotier/*
# service zerotier start
# zerotier-cli -j join <net>

and then approved in the mgmt GUI or by API, then the interface reappears. It's not clear why this should be an issue but I can make both the old config and a suitable test system available on request.

dharrigan commented 6 years ago

Hi,

I can't reproduce the issue myself.

I'm running FreeBSD 12-current as a KVM VM on a Linux host.

FreeBSD 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r323985: Mon Sep 25 17:43:19 UTC 2017 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64

root@:~ # pkg info zerotier
zerotier-1.2.4_1
Name           : zerotier
Version        : 1.2.4_1
Installed on   : Mon Oct  2 18:11:14 2017 UTC
Origin         : net/zerotier
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : net
Licenses       : GPLv3
Maintainer     : dch@skunkwerks.at
WWW            : https://www.zerotier.com/
Comment        : Network virtualization everywhere
Annotations    :
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 1.40MiB
Description    :
ZeroTier can be used for on-premise network virtualization, as a
peer to peer VPN for mobile teams, for hybrid or multi-data-center
cloud deployments, or just about anywhere else secure software
defined virtual networking is useful.

WWW: https://www.zerotier.com/

After several reboots, this the output of ifconfig (the same after rseveral rboots):

root@:~ # ifconfig
vtnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=6c07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    ether 52:54:00:2b:7e:d6
    inet6 fe80::5054:ff:fe2b:7ed6%vtnet0 prefixlen 64 scopeid 0x1 
    inet 192.168.82.43 netmask 0xfffffc00 broadcast 192.168.83.255 
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
    media: Ethernet 10Gbase-T <full-duplex>
    status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
    inet 127.0.0.1 netmask 0xff000000 
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
    groups: lo 
zt5dlqph4r1jg1n: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 5000 mtu 2800
    options=80000<LINKSTATE>
    ether f6:7e:ad:fe:b7:f6
    hwaddr 00:bd:72:17:ff:09
    inet6 fe80::2bd:72ff:fe17:ff09%zt5dlqph4r1jg1n prefixlen 64 scopeid 0x3 
    inet 192.168.20.138 netmask 0xffffff00 broadcast 192.168.20.255 
    inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    media: Ethernet autoselect
    status: active
    groups: tap 
    Opened by PID 670

I was able to join my network, was issued IPv4 and IPv6 addresses from my range. Was able to ping a remote Zerotier node. Rebooted the VM and Zerotier came back again, with same IPs and was still able to ping remote node.