How do I enable TUN/TAP forwarding?

Posted by rafal on Server Fault See other posts from Server Fault or by rafal
Published on 2011-06-07T18:20:46Z Indexed on 2012/10/21 23:06 UTC
Read the original article Hit count: 330

Filed under:
|
|

I have a program which writes packets (destination address 10.3.0.2) to the TUN/TAP interface.

Network:

host1|tun0----eth1(10.3.0.1)|-------------------host2|eth1(10.3.0.2)|

Wireshark captures these packets from interface tun0 but they are not forwarded to interface eth1.

Commands:

sysctl -w net.ipv4.ip_forward=1
sysctl -p

iptables -A INPUT -i tun+ -j ACCEPT

iptables -A FORWARD -i tun+ -j ACCEPT

iptables -A INPUT -i tap+ -j ACCEPT

iptables -A FORWARD -i tap+ -j ACCEPT

/etc/init.d/networking restart

/etc/init.d/openvpn restart

© Server Fault or respective owner

Related posts about linux-networking

Related posts about tap