diff --git a/jobs/port_forwarding/templates/bin/forward_ports.sh.erb b/jobs/port_forwarding/templates/bin/forward_ports.sh.erb index dfe889c..56612d0 100644 --- a/jobs/port_forwarding/templates/bin/forward_ports.sh.erb +++ b/jobs/port_forwarding/templates/bin/forward_ports.sh.erb @@ -30,7 +30,7 @@ sysctl net.ipv4.conf.all.route_localnet=0 <% internal_ip = rule['internal_ip'] || "127.0.0.1" %> <% internal_port = rule['internal_port'] || raise("Expected non-empty 'internal_port' on '#{rule.inspect}' rule") %> - sudo iptables -t nat -A portforwarding-release -p tcp --dport <%= external_port %> -j DNAT --to <%= internal_ip %>:<%= internal_port %> + sudo iptables -t nat -A portforwarding-release -p tcp -d <%= spec.networks.send(spec.networks.methods(false).first).ip %> --dport <%= external_port %> -j DNAT --to <%= internal_ip %>:<%= internal_port %> <% if internal_ip == "127.0.0.1" %> sysctl net.ipv4.conf.all.route_localnet=1