jacobalberty / unifi-docker

Unifi Docker files
MIT License
2.16k stars 458 forks source link

STUN IP address is still the 17.x.x.x address #103

Closed ddribin closed 2 years ago

ddribin commented 6 years ago

Host operating system

Synology

What tag are you using

beta

What complete docker command or docker-compose.yml do you use to launch the container (omitting sensitive values)?

sudo docker run --detach --restart always --init -p 8080:8080 -p 8443:8443 -p 3478:3478/udp -p 10001:10001/udp -e PKGURL=https://dl.ubnt.com/unifi/.../unifi_sysvinit_all.deb -e TZ='America/Chicago' -e RUNAS_UID0=false --volume /volume1/docker/unifi-beta:/unifi --name unifi-beta jacobalberty/unifi:beta

What do you expect to happen?

The docker container is running on a private 17.x.x.x IP address. This means the UniFi devices cannot connect to it directly. This is expected and what the port forwarding is supposed to fix. But the UniFi controller uses its own IP address for the Inform and STUN IP addresses. I am able to override the Inform IP address to be the host's 192.x.x.x IP in the UniFi controller. I would expect the STUN IP address to be the same.

What actually happens?

The STUN IP address is still the 17.x.x.x address:

This is a log from the UniFi controller:

[2018-02-17 10:10:14,618] <inform-1> INFO  inform - from [04:18:d6:a0:b6:8a](Dave's Office AP, U7NHD, 3.9.21.8191): state=ADOPTING, ext/stun_ip=172.17.0.1, dev_ip=192.168.1.43, up=1772124
[2018-02-17 10:10:14,649] <discover> INFO  dev    -    [Try Adopt] dev[04:18:d6:a0:b6:8a], dev_ip=192.168.1.43, url=http://192.168.1.205:8080/inform

The STUN IP is 172.17.0.1, but I'd like it to be the same as the Inform IP, 192.168.1.205.

jacobalberty commented 6 years ago

You probably want to use the macvlan driver instead see: https://github.com/jacobalberty/unifi-docker#bridge-networking

I don't have a write up on it but it does work well.

phroggster commented 6 years ago

If switching to the macvlan driver is a bit much, another option to try would be to add the IP address to your run command, a lá:

sudo docker run --detach --restart always --init -p 192.168.1.43:8080:8080 -p 192.168.1.43:8443:8443 -p 192.168.1.43:3478:3478/udp $(etc)

However, you should be able to get by specifying it only for the 3478/udp and maybe 10001/udp mappings.

ddribin commented 6 years ago

It looks like macvlan was added to version Docker v17.06, but Synology only ships with v17.05. I'll give the -p with an IP address a try and report back.

ddribin commented 6 years ago

So, after a bit more digging, while macvlan is unavailable, it looks like I can use host networking: https://docs.docker.com/network/host/

If you use the host network driver for a container, that container’s network stack is not isolated from the Docker host. For instance, if you run a container which binds to port 80 and you use host networking, the container’s application will be available on port 80 on the host’s IP address.

I can use this by passing --network host to the docker run command.

jescholl commented 6 years ago

I just encountered this problem on docker 17.05.0-ce and can confirm that adding the IP to the -p flags fixed it.

mrjackyliang commented 5 years ago

I had a similar problem when the controller is behind the Docker's 172 IP Address each time my controller was restarted.

I simply removed the 10001 UBNT Discovery port and made sure by manually informing each device again. Then I rebooted the controller once, and the problem went away.

My resolution: UBT Discovery doesn't work with the Docker's DHCP network unless set to host.

Macrisu commented 3 years ago

Hello, I have the same problem, but I use the GUI interface in DSM 6.2.3 In the Unifi Portal, I see - Host Address 172.17.0.5

Is there any way to fix this in the GUI implementation of Synology Docker?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

cinghialino commented 1 month ago

You probably want to use the macvlan driver instead see: https://github.com/jacobalberty/unifi-docker#bridge-networking

I don't have a write up on it but it does work well.

would you do a writeup about it? I can't use the hotspot manager because of the wrong URL generated