Skip to content

Instantly share code, notes, and snippets.

@bivald
Last active September 17, 2021 13:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bivald/5690227 to your computer and use it in GitHub Desktop.
Save bivald/5690227 to your computer and use it in GitHub Desktop.
Debian wheezy networking bridge, xen

Configuring external (and internal) networking, Debian Wheezy and Xen

External network

Dom0

auto eth0
iface eth0 inet static
  bridge_ports peth0
  address XXX.XXX.XXX.XXX
  netmask 255.255.255.0
  gateway XXX.XXX.XXX.XXX
  • Use the following when configuring your DomU's /etc/xen/domain.cfg. Note: Vif MAC address must start with 00:16:3e
vif = [ 'bridge=eth0,mac=00:16:3e:xx:xx:xx' ]  # (vif mac setup works only with the beginning of 00:16:3e!, change xx:xx:xx to valid mac-address characters, 0-9 and a-f)

DomU

  • Edit /etc/network/interfaces
auto eth0
iface eth0 inet static
 address XXX.XXX.XXX.XXX
 gateway XXX.XXX.XXX.XXX
 netmask 255.255.255.0

Interal network (DomU <-> DomU, no external connectivity)

Dom0

  • Edit /etc/network/interfaces
auto xenbr1
iface xenbr1 inet static
  address 10.0.0.1
	netmask 255.255.255.0
	bridge_stp off
	bridge_waitport 0
	bridge_fd 0
  • Use the following when configuring your DomU's /etc/xen/domain.cfg. Note: Vif MAC address must start with 00:16:3e
vif = [ 'bridge=xenbr1,mac=00:16:3e:xx:xx:xx' ]  # (vif mac setup works only with the beginning of 00:16:3e!)

DomU

  • Edit /etc/network/interfaces
auto eth0
iface eth0 inet static
 address 10.0.0.2
 netmask 255.255.255.0

Using external and internal networking

Dom0

When you have your eth0 and xenbr1, configure your DomUs /etc/xen/domain.cfg to handle both:

vif         = [ 'mac=00:16:3e:xx:xx:xx,bridge=xenbr1', 'mac=00:16:3e:xx:xx:xx,bridge=eth0']

DomU

Now your internal network for DomU will be eth0 and the external eth1, edit /etc/network/interfaces:

auto eth0
iface eth0 inet static
 address 10.0.0.X
 netmask 255.255.255.0

auto eth1
iface eth1 inet static
 address XXX.XXX.XXX.XXX
 gateway XXX.XXX.XXX.XXX
 netmask 255.255.255.0
@bivald
Copy link
Author

bivald commented Jun 1, 2013

Also, comment out any networking-script in your xend config. Wheezy don't need them and they will be removed soon (buggy)

@bivald
Copy link
Author

bivald commented Jun 1, 2013

You can also try to add it via script instead, this actually works better for me:

brctl addbr xenbr1
brctl stp xenbr1 off
brctl setfd xenbr1 0
ip link set xenbr1 up
ifconfig xenbr1 up 10.0.0.1 netmask 255.255.255.0

@chrismyers81
Copy link

On mine (Debian Stretch,) I had to add:
bridge_ports none
to cases where there wasn't a physical nic to bridge to, otherwise the networking service would fail to reload:

Could not find bridge device xenbr2
vhost ifup[6116]: Cannot find device "xenbr2"
vhost ifup[6116]: ifup: failed to bring up xenbr2
vhost ifup[477]: Cannot find device "xenbr2"
vhost ifup[477]: ifup: failed to bring up xenbr2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment