XEN // Networking

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 opendns.com

Linux Bridge on Slackware

see xen from scratch

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'


linux bridge

Bridging Network Connections https://wiki.debian.org/BridgeNetworkConnections


Bridge not working https://unix.stackexchange.com/questions/48265/bridge-not-working


KVM & BRCTL in Linux – bringing VLANs to the guests http://blog.davidvassallo.me/2012/05/05/kvm-brctl-in-linux-bringing-vlans-to-the-guests/


trunk + bridge


Link Aggregation and LACP with Open vSwitch https://blog.scottlowe.org/2012/10/19/link-aggregation-and-lacp-with-open-vswitch/


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

Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml