Hi ALL
I want to use iptables module to manage port forwarding
----> EXT_IP:EXT_PORT ----> INT_IP:INT:PORT
If user request EXT_IP with port 8001, it will forward to INT_IP ( 192.168.100.131 ) and port 22.
I use iptables module but fail
# ansible -m iptables -a ‘table=nat chain=PREROUTING protocol=tcp match=tcp destination_port=8001 jump=REDIRECT to_destination=192.168.100.131 to_ports=22’ gateway --ask-pass
gateway | FAILED! => {
“changed”: false,
“cmd”: “/usr/sbin/iptables -t nat -A PREROUTING -p tcp -m tcp -j REDIRECT --to-destination 192.168.100.131 --destination-port 8001 --to-ports 22”,
“failed”: true,
“msg”: “iptables v1.4.21: unknown option "–to-destination"\nTry `iptables -h’ or ‘iptables --help’ for more information.”,
“rc”: 2,
“stderr”: “iptables v1.4.21: unknown option "–to-destination"\nTry `iptables -h’ or ‘iptables --help’ for more information.\n”,
“stdout”: “”,
“stdout_lines”:
}
I already check https://docs.ansible.com/ansible/iptables_module.html
Pleas tell me which option I should use?
Thanks