Socket units
Socket units are used to manage:
- IPC sockets;
- network sockets;
- filesystem FIFO;
A socket unit is paired with a matching service.
Systemd socket addresses
If the address starts with /, a file system AF_UNIX socket is used.
If the address starts with @ an abstract namespace AF_UNIX socket is used.
If the address string is v.w.x.y:z it is interpreted as IPv4 address.
If the address string is [x]:y it is interpreted as IPv6 address.
Accept=:yes: the service is started at each connection, and the connection socket is passet to it.no: the service is started once, and the listen socket is passed to it.
Socket types
ListenStream=: specifies the adress to listen on for aSOCK_STREAM; can be defined multiple times;ListenDatagram=: specifies the address to listen on for aSOCK_DGRAM; can be defined multiple times;ListenSequentialPacket=: specifies the address to listen on for aSOCK_SEQPACKET; can be defined multiple times;ListenFIFO=: an absolute path pointing to a file system FIFO;ListenSpecial=: similar toListenFIFO=but used for listening to character devices and special files like those in/sysand/proc;ListenNetlink=: ??ListenMessageQueue=: ??ListenUSBFunction=: ??
Network socket options
For AF_INET and AF_INET6 sockets;
SocketProtocol:udplite;sctp;mptcp;
BindIPv6Only=: controls theIPV6_V6ONLYoption:default: uses the system wide default setting (defaultboth);both;ipv6-only:
Backlog=BindToDevice=: specifies a network interface for the socket and controls theSO_BINDTODEVICEsocket option.
File system socket options
For AF_UNIX sockets and FIFOs.
SocketUser=: user owner of the created unix sockets and fifo nodes;SocketGroup=: group owner of the created unix socket and fifo nodes;SocketMode=: access mode of the created unix socket and fifo nodes; defaults to0666DirectoryMode: access mode of the created directories, defaults to0755MaxConnections=MaxConnectionsPerSource=KeepAlive=: controls theSO_KEEPALIVEoption;KeepAliveTimeSec=: controls theTCP_KEEPIDLEoption;KeepAliveIntervalSec=: controls theTCP_KEEPINTVLoption;KeepAliveProbes=: controls theTCP_KEEPCNToption;NoDelay=: controls theTCP_NODELAYoption;Priority=: controls theSO_PRIORIYoption;DeferAcceptSec=:??ReceiveBuffer=: controls theSO_RCVBUFoption;SendBuffer=: controls theSO_SNDBUFoption;IPTOS=: controls theIP_TOSoption;Mark=: controls theSO_MARKoption;ReusePort=: controls theSO_REUSEPORToption;PipeSize=: controls the pipe buffer size of FIFOs;Broadcast=: controls theSO_BROADCASTsocket (default tofalse);PassCredentials=PassSecurity=PassPacketInfo=Timestamping=: controls theSO_TIMESTAMPorSO_TIMESTAMPNSoff:us:ns: