Adjust the nic of the kvm real machine server, create a VM on the command line, and create a VM on the LV Snapshot

Source: Internet
Author: User

Adjust the nic of the kvm Real Server

[Use the isolated CIDR block]

1) set Nic br0 as DHCP address

[[email protected] ~]# service  network  stop[[email protected] ~]# vim  /etc/sysconfig/network-scripts/ifcfg-eth0.. ..BOOTPROTO=dhcp.. ..[[email protected] ~]# service network start

 

2) Add a virtual Nic Network1

Open virt-manager --> "edit" --> "connection details" --> "Virtual Network"

-- "+" In the lower left corner -- "...

-- "Network name" set to Network1 -- "network" set to 192.168.x.0

-- Do not enable DHCP -- isolated virtual network ....

 

3) Adjust the Network1 configuration of the virtual network card

[[email protected] ~]# virsh  net-edit  network1<network>  <name>network1</name>  <uuid>06cd5c32-6256-8edd-d59c-f2d5a9dc7337</uuid>  <bridge name=‘network1‘ stp=‘on‘ delay=‘0‘ />  <mac address=‘52:54:00:2E:96:FF‘/>  <ip address=‘192.168.x.x‘ netmask=‘255.255.255.0‘>  </ip></network> [[email protected] ~]# virsh  net-destroy  network1[[email protected] ~]# virsh  net-start  network1[[email protected] ~]# ifconfig  network1 network1  Link encap:Ethernet  HWaddr 52:54:00:2E:96:FF            inet addr:192.168.4.204  Bcast:192.168.4.255  Mask:255.255.255.0.. ..

Virt-manager -- force shutdown the specified Virtual Machine

-- Double-click the specified virtual machine -- find the NIC device Nic ..

-- "Modify" Source Device "to: Virtual Network 'network1': isolated network segment --" Application

-- Reboot the specified Virtual Machine

 

Create a Virtual Machine (modeling machine) from the command line)

1. Prepare a disk (logical volume) for the VM)

[[Email protected] ~] # Lvcreate-L 10g-N lv_node1 vg_data

2. Create a new virtual machine and install RHEL 6.5 from the command line (two methods)

[[Email protected] ~] # Virt-install -- name rhel1 -- vcpus = 1 -- Ram = 1024 -- Disk Path =/dev/vg_data1/lv_node1 \ -- network = default -- CDROM =/(image) (1) -- Network Bridge = virbr0 -- PXE (2) (the PXE has been installed before. For details, refer)

Basic operations of virsh command tools

Virsh // directly enter the interaction mode virsh nodeinfo // view the KVM node (server) information virsh list // list running virtual machines virsh list -- all // list all virtual machines (including unstarted ones) virsh dominfo Virtual Machine name // view the information of the specified virtual machine virsh start virtual machine name // start the specified virtual machine virsh reboot Virtual Machine name // restart the specified virtual machine virsh shutdown Virtual Machine name // set the specified virtual machine is shut down normally. virsh destroy Virtual Machine name // Force shutdown the specified Virtual Machine (equivalent to power-out) virsh autostart Virtual Machine name // set the specified virtual machine with KVM auto start virsh autostart -- disable Virtual Machine name // set the specified virtual machine with KVM auto start use LVM Snapshot technology to quickly create a new Virtual Machine

1. Copy and modify the MAC address when writing a snapshot volume (COW) based on the LV of the model machine !!!! !

[[email protected] ~]# lvcreate  -s  -n rhel6 -L 10G /dev/vg_data/lv_node1  Logical volume "el5snap1" created

2. Export the XML Description of the model machine and modify it to the definition of the new Virtual Machine (New name, new UUID, new disk device, new Mac)

[[Email protected] ~] # Virsh dumpxml rhel1> rhel6.xml [[email protected] ~] # Vim rhel6.xml <Name> rhel6 </Name> // modify the name <UUID> a990f28e-4adc-14bc-9fcf-7353877d5c27 </UUID> // modify UUID <source Dev = '/dev/vg_data/rhel6 '/> // modify the disk path .... // modify the MAC address
[[Email protected] ~] # Virsh define el5snap1. xml // import the custom domain el5snap1 (from el5snap1. XML) [[email protected] ~] # Virsh list -- all // confirm the result...-el5snap1 close ....

Adjust the nic of the kvm real machine server, create a VM on the command line, and create a VM on the LV Snapshot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.