33 lines
1.0 KiB
Bash
33 lines
1.0 KiB
Bash
#!/usr/bin/sh
|
|
|
|
nft delete chain ip nat post
|
|
nft delete chain ip nat pre
|
|
nft delete chain ip6 nat pre
|
|
nft delete chain ip6 nat post
|
|
|
|
nft delete table ip nat
|
|
nft delete table ip6 nat
|
|
|
|
nft add table ip nat
|
|
nft add chain ip nat post { type nat hook postrouting priority 0 \; }
|
|
nft add chain ip nat pre { type nat hook prerouting priority 0 \; }
|
|
|
|
nft add rule ip nat post ip saddr 10.0.3.1/24 oif eth0 masquerade
|
|
|
|
nft add table ip6 nat
|
|
nft add chain ip6 nat pre { type nat hook prerouting priority 0 \; }
|
|
nft add chain ip6 nat post { type nat hook postrouting priority 0 \; }
|
|
|
|
nft add rule ip6 nat post ip6 saddr fdfa:7522:4682::/64 oif eth0 masquerade
|
|
|
|
ip -6 addr add fdfa:7522:4682::/64 dev lxcbr0
|
|
|
|
nft add rule ip nat pre ip daddr 167.235.243.25 tcp dport 10022 dnat to 10.0.3.1:22
|
|
nft add rule ip nat pre ip daddr 167.235.243.25 tcp dport 20022 dnat to 10.0.3.246:22
|
|
|
|
nft add rule ip6 nat pre ip6 daddr 2a01:4f8:c17:9301::1/64 tcp dport 10022 dnat to [fe80::9400:4ff:fefa:ba79]:22
|
|
|
|
for i in /proc/sys/net/ipv6/conf/*; do
|
|
echo 1 > $i/forwarding
|
|
done
|