masquerade fix
This commit is contained in:
parent
27431ddc89
commit
ad3eedff60
2 changed files with 5 additions and 4 deletions
|
|
@ -1,2 +0,0 @@
|
||||||
DEST6=fc00::2
|
|
||||||
DEST4=10.0.0.2
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
. data/dest.env
|
|
||||||
cat <<EOF >> /etc/sysctl.conf
|
cat <<EOF >> /etc/sysctl.conf
|
||||||
net.ipv6.conf.all.forwarding = 1
|
net.ipv6.conf.all.forwarding = 1
|
||||||
net.ipv4.ip_forward = 1
|
net.ipv4.ip_forward = 1
|
||||||
|
|
@ -12,7 +11,9 @@ for v in 6 ""; do
|
||||||
ip${v}tables -A FORWARD -i awg0 -j ACCEPT
|
ip${v}tables -A FORWARD -i awg0 -j ACCEPT
|
||||||
ip${v}tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
ip${v}tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||||
done
|
done
|
||||||
for sock in tcp:25 80 443 2235=22 udp:443; do
|
DEST6=fc00::2
|
||||||
|
DEST4=10.0.0.2
|
||||||
|
for sock in tcp:25 80 443 32831=22 udp:443; do
|
||||||
if [[ "$sock" == *:* ]]; then
|
if [[ "$sock" == *:* ]]; then
|
||||||
PORT=${sock#*:}
|
PORT=${sock#*:}
|
||||||
PROTO=${sock%:*}
|
PROTO=${sock%:*}
|
||||||
|
|
@ -32,6 +33,8 @@ for sock in tcp:25 80 443 2235=22 udp:443; do
|
||||||
-p $PROTO --dport $PORT -j DNAT --to-destination $DEST4:$DPORT
|
-p $PROTO --dport $PORT -j DNAT --to-destination $DEST4:$DPORT
|
||||||
iptables -A FORWARD -d $DEST4 -p $PROTO --dport $DPORT -j ACCEPT
|
iptables -A FORWARD -d $DEST4 -p $PROTO --dport $DPORT -j ACCEPT
|
||||||
done
|
done
|
||||||
|
ip6tables -t nat -A POSTROUTING -s $DEST6 -d $DEST6 -j MASQUERADE
|
||||||
|
iptables -t nat -A POSTROUTING -s $DEST4 -d $DEST4 -j MASQUERADE
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
add-apt-repository -y ppa:amnezia/ppa
|
add-apt-repository -y ppa:amnezia/ppa
|
||||||
apt-get install -y software-properties-common python3-launchpadlib gnupg2 \
|
apt-get install -y software-properties-common python3-launchpadlib gnupg2 \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue