This is my home network configuration:

Devices/Pc/Smartphone ---> DD-WRT Router ---> Internet Router ---> Internet/World

  • DD WRT router ip: (default gw is

  • Internet Router ip:

  • Devices ip going from to

I would like to configure the DD WRT flashed router with a PPTP VPN client running. The PPTP VPN virtual device is called ppp0.

then :

  • All ip ranging from to pass through Vpn (so, pass through ppp0 inteface and ppp0 gateway)
  • All others ip uses default lan gateway (so, not uses vpn)

When i start VPN client on DD WRT, my route table is via dev eth0 
default via dev ppp0  scope link via dev eth0 via dev eth0 dev lo  scope link dev br0  proto kernel  scope link  src dev br0  proto kernel  scope link  src dev eth0  proto kernel  scope link  src via dev eth0 dev ppp0  scope link 

Now, i think i've to replace

  • default via dev ppp0


  • default via dev eth0

so ALL ip go through standard internet gateway (no PPTP vpn)... then add a rule like

  • via dev ppp0

to allow ONLY ip to exit using PPTP.

But..it isn't working!

So my final question is:

  • How to configure my router route all IP through default internet gateway ( AND only One Ip (or a range of ip) to exit using pptp vpn connection ?

Thanks a lot!


A network route does not take into account the source ip address, only the destination ip address. This is like saying "if someone wants to go to network, use the 192.168.1.xx as the gateway".

What you want to do is saying: " Traffic coming from this ip address goes to internet via this specific gateway ".

This is slightly more complicated. The standard solution for this in Linux is to use the features of the iproute2 package.

  1. Create a new default route on an alternative table ip route add table 55 default via dev ppp0
  2. Mark traffic you want to route iptables -t mangle -I PREROUTING 1 -s -j MARK --set-mark 55
  3. Create a rule so that traffic marked as 55 is routed via table 55 ip rule add fwmark 55 table 55

At this point if you run a tcpdump on interface ppp0 and send some traffic from your device you should see some traffic.

Now you will probably have 2 problems:

  1. NAT : it is likely that you have to add a nat rule so that traffic going out via the ppp0 interface is natted with the interface ip address
  2. fragmentation : your ppp0 interface has probably a MTU which is smaller than the mtu of your eth0 interface, so you have to install a TCPMSS rule to clamp the traffic to something between 1300 and 1400

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.