安装依赖包(因最小化安装)

[root@slave-master ~]# yum install -y vim wget tree  lrzsz gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop  lsof  ntpdate telnet bridge-utils -y

安装kvm相关的包

[root@slave-master ~]# yum install qemu-kvm qemu-kvm-tools libvirt libvirt-client virt-manager virt-install -y

启动libvirt虚拟网卡

[root@slave-master ~]# systemctl start libvirtd
[root@slave-master ~]# systemctl enable libvirtd #添加开机自启动

配置网卡绑定

[root@slave-master network-scripts]# vim ifcfg-bond0  #先配置bond0
BOOTPROTO=static
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br0
[root@slave-master network-scripts]# vim ifcfg-br0 #配置br0
TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=172.16.129.102
NETMASK=255.255.0.0
GATEWAY=172.16.129.1
[root@slave-master network-scripts]# vim -o ifcfg-eth0 ifcfg-eth1 # 配置eth0和eth1
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
USERCTL=no
SLAVE=yes
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
ifcfg-eth0 [+]                                                                                         8,10           All
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond1
USERCTL=no
SLAVE=yes

[root@slave-master network-scripts]# vim -o ifcfg-bond0 ifcfg-bond1 #配置bond1 配置内网
BOOTPROTO=static
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br0
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
ifcfg-bond0                                                                                            7,1            All
BOOTPROTO=static
NAME=bond1
DEVICE=bond1
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br1

[root@slave-master network-scripts]# vim -o ifcfg-br0 ifcfg-br1

TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=172.16.129.102
NETMASK=255.255.0.0
GATEWAY=172.16.129.1
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
ifcfg-br0                                                                                              3,1            All
TYPE=Bridge
BOOTPROTO=static
NAME=br1
DEVICE=br1
ONBOOT=yes
IPADDR=192.168.37.102
NETMASK=255.255.255.0

关闭服务

[root@slave-master ~]# systemctl stop NetworManager
[root@slave-master ~]# systemctl disable NetworkManager
[root@slave-master ~]# systemctl disable firewalld
[root@slave-master ~]# vim /etc/sysconfig/selinux
SELINUX=disabled

安装组件

[root@slave-master ~]# yum install bridge-utils -y

重启网络服务或重启电脑

[root@slave-master ~]# systemctl restart network

创建虚拟磁盘

[root@slave-master ~]# qemu-img create -f qcow2 /var/lib/libvirt/images/linux_bridge.qcow2 10G

创建虚拟机

[root@slave-master ~]# virt-install --virt-type kvm --name centos7_bridge --ram 1024 --vcpu 2 --cdrom=/usr/local/src/CentOS-7-x86_64-Minimal-1810.iso  --disk path=/var/lib/libvirt/images/linux_bridge.qcow2 --network bridge=br0 --graphics vnc,listen=0.0.0.0 --noautoconsole

管理虚拟机

[root@slave-master ~]# virt-manager

修改参数

安装系统

KVM配置的更多相关文章

  1. [转载]虚拟化之KVM配置

    虚拟化之KVM配置 2017-11-06 [TOC] 虚拟化:通过虚拟化工具把cpu,内存,硬盘等真实硬件资源给模拟成更少的虚拟硬件资源.进行虚拟化的好处是,最大限度的利用硬件资源.也是云计算的基础. ...

  2. CentOS下KVM配置NAT网络(网络地址转换模式)

    KVM虚拟机Nat方式上网: # 查看当前活跃的网络 virsh net-list # 查看该网络的详细配置 virsh net-dumpxml default 客户机的XML配置文件中interfa ...

  3. KVM配置及维护

    kvm使用场景 1.公司测试环境/开发环境 测试开发环境可以使用配置低点的物理机就可以 2.公司生产环境 一般小公司没有私有云或容器团队,运维人员可能就1-2个,然后公司也不舍得花钱买商业化的私有云. ...

  4. 3、kvm配置vnc

    配置kvm通过vnc访问 virsh edit privi-server 添加如下配置: <graphics type='vnc' port='5901' autoport='no' liste ...

  5. kvm配置虚拟机[待整理]

    working note 4-12-2016 1,利用libvirt图形虚拟机管理工具virt-manager搭建虚拟机,通过存储池(storage pool )和卷(volume)存放虚拟机镜像(I ...

  6. 009.KVM配置调整

    一 内存CPU调整 1.1 增大虚拟机内存 [root@kvm-host ~]# virsh shutdown vm01-centos6.8 [root@kvm-host ~]# virsh edit ...

  7. 【CI】系列三.宿主机KVM配置及vdi与vmdk格式转换等

    前提:宿主机需要支持虚拟化,如果未打开,则需要重启机器,在bois中打开该项: Ubuntu 及 KVM 相关主要参考官方 https://wiki.ubuntu.com/kvm 另外也可参考该页面: ...

  8. 对于kvm配置ssh

    首先我们要让自己的机器开启ssh服务 首先更新源 sudo apt-get update 安装ssh服务 sudo apt-get install openssh-server 检测是否已启动 ps ...

  9. kvm配置USB直通

    参照:https://www.linuxidc.com/Linux/2014-12/110919.htm WebVirMgr界面是没有直接的途径了,只能靠修改xml文件,在<device> ...

随机推荐

  1. JMeter学习笔记--录制脚本(一)

    ---------------------------------------------------------------------------------------------------- ...

  2. Centos8上安装Mysql8.X

    一.下载Mysql 下载地址:https://dev.mysql.com/downloads/mysql/ 二.将压缩包通过ftp软件服务器的目标位置:并解压 1.我的是放在:/root/softwa ...

  3. Navicat15最新版本破解 亲测可用!!!(Navicat Premium 注册出现 No All Pattern Found! File Already Patched)

    1.下载Navicat Premium官网https://www.navicat.com.cn/下载最新版本下载安装 2.本人网盘链接:https://pan.baidu.com/s/1ncSaxId ...

  4. [源码解析] PyTorch 分布式(7) ----- DistributedDataParallel 之进程组

    [源码解析] PyTorch 分布式(7) ----- DistributedDataParallel 之进程组 目录 [源码解析] PyTorch 分布式(7) ----- DistributedD ...

  5. Go语言核心36讲(Go语言实战与应用十二)--学习笔记

    34 | 并发安全字典sync.Map (上) 我们今天再来讲一个并发安全的高级数据结构:sync.Map.众所周知,Go 语言自带的字典类型map并不是并发安全的. 前导知识:并发安全字典诞生史 换 ...

  6. PIC16 bootloader之UART bootloader

    了解更多关于bootloader 的C语言实现,请加我Q扣: 1273623966 (验证信息请填 bootloader),欢迎咨询或定制bootloader(在线升级程序). PIC16 bootl ...

  7. Spring Cloud Gateway过滤器精确控制异常返回(实战,完全定制返回body)

    欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 本篇概览 Spring Cloud Gateway应用 ...

  8. Codeforces 575A - Fibonotci

    题面传送门 题意: 给出 \(s_0,s_1,s_2,\dots,s_{n-1}\),对于 \(i\geq n\),有 \(m\) 个 \(s_i\) 满足 \(s_i\neq s_{i\bmod n ...

  9. CF1466G Song of the Sirens

    题目传送门 题意简述:给出 \(n,s_0,t\ (n=|t|)\),定义 \(s_i=s_{i-1}+t_i+s_{i-1}\).多次询问给出 \(k,m\),求 \(m\) 在 \(s_k\) 中 ...

  10. RSA,DSA,ECDSA,EdDSA和Ed25519的区别

    RSA,DSA,ECDSA,EdDSA和Ed25519的区别 用过ssh的朋友都知道,ssh key的类型有很多种,比如dsa.rsa. ecdsa.ed25519等,那这么多种类型,我们要如何选择呢 ...