最終更新 6 months ago

waja revised this gist 4 years ago. Go to revision

1 file changed, 1 insertion

deploy_socat_ipv6_ipv4_proxy.sh

@@ -1,5 +1,6 @@
1 1 #!/bin/bash
2 2
3 + if [ $(ip -6 route | grep -c ^default) -eq 0 ]; then exit; fi
3 4 apt install socat || exit
4 5 cat > /etc/systemd/system/socat\@.service <<EOF
5 6 [Unit]

waja revised this gist 4 years ago. Go to revision

1 file changed, 20 insertions

deploy_socat_ipv6_ipv4_proxy.sh(file created)

@@ -0,0 +1,20 @@
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
Newer Older