xen host // network bridge

apt install bridge-utils vlan
cd /etc/network/
cp -pi interfaces interfaces.dist
vi interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto eth1
iface eth1 inet manual

auto xenbr0
iface xenbr0 inet static
    bridge_ports eth0
    bridge_hw eth0
    address 192.168.122.11/24
    gateway 192.168.122.1

auto guestbr0
iface guestbr0 inet static
        bridge_ports eth1
        bridge_hw eth1
        address 10.1.1.1/24

more options

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

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

Additional notes

old xend

define a decent bridge name (otherwise it is eth0 by default…)

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

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

now deal with the newer XL (also see network)

mv -i /etc/xen/xl.conf /etc/xen/xl.conf.dist
vi /etc/xen/xl.conf

#autoballoon="auto"
vif.default.bridge="xenbr0"
vif.default.script="vif-bridge"

netplan

tested on artful/17.10

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

network:
  version: 2
  renderer: networkd
  ethernets:
   NIC1:
    dhcp4: no
    dhcp6: no
   NIC2:
    dhcp4: no
    dhcp6: no
  bridges:
   pubbr0:
    interfaces:
     - NIC2
    dhcp4: no
    dhcp6: no
   xenbr0:
    interfaces:
     - NIC1
    dhcp4: no
    dhcp6: no
    addresses:
     - 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

HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun