how to access openvpn outside my LAN

6,806

Solution 1

You need to have a port forward from your public ip address. There is no other way how to connect from outside. Talk to your ISP regarding the port forwarding. Some ISP provide port forwarding free of charge, whereas an extra public IP address costs something.

Solution 2

I don't trust the method you used to determine your ISP "filters all ports so you're unable to do port forwarding". If you haven't set up port forwarding, no ports are going to be open on your IP address, which doesn't necessarily mean your ISP is doing anything.

To port forward, you need to log in to your router (most likely supplied to you by your ISP) and then Google "how to set up port forwarding on <router name/make/model>". For example, for the SuperHub 3:

https://www.google.co.uk/search?q=How+to+set+up+port+forwarding+on+the+SuperHub+3

What port(s) you forward to your Ubuntu 18.04 server to access OpenVPN will depend on how you set up OpenVPN. If you used the default OpenVPN server configuration, you'll have to forward UDP port 1994 to the IP address of your Ubuntu 18.04 server.

You can find out what port OpenVPN is running on by running:

$ sudo ss -plntu
Netid   State     Recv-Q    Send-Q        Local Address:Port       Peer Address:Port                                                  
udp     UNCONN    21504     0             127.0.0.53%lo:53              0.0.0.0:*        users:(("systemd-resolve",pid=603,fd=12))    
udp     UNCONN    768       0                   0.0.0.0:1194            0.0.0.0:*        users:(("openvpn",pid=831,fd=7))             
tcp     LISTEN    0         128           127.0.0.53%lo:53              0.0.0.0:*        users:(("systemd-resolve",pid=603,fd=13))    
tcp     LISTEN    0         128                 0.0.0.0:22              0.0.0.0:*        users:(("sshd",pid=852,fd=3))                
tcp     LISTEN    0         128                    [::]:22                 [::]:*        users:(("sshd",pid=852,fd=4)) 

From the above it can be seen that OpenVPN is using UDP port 1194 (in this particular case).

Share:
6,806

Related videos on Youtube

Harrish Kumar
Author by

Harrish Kumar

Updated on September 18, 2022

Comments

  • Harrish Kumar
    Harrish Kumar over 1 year

    I freshely installed an OpenVpn on my machine which runs ubuntu server 18.04 LTS. I scanned my ports with nmap it seems to be my ISP filtered all ports so i'm unable to do port forwarding. Is there any way to access OpenVpn outside my LAN without port forwarding.

    • Apologician
      Apologician almost 6 years
      All your ports are not filtered. Your port 80 isn't blocked otherwise you wouldn't be able to properly use the web. What did you to "scan" your ports?
    • Harrish Kumar
      Harrish Kumar almost 6 years
      @L.D.James nmap -sA -PnO -p 80 my_public_IP
  • Harrish Kumar
    Harrish Kumar almost 6 years
    I know i have to do port forwarding, already know that but i need alternate solution if it exists.
  • Andy Turfer
    Andy Turfer almost 6 years
    If your ISP blocks incoming traffic to all ports, then switch ISPs. That's about the only alternative you'll have if that's the case. Actually, there is another possibility - reverse SSH port forwarding with some fancy routing rules and/or dynamic port fowarding. Using reverse tunneling and/or dynamic forwarding will require another server on the Internet that does not have any port restrictions.
  • Harrish Kumar
    Harrish Kumar almost 6 years
    i already tried port forwarding in my router.
  • Andy Turfer
    Andy Turfer almost 6 years
    Did you use nmap to scan your IP address after you had set up port forwarding?
  • Harrish Kumar
    Harrish Kumar almost 6 years
    yes, i do nmap scan