Without VPN
$ route
default 192.168.50.123 0.0.0.0 UG 0 0 0 wlan0
192.168.50.0 * 255.255.255.0 U 2 0 0 wlan0
$ nmcli con up id "My VPN"
After VPN
# route
VPN
default * 0.0.0.0 U 0 0 0 ppp0
myvpn 192.168.50.123 255.255.255.255 UGH 0 0 0 wlan0
myvpn 192.168.50.123 255.255.255.255 UGH 0 0 0 wlan0
192.168.0.1 * 255.255.255.255 UH 0 0 0 ppp0
192.168.50.0 * 255.255.255.0 U 2 0 0 wlan0
After connecting to VPN all traffic goes through VPN, but I need to connect to a server in my office out of the vpn
So I create a route to the server to use wlan0 ( not ppp0 ) when the destination address is the address of my server
$ sudo route add -net 192.168.33.12 netmask 255.255.255.255 gw 192.168.50.123 dev wlan0
or
$ sudo route add -host 192.168.33.12 gw 192.168.50.123 dev wlan0
$ route
default * 0.0.0.0 U 0 0 0 ppp0
myvpn 192.168.50.123 255.255.255.255 UGH 0 0 0 wlan0
myvpn 192.168.50.123 255.255.255.255 UGH 0 0 0 wlan0
192.168.0.1 * 255.255.255.255 UH 0 0 0 ppp0
192.168.33.12 192.168.50.123 255.255.255.255 UGH 0 0 0 wlan0
192.168.50.0 * 255.255.255.0 U 2 0 0 wlan0
and to remove
$ sudo route del -net 192.168.33.58 netmask 255.255.255.255
No comments:
Post a Comment