-1

i need to create a bridge with public ip for assigning public ip to VM. But how can i create a Network bridge,as there is a default "xenbr0" bridge exists.

Editing Xenbr0 is not permanent,how can i make it persistent against service restarts?

Kevin Parker
  • 757
  • 1
  • 13
  • 29

1 Answers1

1

So, in XCP (and XenServer), bridges are made for each one of your physical NICs (pnic). These start at xenbr0 for the first NIC and are numbered upwards from there. In the current version of XCP modifications to OVS bridges are not persisted across restarts - you will have to make your own init script to apply your modifications that is run on each restart.

This can be very simple - you just need to implement start() - stop() and restart() can just report that they are unsupported, and then use chkconfig --add my_init_script to get it integrated into the boot process. I've pasted an example init script below (which sets an openflow controller, which is probably not what you want, but you can simply replace the start() method with the commands you need:

#!/bin/bash
#
# Init file for OpenFlow configuration
#
# chkconfig: 2345 21 78
# description: OpenFlow bridge configuration
#

# source function library
. /etc/rc.d/init.d/functions

VSCTL=/usr/bin/ovs-vsctl

controller_ip=192.168.0.200

start() {
  $VSCTL set-controller xenbr0 tcp:$controller_ip:6633
}

stop() {
        echo -n $"Action not supported"
        failure $"Action not supported"
        echo
        return 1;
}

restart() {
        echo -n $"Action not supported"
        failure $"Action not supported"
        echo
        return 1;
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac
Nick Bastin
  • 213
  • 2
  • 8
  • I need to create virtual bridge with out connecting to the actual interface.Using this bridge i wish to create an internal ip for every VM. – Kevin Parker Aug 07 '12 at 04:33
  • 1
    @KevinParker: That is done in XenCenter (or XAPI) by creating a server-only private Network, and then attaching each VM to it. – Nick Bastin Aug 07 '12 at 13:10