Difference between revisions of "Network/Bridge"
Jump to navigation
Jump to search
Line 61: | Line 61: | ||
auto eth1 | auto eth1 | ||
iface eth1 inet static | iface eth1 inet static | ||
− | hwaddress ether | + | hwaddress ether <failover mac> |
− | address | + | address <failover ip> |
netmask 255.255.255.255 | netmask 255.255.255.255 | ||
− | broadcast | + | broadcast <failover ip> |
− | post-up route add | + | post-up route add <host gateway> dev eth1 |
− | post-up route add default gw | + | post-up route add default gw <host gateway> |
dns-nameservers <dns ip> | dns-nameservers <dns ip> | ||
</pre> | </pre> |
Revision as of 10:44, 20 February 2014
Host configuration
Debian
apt-get install bridge-utils
# cat /etc/network/interfaces auto lo br0 iface lo inet loopback iface eth0 inet manual iface br0 inet static bridge_ports eth0 address 142.4.209.206 netmask 255.255.255.0 network 142.4.209.0 broadcast 142.4.209.255 gateway 142.4.209.254
CentOS
br0.sh
#!/bin/bash CFGPATH=/etc/sysconfig/network-scripts REFCFGPATH=/root # keep the original if [ ! -f "$REFCFGPATH/ifcfg-eth0.ref" ]; then cp $CFGPATH/ifcfg-eth0 $REFCFGPATH/ifcfg-eth0.ref fi # build new eth0 grep -E '(DEVICE|HWADDR|ONBOOT)' $REFCFGPATH/ifcfg-eth0.ref > $CFGPATH/ifcfg-eth0 echo "BRIDGE=br0" >> $CFGPATH/ifcfg-eth0 # build br0 grep -v -E '(HWADDR|UUID)' $REFCFGPATH/ifcfg-eth0.ref | sed 's/eth0/br0/g' | sed 's/BOOTPROTO=["]*none["]*/BOOTPROTO=static/g' | sed 's/TYPE=["]*Ethernet["]*/TYPE="Bridge"/g' | sed 's/NM_CONTROLLED=["a-z]*/NM_CONTROLLED="no"/g' > $CFGPATH/ifcfg-br0
VM configuration
Online.net
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet static hwaddress ether <failover mac> address <failover ip> netmask 255.255.255.255 broadcast <failover ip> post-up route add <host gateway> dev eth1 post-up route add default gw <host gateway> dns-nameservers <dns ip>