How can I make Systemd on Debian wait until IPv6 is ready before reaching the network is online target?
I have a Linode running Debian 9 and I've run into an issue.
If I set Nginx to bind to my IPv6 address, it doesn't start properly at boot, but can be started manually afterward. According to the log file, it's unable to bind to the IPv6 address.
It seems like Systemd doesn't check if IPv6 is ready before reaching the network is online target, which prevents Nginx from starting. I was wondering if any of you here might have any ideas about what I can do to resolve this?
After some ore testing, it looks like this is only a problem that I run into on Linode. A clean Debian installation on Digital Ocean doesn't experience the same problem.
I wonder what's different between the two. I wish I knew more about the way networking works on Linux. Troubleshooting this would be a lot easier. I'm not even sure where to begin now.
I wonder what's different between the two.
Maybe systemd version? Or maybe sysctl settings?
I have seen Linode’s IPv6 come up a little bit slow compared to other providers as well. Adding the following to my /etc/sysctl.conf resolved the issue:
net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1
This allows services to bind to an IP address without the IP actually being ‘up’.