2

I'm not a network engineer but I'm trying to configure my linux machine to have internet access while being connected to my VPN.

My current idea to solve this is to connect to my VPN while configuring my machine NOT to re-configure my routes after connecting to my VPN, then I would manually configure my machine's routes to access my VPN when I need to (i.e. for a specific IP range).

So I'm currently trying to understand the following routing table:

$ 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     50     0        0 ppp0
0.0.0.0         192.168.16.1    0.0.0.0         UG    600    0        0 wlp8s0
10.100.0.0      0.0.0.0         255.255.255.255 UH    50     0        0 ppp0
62.135.17.146   192.168.16.1    255.255.255.255 UGH   0      0        0 wlp8s0
192.168.16.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp8s0

How is it possible to have a 0.0.0.0 gateway for my VPN (ppp0) interface ?! Every possible information about my mentioned routing table is much appreciated. But in English please :D

1
  • Just reconfigure your VPN service to not push a default route to its clients.
    – EEAA
    Mar 28 '16 at 17:25
1

Your interface ppp0 is a Point-to-Point Protocol tunnel. PPP connections are designed to only go from one point to another, so there is no need for IP addressing. Essentially, if your machine sends a packet out over the PPP interface, there's only one place it can go! So no need to differentiate the possible recipients with different IP addresses.

You didn't specify which VPN software you're using, but configuring which routes are pushed to a client is a common option. If you're using OpenVPN, you can find information on defining which routes to push here.

EDIT: It seems like you may be using a PPTP VPN (which, by the way, is no longer sercure and should be avoided if possible). In that case, you can configure what routing entries are added by doing something like this:

Route traffic via ppp0

To route traffic via PPP0 interface, edit /etc/ppp/ip-up.d/route-traffic

vi /etc/ppp/ip-up.d/route-traffic

Append following sample code (modify NET an IFACE as per your requirments):

#!/bin/bash
NET="10.0.0.0/8" # set me
IFACE="ppp0" # set me
#IFACE=$1
route add -net ${NET} dev ${IFACE}

Save and close the file:

chmod +x /etc/ppp/ip-up.d/route-traffic

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.