unifi-utilities / unifios-utilities

A collection of enhancements for UnifiOS based devices
GNU General Public License v3.0
3.91k stars 420 forks source link

Documentation: podman network for DNS #309

Closed dclobato closed 2 years ago

dclobato commented 2 years ago

Describe the bug The location specified for 20-dns.conflist in https://github.com/boostchicken-dev/udm-utilities/blob/master/run-pihole/README.md does not work

To make the DNS network, I had to run

podman network create dns
curl -L https://github.com/boostchicken-dev/udm-utilities/raw/master/cni-plugins/20-dns.conflist -o /etc/cni/net.d/dns.conflist

The rest of instructions were fine...

UDM Information

Additional context Add any other context about the problem here.

boostchicken commented 2 years ago

on which file is this wrong?

dclobato commented 2 years ago

Created a pull request for this. I think it will solve #308 too...

dclobato commented 2 years ago

Done.

trnitz commented 2 years ago

This will only work until the UDM is rebooted, then the 'DNS' network will not come up.

The location of the 20-dns.conflict file needs to be in /mnt/data/podman/cni/dns.conflist, not /etc/cni/net.d/dns.conflist.

Current instructions snippet

Well, these are the current instructions that work (until reboot).

The current steps, as of today, are out of order, as covered in 308.

This works, until you reboot, as the /etc/cni/net.d/dns.conflist file is wiped out on reboot, and the container fails to start as the network defined in the container doesn't exist.

Correct instructions snippet

Explanation

The /etc/cni/net.d/dns.conflist file is just symlink to /mnt/data/podman/cni/dns.conflist

# ls -l /etc/cni/net.d/dns.conflist
lrwxrwxrwx    1 root     root            33 Feb 11 08:14 /etc/cni/net.d/dns.conflist -> /mnt/data/podman/cni/dns.conflist

In the /mnt/data/on_boot.d/05-install-cni-plugins.sh script, the variable CNI_NETD set set to /mnt/data/podman/cni, and then there is a function that creates the symlink:

populate_netd()
{
  for file in "${CNI_NETD}"/*.conflist
  do
    if [ -f "$file" ]; then
        ln -fs "$file" "/etc/cni/net.d/$(basename "$file")"
    fi
  done
}

If there the dns.conflist file doesn't exist in /mnt/data/podman/cni, then no symlink is created, and then the dns network doesn't come up on bootup.

The quick "fix" is to back out this update.