You can use either xinetd
or systemd
for socket activation, both will work. I personally find xinetd
easier to use because everything is in one file, but have also used systemd
because it is more flexible, especially with listening on multiple addresses and socket forwarding to UNIX sockets and not just to IP sockets.
Here as an example I used to forward TCP connection to the MySQL file socket:
/etc/systemd/system/mysql-proxy.service
[Unit]
Description=MySql Proxy Service
Requires=mysql-proxy.socket
[Service]
Environment=MYSQL_PROXY_TARGET=/var/run/mysql/mysql.sock
EnvironmentFile=-/etc/sysconfig/mysql-proxy
ExecStart=/usr/lib/systemd/systemd-socket-proxyd ${MYSQL_PROXY_TARGET}
/etc/systemd/system/mysql-proxy.socket
[Unit]
Description=MySql Proxy Socket
[Socket]
ListenStream=192.168.1.1:3306
ListenStream=192.168.2.1:3306
NoDelay=true
FreeBind=true
[Install]
WantedBy=sockets.target
Traditional forwarding needs Accept=true
, systemd
aware processes are supposed to handle multiple connections in one process or fork additional processes as required.
systemd
crowd,systemd
should be used for everything.xinetd
won't cause you any problems. Withsystemd
you have to write two files, a.service
file and a.socket
file. Both approaches will work.