How to route my traffic through the VPN

manmad dvb12er dvb12er at yandex.com
Thu Aug 28 06:52:51 PDT 2014


Thanks a lot for your quick replay.
Regards the script, I forgot to mention that I used it from the command line.
Anyway, the "Use this connection only for resources on its network" is not set.
How can I change the default route?
I tried:
sudo route add -net 0.0.0.0  vpn0
But it didn't worked: I had no internet access. Am I doing something wrong?
Thanks.

28.08.2014, 17:44, "David Woodhouse" <dwmw2 at infradead.org>:
> On Thu, 2014-08-28 at 17:32 +0400, manmad dvb12er wrote:
>>  Hello there,
>>  I'm having trouble trying to connect through openconnect VPN on Ubuntu 14.04.
>>  What I basically need is to route my HTTP\S traffic in such way that my public IP will be the VPN address.
>>  I'm connecting using the "network-manager-openconnect".
>>  Here is my route table after I connect to the VPN:
>>  Kernel IP routing table
>>  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
>>  0.0.0.0         10.0.0.138      0.0.0.0         UG    0      0        0 wlan0
>>  10.0.0.0        0.0.0.0         255.0.0.0       U     9      0        0 wlan0
>>  10.100.100.0    0.0.0.0         255.255.255.0   U     0      0        0 vpn0
>>  xx.yy.zz.cc    10.0.0.138      255.255.255.255 UGH   0      0        0 wlan0
>>  192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 vpn0
>>  192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 vpn0
>>
>>  Where xx.yy.zz.cc is the IP of the VPN server.
>>  When I go to "what is my ip" service, I get the same old IP instead of the VPN's one.
>
> Right, so you are using the VPN only for connections to 192.168.1.0/23
> and 10.100.100.0/24 networks. Anything *else* is still routed through
> your wireless.
>
> What you want to do, I assume, is change your default route so that
> instead of going through your local gateway 10.0.0.138 it actually goes
> to the VPN.
>>  I downloaded the last version of the script from here: http://www.infradead.org/openconnect/vpnc-script.html, nothing changed.
>
> You aren't using that; you're using NetworkManager. That uses a 'script'
> of its own which actually just passes all the routing information back
> to NetworkManager over DBus and lets NetworkManager do it all.
>
> Check your NetworkManager configuration for this connection. Go into the
> advanced routing settings. There's a really badly misnamed option there
> called "Use this connection only for resources on its network". If
> that's set, then it'll refuse to set the default route through the VPN
> even if the VPN server asks for it.
>
> Are you sure your VPN server *is* requesting that the default route be
> through the VPN? If not, you'll want to use the manual routing settings
> in the NetworkManager configuration to do that.
>
> --
> dwmw2



More information about the openconnect-devel mailing list