1

I am running an Ubuntu server. That server connects to a VPN using OpenVPN, which works fine. I can access the server via SSH (and the web, etc.) from inside the LAN. I want to open SSH through my network provider's router. I can open port 22 and forward to the server, and from out of network if the VPN is down, it works fine. If the VPN is up, I cannot connect, so clearly it's a routing problem. Below is the routing table with the VPN running:

Kernel IP routing table (without vpn)

Destination     Gateway         Genmask         Flags Iface
default         *ISP*           0.0.0.0         UG    enp3s0
192.168.1.0     *               255.255.255.0   U     enp3s0
192.168.1.0     *               255.255.255.0   U     br0

Kernel IP routing table (public IPs edited)

Destination     Gateway         Genmask         Flags  Iface
default         10.@.@.5        128.0.0.0       UG    tun0
default         ISP             0.0.0.0         UG    enp3s0
5.@.@.114       ISP             255.255.255.255 UGH   enp3s0
10.@.@.1        10.@.@.5        255.255.255.255 UGH   tun0
10.@.@.5        *               255.255.255.255 UH    tun0
128.0.0.0       10.@.@.5        128.0.0.0       UG    tun0
192.168.1.0     *               255.255.255.0   U     enp3s0
192.168.1.0     *               255.255.255.0   U     br0

br0 is a bridged adapter for a running container so I don't think it comes into play here.

Is there a route command I can run to force all SSH traffic through enp3s0?


As further clarification, I have the Ubuntu server on my local network. I use a VPN from it for internet purposes. I would also like to be able to SSH into the server from outside my network using the IP from my ISP, not the VPN. When the VPN is active all traffic, except local, is routed through it. With VPN on I can SSH into the server from local network fine, but not from outside the network. When the VPN is down, I can SSH into it from anywhere. I have tried binding OpenSSH to the mail adapter, but no luck. I just need to know how to have the server route all SSH traffic over the specified interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.