Linux Bridge on Debian / Ubuntu Server


apt install bridge-utils

cleaning-up and defining the bridge name,

cd /etc/xen/
mv -i xend-config.sxp xend-config.sxp.dist
sed '/^#/d; /^$/d' xend-config.sxp.dist > xend-config.sxp
vi xend-config.sxp

(network-script 'network-bridge netdev=xenbr0')

cp -i xl.conf xl.conf.dist
vi xl.conf


systemctl status NetworkManager
#systemctl stop NetworkManager
#systemctl disable NetworkManager
cp -pi /etc/network/interfaces /etc/network/interfaces.dist
vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet manual

auto xenbr0
iface xenbr0 inet static
    address x.x.x.x/xx
    gateway x.x.x.x
    bridge_ports enp1s0

        #bridge_fd 0
        #bridge_stp off
        #hwaddress ether xx:xx:xx:xx:xx:xx
        #bridge_maxwait 0

a fake bridge,

auto dummybr0
iface dummybr0 inet static
    address x.x.x.x/xx
    bridge_ports none

or if you have NIC2,

auto NIC2
iface NIC2 inet manual

auto anotherbr0
iface anotherbr0 inet static
    address x.x.x.x/xx
        bridge_ports NIC2


Linux Bridge on Ubuntu Server artful/17.10,

cp -pi /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.dist
vi /etc/netplan/01-netcfg.yaml

  version: 2
  renderer: networkd
    dhcp4: no
    dhcp6: no
    dhcp4: no
    dhcp6: no
     - NIC2
    dhcp4: no
    dhcp6: no
     - NIC1
    dhcp4: no
    dhcp6: no
     - x.x.x.x/xx
    gateway4: x.x.x.x

   # parameters:
   #  stp: no
   #  forward-delay: 0

vi /etc/rc.local

echo -n bringing up the public bridge...
ifconfig pubbr0 up && echo done

dpkg -l | grep ifupdown #should be empty
dpkg -l | grep netscript #should be empty
#systemctl restart systemd-networkd.service
netplan generate
netplan apply
ping -c1

Linux Bridge on Slackware

vi /etc/rc.d/rc.local

echo -n creating the public bridge...
brctl addbr pubbr0
brctl addif pubbr0 eth0 && echo done
ifconfig pubbr0 up
ifconfig eth0 up

echo -n setting up public ip on pubbr0...
ifconfig pubbr0 x.x.x.x/xx up && echo done

echo -n creating the internal bridge...
brctl addbr xenbr0
brctl addif xenbr0 bond0 && echo done
ifconfig xenbr0 up
ifconfig bond0 up

echo -n setting up internal ip on xenbr0...
ifconfig xenbr0 x.x.x.x/xx up && echo done

echo -n setting up default route...
route add default gw x.x.x.x && echo done


Open vSwitch (and SDN) on Slackware

sbopkg -i openvswitch-utils
#less /usr/doc/openvswitch-utils-2.5.0/README.SLACKWARE
chmod +x /etc/rc.d/rc.openvswitch

to start it for the first time (not sure we should clean the db at starting... this is not totally rc.inet1 start ready),

#self verbose
#/etc/rc.d/rc.openvswitch start
#/etc/rc.d/rc.openvswitch stop
/etc/rc.d/rc.openvswitch clean-database
/etc/rc.d/rc.openvswitch start-clean

echo -n ovs bridge xenbr0...
ovs-vsctl add-br xenbr0
ovs-vsctl add-port xenbr0 eth0
ip addr flush dev eth0
ip addr add x.x.x.x/xx dev xenbr0
ip link set xenbr0 up
ip link set eth0 up && echo done
#ovs-vsctl set-controller xenbr0 tcp:x.x.x.x:6633

echo -n ovs bridge pubbr0...
ovs-vsctl add-br pubbr0
ovs-vsctl add-port pubbr0 eth1
ip addr flush dev eth1
ip link set pubbr0 up
ip link set eth1 up && echo done
ovs-vsctl set-controller pubbr0 tcp:x.x.x.x:6633

echo ''
ovs-vsctl show
echo ''

echo -n default route...
route add default gw x.x.x.x && echo done

and to shut it down maybe simply (rc.inet1 stop),

ifconfig eth0 down
ifconfig xenbr0 down
ifconfig eth1 down
ifconfig pubbr0 down
#self verbose
/etc/rc.d/rc.openvswitch stop

and do not forget to switch XEN bridge to Open vSwitch,

cp -pi /etc/xen/xl.conf /etc/xen/xl.conf.dist
vi /etc/xen/xl.conf


Enabling LACP,

ovs-vsctl add-bond xenbr0 bond0 eth0 eth2 eth3 lacp=active
#ovs-vsctl set port bond0 lacp=active


eventually add this to your env,

alias ovs='ovs-vsctl'


in case Netfilter is enabled, you might have to e.g.,

#iptables -A FORWARD -i virbr0 -o eno1 -j ACCEPT
#iptables -A FORWARD -i eno1 -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE