[systemd-devel] Question about service dependency handling in systemd-228

Reindl Harald h.reindl at thelounge.net
Sun Nov 26 09:53:59 UTC 2017



Am 26.11.2017 um 10:47 schrieb Bao Nguyen:
> Regard to your question, "asi-My-5101.socket" depends on 
> "My-sshd.target", I think that in my case it is expected as my socket 
> listens on a specific address IP:port so it should start after a network 
> service to configure and assign IP address before my socket runs

nonsense - the whole point of socket activation is to have sockets 
listening before other stuff is up and running

https://www.freedesktop.org/software/systemd/man/systemd.socket.html
If an IP address is used here, it is often desirable to listen on it 
before the interface it is configured on is up and running, and even 
regardless of whether it will be up and running at any point. To deal 
with this, it is recommended to set the FreeBind= option described below

FreeBind=
Takes a boolean value. Controls whether the socket can be bound to 
non-local IP addresses. This is useful to configure sockets listening on 
specific IP addresses before those IP addresses are successfully 
configured on a network interface. This sets the IP_FREEBIND socket 
option. For robustness reasons it is recommended to use this option 
whenever you bind a socket to a specific IP address. Defaults to false.


More information about the systemd-devel mailing list