Iptables REDIRECT + openvpn problem
- by Emilio
I want to redirect connection to port 22 to my openvpn binded port, on 60001.
Openvpn is running on server on 60001
server:~$ sudo netstat -apn | grep openvpn
udp 0 0 67.xx.xx.137:60001 0.0.0.0:* 4301/openvpn
I redirect on server port 22 to 60001
server:~$ sudo iptables -F -t nat
server:~$ sudo iptables -A PREROUTING -t nat -p udp --dport 22 -j REDIRECT --to-ports 60001
I start openvpn client (openvpn.conf is correct, it works with remote IP 22 replaced with remote IP 60001)
client:~$ ./openvpn openvpn.conf
Tue Apr 27 00:42:50 2010 OpenVPN 2.1.1 i686-pc-linux-gnu [SSL] [EPOLL] built on Mar 23 2010
Tue Apr 27 00:42:50 2010 UDPv4 link local (bound): [undef]:1194
Tue Apr 27 00:42:50 2010 UDPv4 link remote: 67.xx.xx.137:22
Tue Apr 27 00:42:52 2010 read UDPv4 [ECONNREFUSED]: Connection refused (code=111)
Tue Apr 27 00:42:55 2010 read UDPv4 [ECONNREFUSED]: Connection refused (code=111)
...
It doesn't connect. iptables shows requests from client to server but no answers. What's wrong with it?