I have a connection via VPN with my work. I know that internet connection (for example to goes through my work network (only when I am connected to VPN).

How to configure ip tables to force that connections to internet (for example avoid work network ?

Using @Julie help in comments I did managed to discover some options:

Nevertheless, after checking 'Use this connection only for resources...' I can't ping machines in VPN network.

Can you tell me how should I deal with it ? I guess that I should click 'Add' and set:
Address = address of some machine in VPN
Netmask = I can get it from ifconfig (in VPN interface)
Gateway - as in case of netmask
Metri - I have no idea ?

Am I right ?

  • 1
    There are many ways to do it. The best IMO is to set up your VPN client not to use that connection as the default route and only use it for the VPN's network. – Julie Pelletier May 19 '17 at 16:30
  • How to do it ? I am using NetworkManager (SSTP) – user188811 May 19 '17 at 16:41
  • 1
    If you're on Ubuntu, it should be in the connection's IPv4 Settings, Routes where you'd find a 'Use this connection only for resources on its network'. – Julie Pelletier May 19 '17 at 16:46
  • @JuliePelletier I have a problem still. When I check this option I can't get ping machines in VPN network. I have seen list to add address IP (in the same place as 'Use this connection only for resources on its network'. Can you tell what IP I should add to this list ? – user188811 May 19 '17 at 18:00
  • You probably just need to specify the CIDR of what you want to pass through the VPN such as or whatever your network topology is. – Julie Pelletier May 19 '17 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy