I'm currently using "strongSwan" ipsec VPN client on linux.
I can connect to my VPN server, default route automatically set to 10.10.10.1.
And I can access my local network by ip route add 192.168.7.0/24 dev ens33
ip route list
output:
default via 192.168.7.1 dev ens33 proto static src 10.10.10.1
172.17.0.0/16 dev docker0 scope link
192.168.7.0/24 dev ens33 scope link
Everything works well !
BUT!
Now I need to connect to another server from "my real IP", not VPN server.
(the server ip is 1.2.3.4
eg.)
I can ping 1.2.3.4
with 300ms lag, but can't connect because my IP was wrong.
Without VPN connected, ping will be 2~6ms.
Question: How to specify route to 1.2.3.4
, when default route is set to VPN
I have tried ip route add 1.2.3.4 dev ens33
But failed with "Destination Host Unreachable"
Best Answer
ip route add 1.2.3.4 via 192.168.7.1 dev ens33
if necessary replace
192.168.7.1
with the correct IP address of your internet gateway router (if it is not192.168.7.1
it might be192.168.7.254