KVM

虚拟化和虚拟网桥两种实现方法

marksugar
2015-07-01 / 0 评论 / 4,442 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2015年11月13日,已超过2146天没有更新,若内容或图片失效,请留言反馈。

<p class="MsoNormal"> <span>Linux</span>:<span>QEMN</span>,<span>QEMN</span>由法国天才程序员研发,大小<span>1</span>到<span>2</span>兆。众多虚拟化都不具备<span>IO</span>模拟,它需要结合<span>QEMN</span>来实现<span></span> </p><p class="MsoNormal"> <span>Virtio</span>:澳大利亚天才研发。天才你懂得<span></span> </p><p class="MsoNormal"> 虚拟化技术分类:<span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">模拟</span><span>:PearPC,Bochs</span>,<span>QUMU</span>这三种模拟器<span></span> </p><p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt;"> <span>1,  </span>底层硬件,硬件之上运行主机,主机之上运行虚拟化模拟器软件,模拟器可以模拟众多硬件环境,如<span>CPU,IO,</span>内存等<span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">完全虚拟化:</span>也称为<span>nativevirtulization</span> </p><p class="MsoNormal"> <span>CPU</span>不做模拟,只做分配和管理,但<span>IO</span>等要做模拟<span>,CPu</span>架构和物理<span>cpu</span>架构保持一致<span></span> </p><p class="MsoNormal"> 内存也不做模拟。<span></span> </p><p class="MsoNormal"> 那么完全虚拟化性能比模拟要高,也不需要<span>BT</span>技术<span></span> </p><p class="MsoNormal"> 两种加速方式:<span>BT</span>和<span>HVM</span> </p><p class="MsoNormal"> 完全虚拟化著名产品:<span>VMware  Workstation</span>,<span>VMware Server </span>,<span>Parallels Desktop </span>,<span>KVM</span>,<span>xen</span>(<span>HVM</span>)<span></span> </p><p class="MsoNormal"> 完全虚拟化和模拟相似,无非就是<span>CPU</span>架构<span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">半虚拟化:</span><span>Para-virtualization</span> </p><p class="MsoNormal"> 底层硬件,向上<span>hypevisor,hyper call</span>,在向上内核需要做修改。这里仅仅是<span>CPU</span>虚拟化<span></span> </p><p class="MsoNormal"> 半虚拟化实现:<span>XEN</span>,<span>uml</span>(<span>user-mode linux</span>)<span></span> </p><p class="MsoNormal"> 虚拟架构和底层架构必须保持一致<span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">OS级别的虚拟化:</span><span></span> </p><p class="MsoNormal"> 底层硬件,向上内核,向上虚拟化管理器,向上个虚拟化用户空间(多个用户空间)和虚拟机管理器<span></span> </p><p class="MsoNormal"> 各虚拟机启动十分简单<span></span> </p><p class="MsoNormal"> 比较流行的:<span>IDC</span>机房的<span>vps</span>服务,<span>OpenVZ</span>实现,<span>lxc</span> </p><p class="MsoNormal"> <span>Server containers</span>也是一种实现,<span>FreeBSD  jails</span>则是<span>OS</span>级别的虚拟化,但是这还是没有<span>XEN,KVM</span>应用的多,在稳定性上讲<span></span> </p><p class="MsoNormal"> 提供虚拟机便是提供虚拟机用户空间,而不是提供虚拟机内核<span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">库虚拟化:</span><span>wine</span>:只是安装了一个库,运行exe等<span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">应用程序虚拟化:</span><span>JVM</span> </p><p class="MsoNormal"> <span> </span> </p><p class="MsoNormal"> 虚拟化网络:<span></span> </p><p class="MsoNormal"> <span> </span> </p><p class="MsoNormal"> 创建桥接模式:<span></span> </p><p class="MsoNormal"> 不支持<span>NetworkManaget</span> </p><p class="MsoNormal"> 关闭:<span>chkconfig NetworkManaget off</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# chkconfigNetworkManager off</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# yum -y installbridge-utils</span> </p><p class="MsoNormal"> 桥的实现是内核,这个只是桥驱动<span></span> </p><p class="MsoNormal"> 方法<span>1</span>,修改配置文件<span></span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# cd/etc/sysconfig/network-scripts/</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent network-scripts]# ls</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent network-scripts]# cpifcfg-eth1 ifcfg-br0</span> </p><p class="MsoNormal"> <span>这里编辑完成</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# cat/etc/sysconfig/network-scripts/ifcfg-br0 </span> </p><p class="MsoNormal"> <span>DEVICE=<span style="background-color:#E53333;">br0</span></span> </p><p class="MsoNormal"> <span>BOOTPROTO=none</span> </p><p class="MsoNormal"> <span>NM_CONTROLLED=no</span> </p><p class="MsoNormal"> <span>ONBOOT=yes</span> </p><p class="MsoNormal"> <span>TYPE=<span style="background-color:#E53333;">Bridge</span></span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">IPADDR=172.16.249.88</span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">NETMASK=255.255.0.0</span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">GATEWAYY=172.16.0.1</span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">DNS1=172.16.0.1</span> </p><p class="MsoNormal"> <span>IPV6INIT=no</span> </p><p class="MsoNormal"> <span>USERCTL=no</span> </p><p class="MsoNormal"> <span> </span> </p><p class="MsoNormal"> <span> [root@zabbix_agent~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 </span> </p><p class="MsoNormal"> <span>DEVICE=eth1</span> </p><p class="MsoNormal"> <span>BOOTPROTO=none</span> </p><p class="MsoNormal"> <span>NM_CONTROLLED=no</span> </p><p class="MsoNormal"> <span>ONBOOT=yes</span> </p><p class="MsoNormal"> <span>TYPE=Ethernet</span> </p><p class="MsoNormal"> <span style="background-color:#E53333;">BRIDGE=br0</span> </p><p class="MsoNormal"> <span>IPV6INIT=no</span> </p><p class="MsoNormal"> <span>USERCTL=no</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# ~   </span> </p><p> 这就将BR0上关联了eth1         </p><p> </p><p>
</p><p class="MsoNormal"> 使用<span>brct l  show</span>查看当前的桥设备<span></span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl show</span> </p><p class="MsoNormal"> <span>bridge name    bridgeid                              STP enabled     interfaces</span> </p><p class="MsoNormal"> <span>br0                8000.000c29b53c7d         no                       eth1</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#</span> </p><p class="MsoNormal"> 打开stp<span></span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl stp br0 on</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl show</span> </p><p class="MsoNormal"> <span>bridge name    bridgeid            STP enabled     interfaces</span> </p><p class="MsoNormal"> <span>br0            8000.000c29b53c7d         yes             eth1</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#</span> </p><p class="MsoNormal"> <span> </span> </p><p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt;"> <span>1,  </span>命令行实现桥(这里设置将会端口远程连接)<span></span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# yum list allbridge-utils</span> </p><p class="MsoNormal"> 创建<span>bro</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl addbr br0</span> </p><p class="MsoNormal"> <span>Br0</span>现在没有地址使用<span>ifconfig</span>是查看不到的,使用<span>brctl  show</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl show</span> </p><p class="MsoNormal"> <span> </span> </p><p class="MsoNormal"> 添加之前需要将<span>eth1</span>的<span>IP</span>除掉,这里使用<span>ifconfig</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#Ifconfig  eth1  0  up</span> </p><p class="MsoNormal"> 而后在开始添加<span></span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#Brctl  addif  br0   eth1</span> </p><p class="MsoNormal"> 设置<span>ip</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#Brctl  addif  br0  172.16.249.88/16 up</span> </p><p class="MsoNormal"> 添加路由<span></span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#Route  add  default   gw  172.16.0.1</span> </p> <p>
</p><p>
</p><p class="MsoNormal"> 删除<span>br0</span>:<span>brctl   delbr  br0</span> </p><p class="MsoNormal"> <span> </span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl show</span> </p><p class="MsoNormal"> <span>bridge name    bridgeid            STP enabled     interfaces</span> </p><p class="MsoNormal"> <span>br0            8000.000c29b53c7d         no              eth1</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl stp br0 on</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]# brctl show</span> </p><p class="MsoNormal"> <span>bridge name    bridgeid            STP enabled     interfaces</span> </p><p class="MsoNormal"> <span>br0            8000.000c29b53c7d         yes             eth1</span> </p><p class="MsoNormal"> <span>[root@zabbix_agent ~]#</span> </p><p>
</p><p>
</p><p>
</p>

0

评论 (0)

取消