Linux Virtualization

XEN and network adaptor setup

I am trying to configure pfSense as a XEN VM, and the main difficulty is getting the network adapters to work properly.
I have successfully ran pfSense as a VM in OpenSuSE 10.3, and I am documenting this to make life easier for next time.

Once the system is booted with the xen kernel, the network adapters are not accessible anymore from Yast.
Read this. Essentially I need to give the command #/etc/xen/scripts/network-bridge stop netdev=eth0 to gain access of the network adapter from Yast. Be aware that whatever network connections were made to the machine, will be severed, so make sure you have physical access to the machine, in order to access yast.

Custom script that attaches the names xenbr# to adaptor eth#, which I named ‘extra-network-cards_script.sh’
#!/bin/sh
dir="/etc/xen/scripts"
command="$@"
"$dir/network-bridge" "$command" vifnum=0 bridge=xenbr0 netdev=eth0
"$dir/network-bridge" "$command" vifnum=1 bridge=xenbr1 netdev=eth1
"$dir/network-bridge" "$command" vifnum=2 bridge=xenbr2 netdev=eth2
"$dir/network-bridge" "$command" vifnum=3 bridge=xenbr3 netdev=eth3
"$dir/network-bridge" "$command" vifnum=4 bridge=xenbr4 netdev=eth4

To use manually, simply run #extra-network-cards_script.sh start

But this needs to happen everytime the system is booted. The better place to put this is within the xend-config.sxp file
Open up xend-config.sxp in a text editor, search for (network-script network-bridge) and add a # in front of it, to comment it out.
Below it, add
(network-script extra-network-cards_script.sh) # This is the modified script that assigns the 4 Intel NICs
That’s it. Next time a reboot is done, and xend is being configured, the network interfaces will also be set up.

UPDATE: Doesn’t quite work.http://http://www.novell.com/co
Link of interest here.

UPDATE: Got it working.
The custom script I ended up using was this:
#!/bin/sh
dir="/etc/xen/scripts"
command="$@"
"$dir/network-bridge" "$command" netdev=eth0
"$dir/network-bridge" "$command" netdev=eth1
"$dir/network-bridge" "$command" netdev=eth2
"$dir/network-bridge" "$command" netdev=eth3
"$dir/network-bridge" "$command" netdev=eth4

For some reason, when a bridge (xenbr) other then 0 was specified, I would get an error that told me that there was no configuration file for it.
I can live with the bridges being called eth# instead of xenbr#

Also for the record, port one on the 4 nic card that I have is the one closest to the LEDs. At least that’s the one named eth1 by the system. eth4 is farthest from the LEDs.

4 thoughts on “XEN and network adaptor setup

  1. Most of the time you do not need physical access to reconfigure the network.
    Yast will reconfigure the network after you OKed all the changes. Only then the Network is restarted and might interrupt your ssh connection. But be sure to have a fall back before you run into troubles.

  2. wonko, the changes I’m referring to are done after I issue the ‘./network-bridge stop’ command, which when disabling the eth0 bridge (which is created by default) cuts off all ethernet connections. (at least it does to me)
    That’s when I need physical access to the server to run Yast, and make changes to the network adapters.

  3. Are you running the pfsense guest paravirtualized, or HVM’d? I’m trying to find out if paravirtualization under Xen is available for pfsense, or only VMware.

  4. I am not running pfSense anymore. I decided that putting the firewall on the same machine that runs many other VMs, is putting too many eggs in one basket. At least now if the xen server goes down, I still have internet access…Which I didn’t before, and sucked.

    But to answer your question,I was running pfSense in HVM mode. Never bothered with trying to paravirtualize the kernel.
    It worked fine for what I needed.

Leave a Reply

Your email address will not be published.