I have a computer running Debian that connects to a VPN-server. I can connect to this computer with another computer, through the VPN-server.

Now, I would like the incoming traffic (from the VPN-server, to the Debian-computer) to be routed by the Debian computer.

I've tried this (setup Debian as router), but when I try to run it, it says "Bad argument `tun0'". I want to do as they do it in the link, but instead of routing from one interface to another (eth0 -> eth1 and vice versa), I want the traffic from tun0 to be distributed through eth0.

Any suggestions on how I can achieve this?

  1. Enable IP Forwarding on your Debian:

    sysctl -w net.ipv4.ip_forward=1

  2. Add eth0 as default route on your Debian:

    ip route add default gw dev eth0

  3. Add Debian box as the default gateway on your VPN Server

Consider enabling destination NAT or other mechanism on Debian box if it is required.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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