After adding the following DNAT rule I'm getting connection refused when attempting to curl 172.17.1.1:9000/v1/api
:
iptables -t nat -I PREROUTING -p tcp --dst 172.17.1.1 --dport 9000 -j DNAT --to-destination 172.12.11.11:8000
I've read this post and this post and seems like for curl we need to add an OUTPUT rule for the loopback? But how do we do this for DNAT rules?
I do have the following rules in place:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT