sudo ip route add 192.168.1.2 dev ppp0
Recently my Aunty had some problems with her backup software at her business and asked if I could help. I could connect in to their VPN but their network was on the 192.168.1.1/24
subnet and I was on a hotel WiFi that was also on the 192.168.1.1/24
subnet.
The best solution would be to change the subnets, but I couldn't really ask the hotel to change their network and my Aunty wasn't about to change either.
There are some ways you can make it work with DNS and NAT but that's a lot of work to set up and I really just wanted to access one server quickly.
Instead in Linux you can use the ip command to tell it that you want to route packets via a specific interface so I was able to force all packets for 192.168.1.2
over the VPN.
sudo ip route add 192.168.1.2 dev ppp0
I was able to access the server and fix the backups. It's not a good long term solution because it will break other things, but it's a neat little hack that can get you out of a pinch.