38 lines
1.5 KiB
Bash
38 lines
1.5 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 enp1s0 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 nast post ip6 saddr fd96:d0e4:4979::/64 oif enp1s0 masquerade
|
|
|
|
ip -6 addr add fd96:d0e4:4979://64 dev lxcbr0
|
|
|
|
nft add rule ip nat pre ip daddr 116.203.17.85 tcp dport 10022 dnat to 10.0.3.1:22
|
|
nft add rule ip nat pre ip daddr 116.203.17.85 tcp dport 22 dnat to 10.0.3.10:22
|
|
nft add rule ip nat pre ip daddr 116.203.17.85 tcp dport 20022 dnat to 10.0.3.113:22
|
|
nft add rule ip nat pre ip daddr 116.203.17.85 tcp dport 30022 dnat to 10.0.3.17:22
|
|
|
|
nft add rule ip6 nat pre ip6 daddr 2a01:4f8:1c1b:89d2::2/64 tcp dport 10022 dnat to [fe80:9400:2ff:fefa:9ba6]:22
|
|
nft add rule ip6 nat pre ip6 daddr 2a01:4f8:1c1b:89d2::2/64 tcp dport 22 dnat to [fd96:d0e4:4979::1]:22
|
|
nft add rule ip6 nat pre ip6 daddr 2a01:4f8:1c1b:89d2::2/64 tcp dport 20022 dnat to [fd96:d0e4:4979::2]:22
|
|
nft add rule ip6 nat pre ip6 daddr 2a01:4f8:1c1b:89d2::2/64 tcp dport 30022 dnat to [fd96:d0e4:4979::3]:22
|
|
|
|
for i in /proc/sys/net/ipv6/conf/*; do
|
|
echo 1 > $i/forwarding
|
|
done
|