| 第三步:使用virt-clone克隆新的虚拟机 [root@ken ~]# virt-clone -o Centos7-x86_64 -n centos7_test -f /ken/img/centos7_test.img Allocating 'centos7_test.img' | 10 GB 00:00:36  Clone 'centos7_test' created successfully. 
 第四步:查看虚拟机 [root@ken ~]# virsh list --all  Id Name State ----------------------------------------------------  - Centos7-x86_64 shut off  - centos7_test shut off 
 第五步:启动虚拟机 [root@ken ~]# virsh start centos7_test  Domain centos7_test started [root@ken ~]# virsh list --all  Id Name State ----------------------------------------------------  3 centos7_test running 
 第六步:进入虚拟机 [root@ken ~]# virsh console centos7_test Connected to domain centos7_test Escape character is ^] CentOS Linux 7 (Core) Kernel 3.10.0-327.el7.x86_64 on an x86_64 localhost login: root Password:  Last login: Mon Mar 18 22:21:24 on ttyS0 [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  inet 127.0.0.1/8 scope host lo  valid_lft forever preferred_lft forever  inet6 ::1/128 scope host   valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000  link/ether 52:54:00:cc:69:f8 brd ff:ff:ff:ff:ff:ff  inet 192.168.122.161/24 brd 192.168.122.255 scope global dynamic eth0  valid_lft 3597sec preferred_lft 3597sec  inet6 fe80::5054:ff:fecc:69f8/64 scope link   valid_lft forever preferred_lft forever 
 xshell连接虚拟机 现在物理主机是ping不通KVM虚拟机的,只有宿主机可以和KVM通信 第一步:创建脚本并执行 [root@ken ~]# cat bridg.sh  #!/bin/bash brctl addbr br0 #创建桥接网卡 brctl addif br0 eth0 #把eth0加入到br0中 ip a d 192.168.4.190/24 dev eth0 #删除eth0的IP地址 ifconfig br0 192.168.4.190/24 up #启动br0网络 route add default gw 192.168.4.1 #添加网关 
 第二步:查看网络 
 第三步:测试外网连通性 [root@ken ~]# ping www.baidu.com PING www.a.shifen.com (119.75.217.26) 56(84) bytes of data. 64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=1 ttl=54 time=6.08 ms 64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=2 ttl=54 time=9.20 ms 64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=3 ttl=54 time=8.58 ms ^C --- www.a.shifen.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 6020ms rtt min/avg/max/mdev = 6.087/7.957/9.201/1.346 ms 
 第四步:编辑虚拟机 (编辑:鹰潭站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |