4

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?

2

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

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

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.