KVM安装部署虚拟机(2)

7.7.为GUEST添加虚拟网卡tap10,并加入网桥tap10
# tunctl -t tap10
Set 'tap10' persistent and owned by uid 0
# brctl addif br0 tap10
# ifconfig tap10 up
# brctl show
bridge name    bridge id              STP enabled    interfaces
br0            8000.001d72586f93      yes            ens3
                                                        tap10
virbr0          8000.5254007ee7ca      yes            virbr0-nic

查看多出tap10 
# ifconfig 
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.3  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::21d:72ff:fe58:6f93  prefixlen 64  scopeid 0x20<link>
        ether 00:1d:72:58:6f:93  txqueuelen 1000  (Ethernet)
        RX packets 13615  bytes 6924507 (6.6 MiB)
        RX errors 0  dropped 3445  overruns 0  frame 0
        TX packets 5742  bytes 7811746 (7.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:1d:72:58:6f:93  txqueuelen 1000  (Ethernet)
        RX packets 14517  bytes 7182587 (6.8 MiB)
        RX errors 0  dropped 341  overruns 0  frame 0
        TX packets 6733  bytes 7868932 (7.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 17 
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 14  bytes 770 (770.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 770 (770.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
tap10: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 5a:c7:ec:11:0b:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:7e:e7:ca  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

7.8.为虚拟桥接网卡tap10建立配置文件,重启系统时能随系统启动,并加入网桥 br0

# vim /etc/sysconfig/network-scripts/ifcfg-tap10
DEVICE=tap10
TYPE=Tap
ONBOOT=yes
BRIDGE=br0

8.安装vnc
yum install vnc-server tigervnc -y

设置vnc密码
# vncpasswd

9.开始安装kvm
9.1.创建虚拟磁盘目录
# mkdir -pv /home/kvm/image/

9.2.创建虚拟磁盘文件
# qemu-img create -o preallocation=metadata -f qcow2 /home/kvm/image/cent7_1.qcow2 20G

9.3.vnc连接

KVM安装部署虚拟机

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13969.html