Xen networking

Discussion in 'Installation/Configuration' started by ziogra, Mar 11, 2009.

  1. ziogra

    ziogra New Member


    I have a question for you, maybe can you help me.

    I have a xen box (debian lenny) with 2 NICs. I'd like to use

    eth0 (bridging) for VMs on the LAN
    eth1 ( ? ) for a VM with a static public ip (I have only 1 public IP)

    The only way I get it working is configuring the real eth1 and the VM's eth0 with the same public IP.
    Is there an IP conflict danger? How can I configure xen in a better way to get the same result? (eg: eth1 route or nat ?)

    Here's my config:

    mynet script to create 2 separate bridges:
    (I call it from xend-config.sxp)

    dir=$(dirname "$0")
    "$dir/network-bridge" "$@" vifnum=0 netdev=eth0 bridge=eth0
    "$dir/network-bridge" "$@" vifnum=1 netdev=eth1 bridge=eth1


    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo eth0 eth1
    iface lo inet loopback

    # The primary network interface
    allow-hotplug eth0
    allow-hotplug eth1

    iface eth0 inet static

    iface eth1 inet static
    address xxx.xxx.xxx.xxx
    netmask xxx.xxx.xxx.xxx
    gateway xxx.xxx.xxx.xxx
    broadcast xxx.xxx.xxx.xxx

    Thank you in advance!
  2. falko

    falko Super Moderator ISPConfig Developer

    Have you tried to specify the Xen bridge in each guest's configuration file (in the vif line)?

    vif = [ 'bridge=eth0,...' ]
    vif = [ 'bridge=eth1,...' ]
  3. ziogra

    ziogra New Member

    Solved (but...)

    yes, my question was:

    how can I set a bridge without assigning to it a public IP?

    In the meanwhile I've found an additional IP address. That solved my problem: one IP to the bridge, one to the VM, but I'd like to know anyway how to set a "nohost" bridge.

    Thank you!
  4. matey

    matey New Member

    You did the the same way as we have it set up
    we set IP in the Xen guest machine's /etc/network/interfaces file;

    auto eth1
    iface eth1 inet static
    address (or any IP address you want or one assigned by ISP)
    netmask (or whatever your subnet is)

    and of course before that you set your NICs in the " vif= " statement in xen.conf file as Falko said.
    I am no expert but I think that is where you set up your gateway as well.
    when a virtual NIC points to the real IP address it acts as a gateway, I think?!
    Just make sure the 2nd NIC is actually connected (to a hub /switch or router)
  5. mactor

    mactor New Member

    To set up a bridge in Xen with no IP address you can have this in /etc/network/interfaces

    auto eth1
    iface eth1 inet manual
    pre-up ifconfig $IFACE up
    post-down ifconfig $IFACE down

    This brings the bridge up with no ip address, and you don't need to have it connected to a switch...etc.

    Replace eth1 with the interface/bridge you need and reboot.

Share This Page