Make bridge multiple network interfaces on Xen host to guests os.

Posted In Network, Virtualization - By Tum. On Thursday, March 6th, 2008 With 0 Comments

ขั้นแรกให้สร้าง script file ขึ้นมาโดยใช้คำสั่ง

#vi /etc/xen/scripts/network-xen-custom

จากนั้น copy ข้อความด้านล่างไปไว้ที่ไฟล์

#!/bin/sh
# network-xen-custom
# Exit if anything goes wrong
set -e
# First arg is operation.
OP=$1
shift
script=/etc/xen/scripts/network-bridge
case ${OP} in
   start)
        $script start vifnum=0 bridge=xenbr0 netdev=eth0    # map xenbr0 -> eth0
        $script start vifnum=1 bridge=xenbr1 netdev=eth1 ;; # map xenbr1 -> eth1
   stop)
        $script stop vifnum=0 bridge=xenbr0 netdev=eth0     #unmap xenbr0
        $script stop vifnum=1 bridge=xenbr1 netdev=eth1 ;;  #unmap xenbr1
   status)
        $script status vifnum=0 bridge=xenbr0 netdev=eth0
        $script status vifnum=1 bridge=xenbr1 netdev=eth1
        ;;
        *)
        echo "Unknown command:${OP}"
        echo 'Valid commands are: start, stop, status'
        exit 1
esac

เมื่อทำการสร้างไฟล์นี้เสร็จเรียบร้อยแล้ว ให้ทำการ chmod เพื่อให้ไฟล์นี้สามารถรันได้

#chmod 755 /etc/xen/scripts/network-xen-custom

จากนั้นให้ทำการแก้ไขไฟล์ config ของ xen โดยใช้คำสั่ง

#vi /etc/xen/xend-config.sxp

แก้ไขและเพิ่มข้อความดังตัวอย่างด้านล่างโดยการ comment script เก่าและเพิ่ม script ใหม่ที่เราสร้างขึ้น

#(network-script network-bridge)

(network-script network-xen-custom)
Tags: ,

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>