al45tair/netifaces

IPv6 gateway not found on FreeBSD 11.2

pstavirs opened this issue · 0 comments

On FreeBSD 11.2 netifaces.gateways() only returns IPv4 gateway -

>>> import netifaces
>>> netifaces.gateways()
{'default': {2: ('10.0.2.2', 'em0')}, 2: [('10.0.2.2', 'em0', True)]}
>>> 

The routing table -

$ netstat -r
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            10.0.2.2           UGS         em0
10.0.2.0/24        link#1             U           em0
10.0.2.15          link#1             UHS         lo0
localhost          link#2             UH          lo0

Internet6:
Destination        Gateway            Flags     Netif Expire
::/96              localhost          UGRS        lo0
default            2002::1            UGS         em0 <<<< not returned by netifaces
localhost          link#2             UH          lo0
::ffff:0.0.0.0/96  localhost          UGRS        lo0
2002::/64          link#1             U           em0
2002::100          link#1             UHS         lo0
fe80::/10          localhost          UGRS        lo0
fe80::%em0/64      link#1             U           em0
fe80::a00:27ff:feb link#1             UHS         lo0
fe80::%lo0/64      link#2             U           lo0
fe80::1%lo0        link#2             UHS         lo0
ff02::/16          localhost          UGRS        lo0

I don't think it makes a difference, but the IPv6 gateway is being added temporarily using -

ifconfig em0 inet6 2002::100/64
route -6 add default 2002::1
ndp -s 2002::1   00:01:02:03:04:05 temp