#!/bin/bash ######################################## File Description ######################################## # Creation time:2020-05-30 # Project:09 # Task: 04 # Execute example:bash record-shell-x-x.sh # Detailed description: # About:http://linux.book.51xueweb.cn ################################################################################################## #***************reader shell start*************** #!/usr/bin/bash # Connect the KVM virtual machine virsh list --all virsh autostart VM-CentOS-Temp ls /etc/libvirt/qemu/autostart/ # Initialize the KVM virtual machine cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.bak cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eth0 UUID=7da04693-afeb-4c78-9573-b8369b48af2e DEVICE=eth0 ONBOOT=yes IPADDR=10.10.2.140 GATEWAY=10.10.2.1 NETMASK=255.255.255.0 DNS1=8.8.8.8 EOF # Please operate in the virtual machine # Add a CPU to the KVM virtual machine virsh dominfo VM-CentOS-Temp virsh shutdown VM-CentOS-Temp virsh list --all virsh edit VM-CentOS-Temp virsh start VM-CentOS-Temp virsh dominfo VM-CentOS-Temp #***************reader shell end***************