User Tools

Site Tools


virtualisation:kvm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
virtualisation:kvm [2018/07/18 11:44]
Luc Nieland [Distribution: Ubuntu 18.04 LTS]
virtualisation:kvm [2020/02/13 17:05] (current)
Luc Nieland CentOS-8: bond + vlan + bridge
Line 347: Line 347:
  
  
-=====Distribution:​ CentOS ​6.0 =====+=====Distribution:​ CentOS ===== 
 ===preparation=== ===preparation===
-Install a minimal CentOS ​6.0 system with a static IP-number.+Install a minimal CentOS system with a static IP-number.
  
 +
 +
 +
 +===network config CentOS-8===
 +
 +With nmcli
 +
 +Add to /​etc/​sysconfig/​
 +
 +Bonding:
 +<​code>​
 + nmcli con add type bond con-name bond0 ifname bond0  autoconnect yes \
 +         ​ipv4.method disabled ​ \
 +         ​ipv6.method ignore
 + nmcli con add type ethernet ifname eno1 con-name bond0-sl1 ​   master bond0
 + nmcli con add type ethernet ifname eno2 con-name bond0-sl2 ​   master bond0
 +<​code>​
 +
 +
 +Split the trunc-datastream to VLAN'​s:​
 +<​code>​
 + nmcli con add type vlan ifname vlan20 con-name vlan20 vlan.id 20 \
 +       ​vlan.parent bond0 \
 +       ​ipv4.method disabled \
 +       ​ipv6.method ignore
 + # repeat per VLAN
 +<​code>​
 +
 +
 +Create a bridge per VLAN:
 +<​code>​
 +BR_NAME="​br20"​
 +BR_INT="​vlan20"​
 +SUBNET_IP="​192.168.103.32/​24"​
 +GW="​192.168.103.1"​
 +DNS1="​192.168.102.144"​
 +DNS2="​192.168.102.146"​
 +nmcli connection add    type bridge ​ con-name ${BR_NAME} ifname ${BR_NAME} ​ autoconnect yes
 + nmcli connection modify ${BR_NAME} ipv4.method manual ​  ​ipv4.addresses ${SUBNET_IP} ​
 + nmcli connection modify ${BR_NAME} ipv4.gateway ${GW}
 + nmcli connection modify ${BR_NAME} ipv4.dns ${DNS1} +ipv4.dns ${DNS2}
 + nmcli connection up ${BR_NAME}
 +nmcli connection add type bridge-slave ​ con-name ${BR_INT} ifname ${BR_INT} master ${BR_NAME} ​   autoconnect yes
 + nmcli connection up ifname ${BR_INT}
 +#
 +ip r add default ​ via 192.168.103.1
 +#
 +<​code>​
 +
 +===hypervisor kvm===
 Install the software: Install the software:
  
   yum install kvm virt-manager libvirt   yum install kvm virt-manager libvirt
 +
 +
  
  
Line 644: Line 697:
  
  
 +
 +
 +
 +
 +======Migration of VMs to another host ======
 +Instructions how to migrate VMs to another hypervisor-host.
 +
 +====Offline====
 +
 +Create a destination KVM-hypervisor system, including bridges on the required networks and VLANs. Try to use the same names for bridges, filesystems,​ logical-volumes. Else use "virsh edit" to make the modifications befor starting the VM on the destination hypervisor.
 +
 +
 +===On the source-hypervisor===
 +
 +create a definition-file:​
 +  virsh list --all
 +  virsh dumpxml --security-info ​ vpstest2 ​ >  /​var/​lib/​libvirt/​images/​vpstest2.xml
 +  virsh shutdown vpstest2
 +  virsh destroy ​ vpstest2 ​  # if needed
 +
 +
 +===On the destination-hypervisor===
 +
 +Create the required logical-volumes,​ and symlinks:
 +  lvcreate -L 4G -n vpstest2 vg0
 +  ln -s /​dev/​mapper/​vg0-vpstest2 /​var/​lib/​libvirt/​images/​vpstest2.img
 +
 +And get the raw-logical-volume with a dd piped through ssh:
 +  ssh root@sourcehyp "dd if=/​dev/​mapper/​vg0-vpstest2"​ | dd of=/​dev/​mapper/​vg0-vpstest2
 +
 +And get the config-definition-file:​
 +  scp root@sourcehyp:/​var/​lib/​libvirt/​images/​vpstest2.xml ​ /​var/​lib/​libvirt/​images/​vpstest2.xml
 +
 +And create the VM:
 +  virsh define /​var/​lib/​libvirt/​images/​vpstest2.xml
 +
 +And start the VM:
 +  virsh start vpstest2
 +
 +
 +
 +  ​
  
  
  
virtualisation/kvm.1531907051.txt.gz · Last modified: 2018/07/18 11:44 by Luc Nieland