@@ -69,24 +69,34 @@ echo "Docker Host: $docker_host_ip ($docker_host_source)"
69
69
PORTS=" ${PORTS:- " 1-65535" } "
70
70
PORTS=" $( echo ${PORTS// ,/ } ) "
71
71
72
- nft add table nat
73
- nft add chain nat prerouting { type nat hook prerouting priority -100 \; }
74
- nft add chain nat postrouting { type nat hook postrouting priority 100 \; }
72
+ # nft add table nat
73
+ # nft add chain nat prerouting { type nat hook prerouting priority -100 \; }
74
+ # nft add chain nat postrouting { type nat hook postrouting priority 100 \; }
75
75
76
76
echo " Forwarding ports: ${PORTS// / , } "
77
77
for forwarding_port in $PORTS
78
78
do
79
79
docker_container_port=" ${forwarding_port%%:* } "
80
80
docker_host_port=" ${forwarding_port#*: } "
81
81
82
- nft add rule nat prerouting tcp \
83
- dport " ${docker_container_port} " dnat to " $docker_host_ip :$docker_host_port "
84
- nft add rule nat prerouting udp \
85
- dport " ${docker_container_port} " dnat to " $docker_host_ip :$docker_host_port "
86
-
82
+ # nft add rule nat prerouting tcp \
83
+ # dport "${docker_container_port}" \
84
+ # dnat to "$docker_host_ip:$docker_host_port"
85
+ iptables-legacy --table nat --insert PREROUTING \
86
+ --protocol tcp --destination-port " ${docker_container_port/ -/: } " \
87
+ --jump DNAT --to-destination " $docker_host_ip :$docker_host_port "
88
+
89
+ # nft add rule nat prerouting udp \
90
+ # dport "${docker_container_port}" \
91
+ # dnat to "$docker_host_ip:$docker_host_port"
92
+ iptables-legacy --table nat --insert PREROUTING \
93
+ --protocol udp --destination-port " ${docker_container_port/ -/: } " \
94
+ --jump DNAT --to-destination " $docker_host_ip :$docker_host_port "
87
95
done
88
96
89
- nft add rule nat postrouting masquerade
97
+ # nft add rule nat postrouting masquerade
98
+ iptables-legacy --table nat --insert POSTROUTING --jump MASQUERADE
99
+
90
100
91
101
# --- Drop root access and "Ah, ha, ha, ha, stayin' alive" ---------------------
92
102
0 commit comments