Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 created an tunnel device using

ip tuntap add dev tun0 mode tun user 0 group 0

I then assign it an ip address

ifconfig tun0 netmask

On my ethernet device eth0, I receive packets from machines in the ip address range I would like these packets to be forwarded on the tunnel device. I do not wish to create a bridge between the ethernet and tunnel device. I therefore added routing entries in the routing table as follows.

ip rule add from lookup myinternal

ip route add default via dev tun0 table myinternal

I have flushed (removed) all ip tables entries. There are two entries however

iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT

iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT

When I do a tcpdump on tun0 I am not able to see the packets from eth0. However I can see the packets when I do a tcpdump on eth0. I would like to know how can I forward/capture these packets on tun0. From tun0 I would later on like to process these packets and reply to them from my application and if required pass them on to another interface. I cannot use eth0 for my activities.

I have enabled forwarding using systl for ipv4.

cat /proc/sys/net/ipv4/ip_forward


Furthermore there is no default route entry in my main routing table.

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.