IPv6 on Traccar Docker (without resorting to a 6to4 tunnel)

Kaldek a year ago

I have Traccar running using the Docker Container (version 6.5). Currently this is hosted on an unRAID server while I learn more about the platform. This setup of Docker uses IPVLAN, which has other containers running with working native IPv6.

I have the Traccar container assigned a working IPv6 address which I can ping. However, the Traccar services are not listening on IPv6, as shown by a netstat:

/opt/traccar # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:xx:xx:xx:xx:71  
          inet addr:192.168.0.217  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: 2404:xxxx:xxxx::d00d:d00d/64 Scope:Global
          inet6 addr: fe80::1b:2100:xxxx:xxxx/64 Scope:Link
          inet6 addr: 2404:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1077 errors:0 dropped:0 overruns:0 frame:0
          TX packets:326 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:244656 (238.9 KiB)  TX bytes:74289 (72.5 KiB)

/opt/traccar # netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 127.0.0.11:37749        0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5019            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5018            0.0.0.0:*               LISTEN      

...SNIP...

tcp        0      0 192.168.0.217:8082      192.168.0.210:39680     TIME_WAIT   
tcp        0      0 192.168.0.217:8082      192.168.0.210:39718     ESTABLISHED 
tcp        0      0 192.168.0.217:8082      192.168.0.177:37100     ESTABLISHED 
udp        0      0 127.0.0.11:48705        0.0.0.0:*                           
udp        0      0 0.0.0.0:5001            0.0.0.0:*                           
udp        0      0 0.0.0.0:5002            0.0.0.0:*                           
udp        0      0 0.0.0.0:5003            0.0.0.0:*                           
udp        0      0 0.0.0.0:5004            0.0.0.0:*                           
udp        0      0 0.0.0.0:5005            0.0.0.0:*                           
udp        0      0 0.0.0.0:5008            0.0.0.0:*                           
udp        0      0 0.0.0.0:5009            0.0.0.0:*                           
udp        0      0 0.0.0.0:5013            0.0.0.0:*                           

... SNIP...

udp        0      0 0.0.0.0:5254            0.0.0.0:*                           
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         STREAM     CONNECTED     41382888 
PS C:\Users\xxxx> ping 2404:xxxx:xxxx::d00d:d00d

Pinging 2404:xxxx:xxxx::d00d:d00d with 32 bytes of data:
Reply from 2404:xxxx:xxxx::d00d:d00d: time<1ms

The reasoning for this is to avoid CGNAT related timeout issues for connections from GPS trackers. And of course, I can just use 6to4 to get around this, but I am curious why the services aren't listening on IPv6.

Anton Tananaev a year ago

By default Traccar listens on all interfaces.

Kaldek a year ago

Yeah, hence why it's odd that the results of netstat show that it's listening on the interface but only on the IPv4 stack.

Kaldek a year ago

Could this "preferIPv4Stack=true" have something to do with it?

/opt/traccar # ps
PID   USER     TIME  COMMAND
    1 root      1:18 java -Xms1g -Xmx1g -Djava.net.preferIPv4Stack=true -jar tracker-server.jar conf/traccar.xml
Anton Tananaev a year ago

Interesting. I never noticed it there. Maybe you can ask here why we need it:

https://github.com/traccar/traccar-docker/issues

Kaldek a year ago

I'll do that, thanks,.