I have a VPN server which connected to the internet over eth0. And VPNetwork's device is as0t0/as0t1. I have a specified VPN Client which i want to reach it over internet over VPN Server's public Internet IP(x.x.x.x).

I want to reach VPN Client over 7777 port over Pure Internet, but it is behind the NAT. I want that: When i connect to the x.x.x.x:7777, it must be routed to the VPN Client's same port.

I have tried somethings using iptables. But didn't worked. Is it true way? If yes, what must i do exactly?


You need to DNAT from Public IP Address to client IP address in VPN network. Assume your public IP is and client IP address is, use following command:

iptables -t nat -A PREROUTING -p tcp -d --dport 7777 -j DNAT --to-destination

Be sure that client's default gateway is your VPN server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.