Fixing Xen "RTNETLINK answers: File exists" issue with ifup on Debian when using network-bridge and static IP address
By Vivec on Thursday 2 August 2012, 12:02 - Permalink
I recently spent a while trying to make my Xen bridged setup work on Debian with a static IP address so I thought I would share the solution to my problem.
I had the following /etc/network/interfaces
1 2 3 | allow-hotplug eth0 iface eth0 inet static address 192.168.1.254 |
Xen was configured with (network-script 'network-bridge netdev=eth0 bridge=eth0')
in /etc/xen/xend-config.sxp
which renames eth0
to peth0
and bridges peth0
and vif1.0
as eth0
.
$ brctl show eth0 bridge name bridge id STP enabled interfaces eth0 8000.80c16ee70a98 no peth0 vif1.0
The issue I encountered was that after boot eth0 was configured with the right address but was down. ifup eth0
yielded
RTNETLINK answers: File exists Failed to bring up eth0.
Running ifup -v eth0
showed that the following command was being run:
ip addr add 192.168.1.254/255.255.255.0 broadcast + dev eth0 label eth0
Since eth0 had already been assigned an address (probably by Xen's network script), this command would fail.
In order to keep using (network-script network-bridge)
, I just changed /etc/network/interfaces
to the following:
1 2 3 | iface eth0 inet static address 192.168.1.254 pre-up ip addr del 192.168.1.254/24 dev eth0 2> /dev/null || true |
This is probably not the best solution since Xen's doc indicates that "It is normally much better to create the bridge yourself in /etc/network/interfaces." but this was the modification to keep most of my configuration untouched.