0

I have a Ubuntu 16.04 server running OpenVPN (via UPD).

This works great, except once it connects to VPN, I get kicked out of the SSH connection, and the DNS/http connections no longer resolve.

This is as expected, but how do I still keep those connections working while having the server's outbound requests go through the VPN?

99miles
  • 361
  • 3
  • 6
  • 16
  • It is getting kicked because your routing is changing. You need to fixed the routing. The exact details are very specific to a given configuration/network. – Zoredache Jul 30 '18 at 19:53
  • @Zoredache Yep, I'm looking for guidance on how to do this. What else do you need to know? – 99miles Jul 30 '18 at 20:18

1 Answers1

0

You have routing problem enabling OpenVPN. Lets assume you're connected to Internet through router with local IP 192.168.0.1 (IP of router in local network) and your SSH-server (you're connecting to) IP is 999.999.999.999. Then add the route:

ip route add 999.999.999.999/32 via 192.168.0.1

If you have no success, just delete the rule:

ip route del 999.999.999.999/32 via 192.168.0.1

and try this:

ip rule add from 192.168.0.12 table 128
ip route add table 128 to 192.168.0.0/24 dev eth0
ip route add table 128 default via 192.168.0.1

Where 192.168.0.12 is your local IP address, 192.168.0.0/24 - subnet of your local IP, 192.168.0.1 - IP of your router in the local network, eth0 - your network interface name.

If the problem hasn't gone away afterwards, delete rules replacing add with del and just tell more in comments about your network connections and configuration - as much as possible.

P.S. The rules/routes above are temporary - until next reboot. To make it persistent, just add to your /etc/network/interfaces corresponding lines with leading up, for example:

up ip route add 999.999.999.999/32 via 192.168.0.1

Read this: http://www.networkinghowtos.com/howto/adding-persistent-static-routes-on-ubuntu/

Bob
  • 101
  • 1