3

I created a OpenVPN Server on my Ubuntu 18.04 home server using this tutorial. I can't connect to my VPN using tunnelblink on my mac but I get a message saying that my apparent IP address did not change. I want to be able to connect to my VPN and then access my home network as if I was there. I have a file server that I want and a media server. My computer says its connected to the VPN but I can't SSH into my server afterward. I also port forwarded 1194 to my VPN server. I followed the instructions to a tee however I did not do either of the optional steps.

Can anyone help?

10
  • I don't think this is how a vpn works... But I am no expert on vpns. Why are you not just using ssh to connect to the server? Why add this extra layer of complexity that is the vpn?
    – j-money
    Aug 28, 2018 at 18:12
  • Because I don’t want to just port forward my ssh because and then anybody can SSH into my computer if they get my public ip Aug 28, 2018 at 18:15
  • @j-money from what I have read, OpenVPN is meant for exactly this Aug 28, 2018 at 18:25
  • Are you trying to start ssh connection to the server after your machine has vpn connection to the server? That shouldn't be problem but you do need to open a firewall rules to allow ssh if you have block port 22. You can unlock it for internal vpn IP's if you don't want external excess. What is your internal IP pool? 10.8.0.XXX ? Aug 28, 2018 at 18:31
  • @BernardWei yes that is what I’m trying to do... I allowed port 22 on my ufw... what is an internal IP pool? Aug 28, 2018 at 18:36

1 Answer 1

6

To limit SSH connect for VPN clients, you need to first open port 22 for the VPN subnet. Using the default OpenVPN subnet 10.8.0.1/24

sudo ufw enable
sudo ufw allow 1194/udp comment "Allowing OpenVPN Connections"
sudo ufw allow from 10.8.0.1/24 to any port 22 proto tcp comment "SSH allowed for VPN clients"

Now after connecting to the VPN, SSH the server with

ssh [email protected]
3
  • Is there a way to still reach the server via its FQDN instead of the internal OpenVPN IP?
    – slhck
    Mar 27, 2019 at 14:03
  • If you follow the standard setup for OpenVPN, it is possible to reach the server using external FQDN, but you need configure the firewall to allow SSH connections from those origins. Or you could just open all external connections for SSH using sudo ufw allow ssh. Apr 1, 2019 at 20:07
  • I've used this script: github.com/angristan/openvpn-install — I only want to allow SSH from specific IP ranges and the server itself, if I'm connected to it via VPN. I can't add the FQDN with ufw ("Bad source address"), obviously, but I'll try with the server's fixed external IP address.
    – slhck
    Apr 2, 2019 at 9:22

You must log in to answer this question.

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