deploy_socat_ipv6_ipv4_proxy.sh
· 439 B · Bash
Brut
#!/bin/bash
apt install socat || exit
cat > /etc/systemd/system/socat\@.service <<EOF
[Unit]
Description=ipv6 to ipv4 port forwarding
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/socat TCP6-LISTEN:%i,ipv6only=1,reuseaddr,fork TCP4:127.0.0.1:%i
[Install]
WantedBy=docker.service
EOF
systemctl daemon-reload
for PROTO in http https; do
systemctl enable socat@${PROTO}.service
systemctl start socat@${PROTO}.service
done
| 1 | #!/bin/bash |
| 2 | |
| 3 | apt install socat || exit |
| 4 | cat > /etc/systemd/system/socat\@.service <<EOF |
| 5 | [Unit] |
| 6 | Description=ipv6 to ipv4 port forwarding |
| 7 | After=network.target |
| 8 | |
| 9 | [Service] |
| 10 | Type=simple |
| 11 | ExecStart=/usr/bin/socat TCP6-LISTEN:%i,ipv6only=1,reuseaddr,fork TCP4:127.0.0.1:%i |
| 12 | |
| 13 | [Install] |
| 14 | WantedBy=docker.service |
| 15 | EOF |
| 16 | systemctl daemon-reload |
| 17 | for PROTO in http https; do |
| 18 | systemctl enable socat@${PROTO}.service |
| 19 | systemctl start socat@${PROTO}.service |
| 20 | done |