sshd error - Bind to port failed: Cannot assign requested address

> posts > 2022 > Mar


I faced a very weird issue today, sshd failed to start on boot because ListenAddress was set but doesn't mean IP addresses are already assigned and ready. So the configured IP isn't available, therefore sshd can't bind a Port and failed with fatal: Cannot bind any address.

I thought this can be fixed by adjusting the sshd systemd unit, everything I found online also pointed into that direction, for example a Debian (Archive: [1], [2]) and Ubuntu (Archive: [1], [2]) Bug report.


[Unit] auditd.service

The above systemd override seem to be one of the popular solutions which works for a lot of people. Unfortunately none of the various After/Wants combinations worked in my case on Debian 11.

I had to go with the workaround to allow system wide port binding to not (yet) assigned IP addresses by adjusting two sysctl values as described on serverfault (Archive: [1], [2]).


Probably not the most elegant solution but it's working and due to the fact that multiple IP addresses are assigned to the Server, I have to specify on which the SSH Daemon is listening and can't just let em bind to all.

[ Show Source | Download PDF ]