How to redirect packets received from one network interface to another network interface?

I am using ubuntu11.10 and I created the tun / tap interface using the following commands

openvpn --mktun --dev tun0
ip link set tun0 up
ip addr add 10.10.10.1/24 dev tun0
route add 10.10.10.1/24 dev tun0

I have another interface there

eth0 10.80.1.87

I want to redirect packets received from tun0 to eth0. How to do it on top of Ubuntu?

+3
source share
3 answers

In addition to the two good answers, remember that:

  • bridges work at the channel level ("ethernet level") - and therefore setting up a bridge between two interfaces is basically similar to wiring them through a (virtual) switch
  • ( " IP" ) - ()
+5

IP- , TCPIP. :   echo 1 > /proc/sys/net/ipv4/ip_forward

. , , .

tun0 eth0, . Ubuntu . , tun0 ethernet.

, IP- tun0 10.10.10.1, , 10.10.10.45 tun0, 10.10.10.1 ( , 10.80.1.0/24). , , 10.80.1.234, 10.10.10.1, Ubuntu, 10.80.1.234 ethernet. THAT 10.10.10.45. 10.80.1.87 /. , .

10.80.1.0/24 ip-. ubuntu FROM 10.80.1.87 , 10.10.10.45.

+3

It looks like you want to configure a bridge between two network interfaces. There is also a special ubuntu guide here (goto: Bridging)

$ sudo apt-get install bridge-utils
# vim /etc/network/interfaces: 
auto lo
iface lo inet loopback

auto br0
iface br0 inet static
        address 192.168.0.10
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off
$sudo /etc/init.d/networking restart
+2
source

All Articles