建立硬碟 (20000M=20G)
dd if=/dev/zero of=xen.img bs=1M count=20000
設定檔
注意boot = "c"是硬碟開機 boot = "d" 是光碟開機
vif中bridge=virbr0,script=vif-bridge"為橋接
vif = [ "ip=192.168.1.100, bridge=virbr0, script=vif-bridge" ]
如果要NAT的話
vif = ['ip=10.0.0.1' , script='vif-nat']
每台虛擬機要配不同port號(5900+N)
vncdisplay =要配的號碼
或者用自動找可用的port分配
vncunused = 1
不限定連進IP
vnclisten = "0.0.0.0"
限定本機
vnclisten = "127.0.0.1"
解決滑鼠飄移問題
usb=1
usbdevice="tablet"
neo.cfg
//-------------------------------------------------------------------------
name = "neo"
maxmem = 4096
memory = 1024
vcpus = 4
builder = "hvm"
kernel = "/usr/lib/xen/boot/hvmloader"
boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 1
device_model = "/usr/lib64/xen/bin/qemu-dm"
vnc = 1
vncunused = 1
vncconsole = 1
vnclisten = "0.0.0.0"
vncpasswd = "密碼"
keymap = "en-us"
disk = [ "file:/home/neo/vmimage/xen.img,hda,w", "file:/home/neo/ISO/win7.iso,hdc:cdrom,r" ]
vif = [ "ip=192.168.1.100, bridge=virbr0, script=vif-bridge" ]
usb=1
usbdevice="tablet"
//-------------------------------------------------------------------------------------------------------------
看開啟的Dom-U
sudo xm list
啟動Dom-U(對設定檔檔名)
sudo xm create neo.cfg
關閉Dom-U(對設定檔裡的name)
sudo xm shutdown neo
brctl show
/sbin/ip a | grep '^[0-9]'
vif0.0 綁到 virbr0 :
brctl addif virbr0 vif0.0
http://www.cdus.org/bbs/forum.php?mod=viewthread&tid=42295
建立bridge
brctl addbr xenvbr11
brctl stp xenvbr11 off
brctl setfd xenvbr11 0 //set forward delay time
ip link set xenvbr11 up
建vlan(區隔區網)
vconfig set_name_type DEV_PLUS_VID_NO_PAD
vconfig add peth0 11 //在peth0上创建vlan
ip link set peth0.11 address fe:ff:ff:ff:ff:ff
ip link set peth0.11 up
把vlan加入到网桥中
brctl addif xenvbr11 peth0.11
创建端口配置文件
cd /etc/sysconfig/network-scripts/
cat ifcfg-peth0.11
DEVICE=peth0.11
TYPE=Ethernet
ONBOOT=yes
MACADDR=fe:ff:ff:ff:ff:ff
VLAN=yes
IPADDR=192.168.5.1
NETMASK=255.255.255.0
VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD
BRIDGE=xenvbr11
cat ifcfg-xenvbr11
DEVICE=xenvbr11
TYPE=Bridge
DELAY=0
STP=off
ONBOOT=yes