create network bridge in ubunut 14.04

sudo apt-get update
sudo apt-get install bridge-utils
vim /etc/network/interfaces
 auto lo  
 iface lo inet loopback  
 #10.0.2.193 Bcast:10.0.3.255 Mask:255.255.254.0  
 auto br0  
 iface br0 inet static  
     address 10.0.2.193  
     netmask 255.255.254.0  
     gateway 10.0.2.1  
     dns-nameservers 202.94.66.2 8.8.8.8  
 #set static route for LAN  
     post-up route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1 dev br0  
     bridge_ports eth1  
     bridge_stp off  
     bridge_fd 0  
     bridge_maxwait 0  
 #bridge_stp off is a setting for spanning tree. If you have a possibility for network looks, you may want to turn this on.  
 #bridge_fd 0 turns off all forwarding delay. If you do not know what this is, you probably do not need it.  
 #bridge_maxwait 0 is how long the system will wait for the Ethernet ports to come up. Zero is no wait.  

auto br0
iface br0 inet static
 address 192.168.0.201
 netmask 255.255.255.0 
 gateway 192.168.0.1
 dns-nameservers 8.8.8.8 8.8.4.4
 bridge_ports eth0
 bridge_stp off
some more commands

 ip addr flush dev <interface 1>  
 ip addr flush dev <interface 2>  
 brctl addbr <bridge name>  
 brctl addif <bridge name> <interface 1> <interface 2>  
 ip link set dev <bridge name> up  

No comments:

Post a Comment