Bridging Tun/Tap Ejemplo 0

ubuntu /etc/network/interfaces

(eth0 cloned at 3; eth1 bridged on 3 tap; for route on 3 network and work with virtual machines)

virtual machine no take the tapX on boot, need restar network to take them



auto lo eth0 eth0:1 eth0:2  eth0:3 
 
iface lo inet loopback
 
iface eth0:1 inet static
    address 192.168.100.7
    netmask 255.255.255.0
    broadcast 192.168.100.254
    network 192.168.100.0
    dns-nameservers 192.168.100.1
    gateway 192.168.100.1
    up ip route add 192.168.100.0/24 via 192.168.100.1
 
iface eth0:2 inet static
    address 192.168.254.7
    netmask 255.255.255.0
    broadcast 192.168.254.254
    network 192.168.254.0
    up ip route add 192.168.254.0/24 via 192.168.254.1
#    gateway 192.168.254.1
 
iface eth0:3 inet static
    address 192.168.200.7
    netmask 255.255.255.0
    broadcast 192.168.200.254
    network 192.168.200.0
    up ip route add 192.168.200.0/24 via 192.168.200.1
#    gateway 192.168.200.1
 
auto eth1 br0
#iface eth1 inet manual
#    up ifconfig eth1 0.0.0.0 promisc up
#    down ifconfig eth1 down
 
iface br0 inet dhcp
    bridge_ports eth1 
    bridge_fd 1
    bridge_stp on
    bridge_hello 1
    down ifconfig br0 down
    post-down brctl delbr br0 
#    address 172.16.31.2
#    broadcast 172.16.31.255
#    netmask 255.255.252.0
#    network 172.16.28.0
#    gateway 172.16.31.1 # my local router 
#special bridge settings
#eth0:1 eth0:2 # eth0 is always member of the bridge
# special commands to handle ifdown
 
# Two tap devices
auto tap0 tap1 tap2
 
iface tap0 inet manual
    pre-up tunctl -t $IFACE -u root
    pre-up brctl addif br0 $IFACE
    up ifconfig $IFACE 0.0.0.0 up
    down ifconfig $IFACE down
    down brctl delif br0 $IFACE
    down tunctl -d $IFACE
 
iface tap1 inet manual
    pre-up tunctl -t $IFACE -u root
    pre-up brctl addif br0 $IFACE
    up ifconfig $IFACE 0.0.0.0 up
    down ifconfig $IFACE down
    down brctl delif br0 $IFACE
    down tunctl -d $IFACE 
 
iface tap2 inet manual
    pre-up tunctl -t $IFACE -u root
    pre-up brctl addif br0 $IFACE
    up ifconfig $IFACE 0.0.0.0 up
    down ifconfig $IFACE down
    down brctl delif br0 $IFACE
    down tunctl -d $IFACE


Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.