ip route add HOMEIP via SERVERIP disconnects me from ssh

1

0

I want to use a vpn connection on my Debian server but I get disconnected from ssh if I connect to the vpn. I thought by using the "ip route add" I can prevent getting disconnected from my server and it will continue to use the main connection for communication between my computer and the server, and the vpn for communication with other ips.

This is the command I use

ip route add PUBLICHOMEIP via PUBLICSERVERIP

But I get disconnected after the "ip route add" command too. Am I making a mistake anywhere?

Arya

Posted 2013-06-24T08:07:29.357

Reputation: 437

Can you provide the value of PUBLICHOMEIP and PUBLICSERVERIP or are they too sensitive? Also, the common way to had a router through a router is ip route add <subnet> via <router> dev <dev>. – pilona – 2013-06-24T18:11:13.423

I don't want to provide the full ip but it looks like this: x represents a single digit. ip route add 65.92.234.xxx via 178.18.xx.xxx – Arya – 2013-06-25T08:49:49.143

Answers

0

I found out how to fix the problem. The public server IP Address should not be entered but the server's gateway IP Address should be entered. You can find the server's gateway IP Address by using this command

route -n # if using the old, deprecated net-tools
ip route # or just `ip r`, if using iproute2

Here is a link for finding server's gateway IP address.

Arya

Posted 2013-06-24T08:07:29.357

Reputation: 437

"server's gateway" rather than the "server's IP" - of course. The router must always be directly connected. You then had a more specific route than your default one that just blackholed packets. – pilona – 2013-06-25T20:22:03.607