Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following interfaces/routes :

# ip route show dev eth0  proto kernel  scope link  src dev tun0  proto kernel  scope link  src
default via dev eth0

Device eth0 is connected to a network with a gateway ( to internet, and device tun0 is connected to an access point (with some hotspot software).

I can ping an internet host from eth0 but I can't acces internet from tun0. How do I route packets from tun0 to internet (and back) ?

share|improve this question

You must route default gateway for to tun0

For example:

route add -net default gw dev tun0

might works for you. May be you have to remove default GW for eth0

route del -net default gw dev eth0

This will routes all internet traffic over tun0 device. If you add these two lines in to end of /etc/network/interfaces file, it runs on system boot..

share|improve this answer
But if I do this I will not be able to connect to internet from eth0. I want to be able to connect from both interfaces. – drcelus Jan 20 '12 at 14:40
Basically you can not do a request same time with both connection. You can do load balancing when one connection is occupied by a request(s), system tries other one. But I have no knowledge about load balancing.. – Sencer H. Jan 20 '12 at 14:46
Not both interfaces are connected to internet, just eth0, tun0 is being configured to act as a captive portal and thus requests from there should be routed through eth0 and back. Hope this makes sense. – drcelus Jan 20 '12 at 14:50
Are you saying you want to make the internet on eth0 available to whatever is connected on the other side of tun0? – Tim Jan 20 '12 at 15:49
Yes Tim that's exactly what I need. – drcelus Jan 23 '12 at 8:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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