I cannot access to servers like 192.168.12.123 from vpn if "use this connection only for resources on its network" is checked in vpn settings/ipv4 settings/routes, but I can if this flag is unchecked.
routes address/netmask:
192.168.0.0 255.0.0.0
10.0.0.0 255.0.0.0
flag is unchecked:
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 ppp0
10.35.5.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
168.68.168.6 192.168.0.1 255.255.255.255 UGH 0 0 0 wlan0
168.68.168.6 192.168.0.1 255.255.255.255 UGH 0 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
flag is checked
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 ppp0
10.35.5.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
168.68.168.6 192.168.0.1 255.255.255.255 UGH 0 0 0 wlan0
168.68.168.6 192.168.0.1 255.255.255.255 UGH 0 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
main difference is gateway.
0.0.0.0 if flag is unchecked and 192.168.0.1 otherwise.
How to change gateway for checked flag?
Thanks for advance.
Best Answer
You can add default gateway with command
by the ip address
xxx.xxx.xxx.xxx
- represent ip of vpn serveror by interface
This can be done manually from terminal when you are connected to vpn.
Second solution is to make script to chance default gw when vpn is connected
Then create script witch will be executed when interface
ppp0
go up.Create script for
ppp0
interfaceput in script this
Save and exit.
Make script called
script
with execute permissions 755Explanation
When
vpn
connection will established andppp0
interface is up script will run and set default device toppp0
Also you can manually add route to resource on
vpn
sitexxx.xxx.xxx.xxx
- represent host/networkyy
- represent network maskexample:
add route to host
10.35.5.181
troughppp0
add route to network range
10.35.5.0
with mask255.255.255.0
troughppp0
This also can be done in
Network Manager
. On same places where isuse this connection only for resources on its network
you can add route.