0

I tried to follow the solutions listed here for being able to continue SSH connections after connecting to an openvpn client: https://www.linode.com/community/questions/7381/openvpn-client-connected-to-a-server-while-listening-to-ssh

with the following commands:

ip rule add from xxx.xxx.213.210 table 128
ip route add table 128 to xxx.xxx.213.210/32 dev enp2s0
ip route add table 128 default via xxx.xxx.213.193

When I try to run the 3rd command I get the following error:

Error: Nexthop has invalid gateway.

The problem I am trying to solve with this solution is sending all traffic over openvpn except for traffic which originates from externally and is directed at my public ip address (incoming vnc, ssh, websocket connections to servers on this host).


Here is some potentially helpful information about my networking setup:

This is my ip route output before any changes:

$ ip route
default via xxx.xxx.213.193 dev enp2s0 proto static onlink 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown

This is my ifconfig output before any changes:

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet xxx.xxx.213.210  netmask 255.255.255.255  broadcast 0.0.0.0
forTruce
  • 121
  • 4

1 Answers1

0

I solved this by running the following commands:

sudo ip rule add from xxx.xxx.213.210 table 128
sudo ip route add table 128 to xxx.xxx.192.0/18 dev enp2s0
sudo ip route add table 128 default via xxx.xxx.213.193

where xxx.xxx is the first two segments of my ip

forTruce
  • 121
  • 4