socat examples

Port forwarding ipv4 to ipv6

To make a ipv6-only service (imaps in this example) accessible for ipv4 clients:

/usr/bin/socat -d -d TCP4-LISTEN:imaps,reuseaddr,fork,su=nobody TCP6:[2001:....:1]:imaps

Put the ipv6 address in the sqare brackets.

systemd and socat

Create a service:
# cat /etc/systemd/system/socat@.service 
Description=ipv4 to ipv6 port forwarding

ExecStart=/usr/bin/socat -d -d TCP4-LISTEN:%i,reuseaddr,fork,su=nobody TCP6:[2001:....:1]:%i


Install service for imap and imaps:

systemctl daemon-reload
systemctl enable socat@imap.service
systemctl enable socat@imaps.service
systemctl start socat@imap.service
systemctl start socat@imaps.service

Erstellt von redflo. Letzte Änderung: Dienstag, 28. Juli 2015 17:43:28 UTC by redflo.

Flattr me!