1

I've been using Ubuntu for years but still consider myself and newbie.

Prior to installing OpenVPN I used to be able to access my Ubuntu file server from the outside world by port forwarding port 22 on my ISP router to the IP address of my Ubuntu server. Worked perfectly.

However, I was looking at using an OpenVPN tunnel for a backup process I'm doing. On my home network (behind the ISP Router) I've created a OpenVPN server using an old laptop. I then installed OpenVPN on my Ubuntu file server and ran it as a client. Once connected I'm able to access the VPN server laptop no trouble over tun0. However, I am no longer able to remotely access my file server from the outside world. I can SSH to it from inside my network using the non VPN IP address (using a computer not on the VPN).

After reading a number of posts I'm thinking that the Ubuntu file server is no longer using the router gateway for sending data, it using the VPN... which of course won't work. There are posts relating to using routing tables to change this but from what I understand this doesn't work with netplan... which is now used by Ubuntu?

I have no idea what to try and do next to get this work. Thanks in advance.

0

Of course netplan works and you can set routing with it. But for this use case there is much easier solution, use sshuttle.

  • establish your VPN tunnel
  • sshuttle -r user@ip_of_vpn_server your_home_network_address
  • and suddenly your machine behaves like it was in your home network, you can access all your home IPs like from home

Example

  • conenction to VPN server established
  • lets say VPN server address on VPN tunnel is 10.0.0.1
  • lets say your home network is 192.168.10.0/24
  • lets say you ssh to vpn server using user ubuntu
  • sshuttle -r ubuntu@10.0.0.1 192.168.10.0/24
  • that's it

note: sshuttle will run iptables commands so it will use sudo

1
  • Thanks... after I posted the question last night I realized that I may need more than SSH. For example, my file server runs insync (which is a linux intereface for Google Drive). It syncs some of my drive data with Google Drive online. Therefore, it also would need insync to have access to the outside world as well. Is there where I would need to use routing? Another option I thought of was that I only need my tunnel during a backup (middle of the night). I guess my backup script could turn the VPN client on before the backup and off after the backup??? – Andrew Blundon Apr 8 '19 at 10:50

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.