参考:
http://libvirt.org/formatnetwork.html#examplesNAT
This example is the so called "default" virtual network. It is provided and enabled out-of-the-box for all libvirt installations. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
NAT(Network Address Translation)表示共享主机的IP地址,虚拟机的IP被翻译为好像是宿主机的公有IP一样,即使这个宿主机只允许有一个公有IP, 那该宿主机上的多台虚拟机都可以访问物理网络,虚拟机上的请求根据宿主机的路由转发。NAT mode will mask all network activity as if it came from your Host OS, although the VM can access external resources.
<network>
<name>default</name>
<bridge name="virbr0" />
<forward mode="nat"/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
<ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" />
</network>
This is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network. This example further specifies that guest traffic may only go out via the eth1
host network device.
效果近似于NAT,但是需要提前在物理网的路由器上配置该IP段的转发。例如下面IP段只能通过eth1转发出去。
<network>
<name>local</name>
<bridge name="virbr1" />
<forward mode="route" dev="eth1"/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
<ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" />
</network>
This variant provides a completely isolated private network for guests. The guests can talk to each other, and the host OS, but cannot reach any other machines on the LAN, due to the omission of the forward
element in the XML description.
仅主机方式:宿主机上的多台guests相互可以通信,和宿主机也可以通信,但是和LAN上的其他机器不能通信(没有 forward字段)
<network>
<name>private</name>
<bridge name="virbr2" />
<ip address="192.168.152.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.152.2" end="192.168.152.254" />
</dhcp>
</ip>
<ip family="ipv6" address="2001:db8:ca2:3::1" prefix="64" />
</network>
Since 0.9.4 This shows how to use a pre-existing host bridge "br0". The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections).
该bridge可以是an existing host bridge 或者 an existing Open vSwitch bridge t
<network>
<name>host-bridge</name>
<forward mode="bridge"/>
<bridge name="br0"/>
</network>
qemu-system-x86_64 -hda /path/to/hda.img -net nic,macaddr=$macaddress -net tap
另外kvm还有一种方式:
qemu-system-x86_64 -hda /path/to/hda.img -net nic -net user
Use case:
- You want a simple way for your virtual machine to access to the host, to the internet or to resources available on your local network.
- You don't need to access your guest from the network or from another guest.
- You are ready to take a huge performance hit.
- Warning: User networking does not support a number of networking features like ICMP. Certain applications (like ping) may not function properly.
分享到:
相关推荐
libvirt是Linux下管理虚拟化资源的开放源代码API,它支持KVM、Xen和VMware等虚拟化技术。本文档是《libvirt C语言应用开发指南》的摘录,介绍了如何利用libvirt开发应用程序。文档详细说明了libvirt的架构、对象模型...
Libvirt是一个强大的开源库,用于管理和控制虚拟化平台,如KVM、Xen、QEMU等。这个PHP管理器利用Libvirt的API来执行各种操作,使非专业用户也能方便地进行虚拟机的日常维护。 该管理系统的核心功能包括: 1. **...
Libvirt 是一个开源项目,提供了一组 API、工具和库,用于管理和控制虚拟化平台。在 OpenStack 环境中,Libvirt 是一个至关重要的组件,它为各种虚拟化技术(如 KVM、Xen、QEMU 和 LXC)提供了统一的接口,使得 ...
《深入理解libvirt-java 0.4.7:构建虚拟化世界的桥梁》 在IT行业中,虚拟化技术已经成为云计算和数据中心基础设施的重要组成部分。libvirt是一个强大的开源库,它为多种虚拟化平台提供了一致的API接口,使得开发者...
### Libvirt Qemu KVM 教程大全 #### 虚拟化基本概念与类型 虚拟化技术允许在单一物理主机上运行多个操作系统实例(即虚拟机),这为资源的有效利用提供了新的途径。虚拟化的基本类型包括无虚拟化、半虚拟化、非...
**libvirt源码详解** Libvirt是一个开源的API、库和工具集合,它为管理和配置虚拟化技术提供了统一的接口。这个源码包是版本0.9.11,适用于安装和开发基于libvirt的应用程序。在深入研究libvirt源码之前,我们需要...
Qemu KVM and Libvirt Qemu KVM 和 Libvirt 是虚拟化领域中的三个重要概念,分别是虚拟机监控器、内核模块和虚拟机管理工具。本文将对这三个概念进行解析,并探讨它们之间的关系。 虚拟化的基本类型 虚拟化可以...
**libvirt-snmp 网络管理接口** libvirt-snmp 是一个专为虚拟化环境设计的网络管理接口工具,它允许用户通过简单网络管理协议(SNMP)来监控和管理虚拟机网络流量。该工具提供了对libvirt库的扩展,使SNMP支持成为...
Libvirt虚拟化技术介绍 Libvirt虚拟化技术是当前使用最广泛的对KVM虚拟机进行管理的工具和应用程序接口。Libvirt支持多种虚拟化方案,既支持包括KVM、QEMU、Xen、VMware、VirtualBox等在内的平台虚拟化方案,又支持...
### libvirt编译安装详解 在深入探讨libvirt的编译与安装过程之前,我们先来了解一下libvirt是什么。libvirt是一个开源的软件集合,它提供了用于管理虚拟化基础设施的工具和应用程序接口(API)。libvirt支持多种...
本文档是关于libvirt开发的资料,主要内容涉及使用Python搭建和维护虚拟机环境。libvirt是一个开源API库,它提供了对虚拟化技术如KVM, Xen和QEMU等进行管理的接口。在IT行业中,libvirt库被广泛用于开发和管理虚拟化...
《深入理解libvirt:KVM虚拟化关键技术剖析》 libvirt是开源社区开发的一个强大而灵活的工具,它为管理虚拟化技术提供了一个统一的API接口。libvirt支持多种虚拟化平台,包括KVM(Kernel-based Virtual Machine)、...
### libvirt-test-API #### 概述 "libvirt-test-API" 是一个专注于虚拟化管理的测试套件项目,主要用于对 `libvirt` 的功能进行回归测试。该项目使用 Python 编写,旨在通过 Python 绑定接口来尽可能覆盖 `libvirt`...
在IT行业中,libvirt是一个非常重要的工具,它提供了一个API来管理虚拟化平台,如KVM、Xen、QEMU等。Ruby-libvirt是libvirt的Ruby语言绑定,允许开发者用Ruby编写与libvirt交互的程序。然而,在非Linux操作系统上,...
本文档是一份针对使用Python语言进行libvirt应用程序开发的指南。libvirt是一个开源的API,它提供了对虚拟化技术的管理功能。本文将详细介绍libvirt的应用架构、对象模型、驱动模型以及远程管理等关键知识点。读者...
二、libvirt0.9.4的关键特性 1. **多平台支持**:libvirt0.9.4支持多种虚拟化平台,包括Linux上的KVM、Xen,以及Windows上的Hyper-V等,提供了一致的编程接口,降低了开发难度。 2. **丰富的API**:该版本提供了...
libvirt java绑定包 提供java API
Libvirt是一个功能强大的虚拟化管理工具,它提供了一套统一的API来管理不同类型的虚拟化平台。Libvirt的开发目标是提供一个通用和稳定的抽象层,以便安全地管理节点上的虚拟机,包括可能远程的节点。Libvirt的功能...
离线安装包安装:rpm -ivh [rpm完整包名]
`.whl`文件是一种Python的二进制安装包格式,旨在简化软件的安装过程。用户可以通过Python的`pip`工具直接安装这个`.whl`文件,而无需编译源代码,大大减少了安装时间和可能出现的依赖问题。 安装libvirt_vmcfg库的...