2008-04-23 17:08:31 +00:00
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<h1>Network XML format</h1>
|
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<ul id="toc">
|
|
|
|
</ul>
|
|
|
|
|
2008-04-29 14:08:08 +00:00
|
|
|
<p>
|
|
|
|
This page provides an introduction to the network XML format. For background
|
|
|
|
information on the concepts referred to here, consult the <a href="archnetwork.html">network driver architecture</a>
|
|
|
|
page.
|
|
|
|
</p>
|
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h2><a name="elements">Element and attribute overview</a></h2>
|
2008-04-29 14:08:08 +00:00
|
|
|
|
|
|
|
<p>
|
|
|
|
The root element required for all virtual networks is
|
|
|
|
named <code>network</code> and has no attributes.
|
2008-05-06 23:23:55 +00:00
|
|
|
The network XML format is available <span class="since">since 0.3.0</span>
|
2008-04-29 14:08:08 +00:00
|
|
|
</p>
|
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h3><a name="elementsMetadata">General metadata</a></h3>
|
2008-04-29 14:08:08 +00:00
|
|
|
|
|
|
|
<p>
|
|
|
|
The first elements provide basic metadata about the virtual
|
|
|
|
network.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<network>
|
|
|
|
<name>default</name>
|
|
|
|
<uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid>
|
|
|
|
...</pre>
|
|
|
|
|
|
|
|
<dl>
|
|
|
|
<dt><code>name</code></dt>
|
|
|
|
<dd>The content of the <code>name</code> element provides
|
2009-11-06 15:04:19 +00:00
|
|
|
a short name for the virtual network. This name should
|
|
|
|
consist only of alpha-numeric characters and is required
|
|
|
|
to be unique within the scope of a single host. It is
|
|
|
|
used to form the filename for storing the persistent
|
|
|
|
configuration file. <span class="since">Since 0.3.0</span></dd>
|
2008-04-29 14:08:08 +00:00
|
|
|
<dt><code>uuid</code></dt>
|
|
|
|
<dd>The content of the <code>uuid</code> element provides
|
2009-11-06 15:04:19 +00:00
|
|
|
a globally unique identifier for the virtual network.
|
|
|
|
The format must be RFC 4122 compliant, eg <code>3e3fce45-4f53-4fa7-bb32-11f34168b82b</code>.
|
|
|
|
If omitted when defining/creating a new network, a random
|
|
|
|
UUID is generated. <span class="since">Since 0.3.0</span></dd>
|
2008-04-29 14:08:08 +00:00
|
|
|
</dl>
|
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h3><a name="elementsConnect">Connectivity</a></h3>
|
2008-04-29 14:08:08 +00:00
|
|
|
|
|
|
|
<p>
|
|
|
|
The next set of elements control how a virtual network is
|
|
|
|
provided connectivity to the physical LAN (if at all).
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
...
|
2010-02-22 21:26:44 +00:00
|
|
|
<bridge name="virbr0" stp="on" delay="5"/>
|
2010-02-22 21:39:55 +00:00
|
|
|
<domain name="example"/>
|
2009-11-06 15:04:19 +00:00
|
|
|
<forward mode="nat" dev="eth0"/>
|
|
|
|
...</pre>
|
2008-04-29 14:08:08 +00:00
|
|
|
|
|
|
|
<dl>
|
|
|
|
<dt><code>bridge</code></dt>
|
|
|
|
<dd>The <code>name</code> attribute on the <code>bridge</code> element
|
2009-11-06 15:04:19 +00:00
|
|
|
defines the name of a bridge device which will be used to construct
|
|
|
|
the virtual network. The virtual machines will be connected to this
|
|
|
|
bridge device allowing them to talk to each other. The bridge device
|
|
|
|
may also be connected to the LAN. It is recommended that bridge
|
|
|
|
device names started with the prefix <code>vir</code>, but the name
|
|
|
|
<code>virbr0</code> is reserved for the "default" virtual network.
|
|
|
|
This element should always be provided when defining a new network.
|
2010-02-22 21:26:44 +00:00
|
|
|
Attribute <code>stp</code> specifies if Spanning Tree Protocol is
|
|
|
|
'on' or 'off' (default is 'on'). Attribute <code>delay</code> sets
|
|
|
|
the bridge's forward delay value in seconds (default is 0).
|
2009-11-06 15:04:19 +00:00
|
|
|
<span class="since">Since 0.3.0</span>
|
2008-04-29 14:08:08 +00:00
|
|
|
</dd>
|
2010-02-22 21:39:55 +00:00
|
|
|
<dt><code>domain</code></dt>
|
|
|
|
<dd>
|
|
|
|
The <code>name</code> attribute on the <code>domain</code> element
|
|
|
|
defines the DNS domain of the DHCP server. This element is optional.
|
|
|
|
<span class="since">Since 0.4.5</span>
|
|
|
|
</dd>
|
2008-04-29 14:08:08 +00:00
|
|
|
<dt><code>forward</code></dt>
|
|
|
|
<dd>Inclusion of the <code>forward</code> element indicates that
|
2010-12-16 20:50:01 +00:00
|
|
|
the virtual network is to be connected to the physical
|
|
|
|
LAN. the <code>mode</code> attribute determines the method of
|
|
|
|
forwarding; possible selections are 'nat' and 'route'. If mode
|
|
|
|
is not specified, NAT forwarding will be used for
|
|
|
|
connectivity. If a network has any IPv6 addresses defined,
|
|
|
|
even if <code>mode</code> is given as 'nat', the IPv6 traffic
|
|
|
|
will be forwarded using routing, since IPv6 has no concept of NAT.
|
2009-11-06 15:04:19 +00:00
|
|
|
Firewall rules will allow forwarding to any other network device whether
|
|
|
|
ethernet, wireless, dialup, or VPN. If the <code>dev</code> attribute
|
|
|
|
is set, the firewall rules will restrict forwarding to the named
|
|
|
|
device only. If the <code>mode</code> attribute is set to <code>route</code>
|
|
|
|
then the traffic will not have NAT applied. This presumes that the
|
|
|
|
local LAN router has suitable routing table entries to return traffic
|
|
|
|
to this host. <span class="since">Since 0.3.0; 'mode' attribute since
|
2008-05-06 23:23:55 +00:00
|
|
|
0.4.2</span></dd>
|
2008-04-29 14:08:08 +00:00
|
|
|
</dl>
|
2011-07-22 14:07:23 +00:00
|
|
|
<h5><a name="elementQoS">Quality of service</a></h5>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
...
|
|
|
|
<forward mode='nat' dev='eth0'/>
|
|
|
|
<b><bandwidth>
|
|
|
|
<inbound average='1000' peak='5000' burst='5120'/>
|
|
|
|
<outbound average='128' peak='256' burst='256'/>
|
|
|
|
</bandwidth></b>
|
|
|
|
<mac address='00:16:3E:5D:C7:9E'/>
|
|
|
|
...</pre>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
This part of network XML provides setting quality of service. Incoming
|
|
|
|
and outgoing traffic can be shaped independently. The
|
|
|
|
<code>bandwidth</code> element can have at most one <code>inbound</code>
|
|
|
|
and at most one <code>outbound</code> child elements. Leaving any of these
|
|
|
|
children element out result in no QoS applied on that traffic direction.
|
|
|
|
So, when you want to shape only network's incoming traffic, use
|
|
|
|
<code>inbound</code> only, and vice versa. Each of these elements have one
|
|
|
|
mandatory attribute <code>average</code>. It specifies average bit rate on
|
|
|
|
interface being shaped. Then there are two optional attributes:
|
|
|
|
<code>peak</code>, which specifies maximum rate at which bridge can send
|
|
|
|
data, and <code>burst</code>, amount of bytes that can be burst at
|
|
|
|
<code>peak</code> speed. Accepted values for attributes are integer
|
|
|
|
numbers, The units for <code>average</code> and <code>peak</code> attributes
|
|
|
|
are kilobytes per second, and for the <code>burst</code> just kilobytes.
|
|
|
|
The rate is shared equally within domains connected to the network.
|
2011-07-26 12:42:37 +00:00
|
|
|
Moreover, <code>bandwidth</code> element can be included in
|
|
|
|
<code>portgroup</code> element.
|
2011-07-22 14:07:23 +00:00
|
|
|
<span class="since">Since 0.9.4</span>
|
|
|
|
</p>
|
2008-04-29 14:08:08 +00:00
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h3><a name="elementsAddress">Addressing</a></h3>
|
2008-04-29 14:08:08 +00:00
|
|
|
|
|
|
|
<p>
|
Give each virtual network bridge its own fixed MAC address
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463
The problem was that, since a bridge always acquires the MAC address
of the connected interface with the numerically lowest MAC, as guests
are started and stopped, it was possible for the MAC address to change
over time, and this change in the network was being detected by
Windows 7 (it sees the MAC of the default route change), so on each
reboot it would bring up a dialog box asking about this "new network".
The solution is to create a dummy tap interface with a MAC guaranteed
to be lower than any guest interface's MAC, and attach that tap to the
bridge as soon as it's created. Since all guest MAC addresses start
with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
0" prefix, and it's guaranteed to always win (physical interfaces are
never connected to these bridges, so we don't need to worry about
competing numerically with them).
Note that the dummy tap is never set to IFF_UP state - that's not
necessary in order for the bridge to take its MAC, and not setting it
to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
in the output of the ifconfig command.
I chose to not auto-generate the MAC address in the network XML
parser, as there are likely to be consumers of that API that don't
need or want to have a MAC address associated with the
bridge.
Instead, in bridge_driver.c when the network is being defined, if
there is no MAC, one is generated. To account for virtual network
configs that already exist when upgrading from an older version of
libvirt, I've added a %post script to the specfile that searches for
all network definitions in both the config directory
(/etc/libvirt/qemu/networks) and the state directory
(/var/lib/libvirt/network) that are missing a mac address, generates a
random address, and adds it to the config (and a matching address to
the state file, if there is one).
docs/formatnetwork.html.in: document <mac address.../>
docs/schemas/network.rng: add nac address to schema
libvirt.spec.in: %post script to update existing networks
src/conf/network_conf.[ch]: parse and format <mac address.../>
src/libvirt_private.syms: export a couple private symbols we need
src/network/bridge_driver.c:
auto-generate mac address when needed,
create dummy interface if mac address is present.
tests/networkxml2xmlin/isolated-network.xml
tests/networkxml2xmlin/routed-network.xml
tests/networkxml2xmlout/isolated-network.xml
tests/networkxml2xmlout/routed-network.xml: add mac address to some tests
2011-02-09 08:28:12 +00:00
|
|
|
The final set of elements define the addresses (IPv4 and/or
|
|
|
|
IPv6, as well as MAC) to be assigned to the bridge device
|
|
|
|
associated with the virtual network, and optionally enable DHCP
|
|
|
|
services.
|
2008-04-29 14:08:08 +00:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
...
|
Give each virtual network bridge its own fixed MAC address
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463
The problem was that, since a bridge always acquires the MAC address
of the connected interface with the numerically lowest MAC, as guests
are started and stopped, it was possible for the MAC address to change
over time, and this change in the network was being detected by
Windows 7 (it sees the MAC of the default route change), so on each
reboot it would bring up a dialog box asking about this "new network".
The solution is to create a dummy tap interface with a MAC guaranteed
to be lower than any guest interface's MAC, and attach that tap to the
bridge as soon as it's created. Since all guest MAC addresses start
with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
0" prefix, and it's guaranteed to always win (physical interfaces are
never connected to these bridges, so we don't need to worry about
competing numerically with them).
Note that the dummy tap is never set to IFF_UP state - that's not
necessary in order for the bridge to take its MAC, and not setting it
to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
in the output of the ifconfig command.
I chose to not auto-generate the MAC address in the network XML
parser, as there are likely to be consumers of that API that don't
need or want to have a MAC address associated with the
bridge.
Instead, in bridge_driver.c when the network is being defined, if
there is no MAC, one is generated. To account for virtual network
configs that already exist when upgrading from an older version of
libvirt, I've added a %post script to the specfile that searches for
all network definitions in both the config directory
(/etc/libvirt/qemu/networks) and the state directory
(/var/lib/libvirt/network) that are missing a mac address, generates a
random address, and adds it to the config (and a matching address to
the state file, if there is one).
docs/formatnetwork.html.in: document <mac address.../>
docs/schemas/network.rng: add nac address to schema
libvirt.spec.in: %post script to update existing networks
src/conf/network_conf.[ch]: parse and format <mac address.../>
src/libvirt_private.syms: export a couple private symbols we need
src/network/bridge_driver.c:
auto-generate mac address when needed,
create dummy interface if mac address is present.
tests/networkxml2xmlin/isolated-network.xml
tests/networkxml2xmlin/routed-network.xml
tests/networkxml2xmlout/isolated-network.xml
tests/networkxml2xmlout/routed-network.xml: add mac address to some tests
2011-02-09 08:28:12 +00:00
|
|
|
<mac address='00:16:3E:5D:C7:9E'/>
|
2011-06-24 10:04:36 +00:00
|
|
|
<dns>
|
|
|
|
<txt name="example" value="example value" />
|
|
|
|
</dns>
|
2009-11-06 15:04:19 +00:00
|
|
|
<ip address="192.168.122.1" netmask="255.255.255.0">
|
|
|
|
<dhcp>
|
|
|
|
<range start="192.168.122.100" end="192.168.122.254" />
|
|
|
|
<host mac="00:16:3e:77:e2:ed" name="foo.example.com" ip="192.168.122.10" />
|
|
|
|
<host mac="00:16:3e:3e:a9:1a" name="bar.example.com" ip="192.168.122.11" />
|
|
|
|
</dhcp>
|
|
|
|
</ip>
|
2011-04-07 14:50:43 +00:00
|
|
|
<ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" />
|
2008-04-29 14:08:08 +00:00
|
|
|
</network></pre>
|
|
|
|
|
|
|
|
<dl>
|
Give each virtual network bridge its own fixed MAC address
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463
The problem was that, since a bridge always acquires the MAC address
of the connected interface with the numerically lowest MAC, as guests
are started and stopped, it was possible for the MAC address to change
over time, and this change in the network was being detected by
Windows 7 (it sees the MAC of the default route change), so on each
reboot it would bring up a dialog box asking about this "new network".
The solution is to create a dummy tap interface with a MAC guaranteed
to be lower than any guest interface's MAC, and attach that tap to the
bridge as soon as it's created. Since all guest MAC addresses start
with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
0" prefix, and it's guaranteed to always win (physical interfaces are
never connected to these bridges, so we don't need to worry about
competing numerically with them).
Note that the dummy tap is never set to IFF_UP state - that's not
necessary in order for the bridge to take its MAC, and not setting it
to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
in the output of the ifconfig command.
I chose to not auto-generate the MAC address in the network XML
parser, as there are likely to be consumers of that API that don't
need or want to have a MAC address associated with the
bridge.
Instead, in bridge_driver.c when the network is being defined, if
there is no MAC, one is generated. To account for virtual network
configs that already exist when upgrading from an older version of
libvirt, I've added a %post script to the specfile that searches for
all network definitions in both the config directory
(/etc/libvirt/qemu/networks) and the state directory
(/var/lib/libvirt/network) that are missing a mac address, generates a
random address, and adds it to the config (and a matching address to
the state file, if there is one).
docs/formatnetwork.html.in: document <mac address.../>
docs/schemas/network.rng: add nac address to schema
libvirt.spec.in: %post script to update existing networks
src/conf/network_conf.[ch]: parse and format <mac address.../>
src/libvirt_private.syms: export a couple private symbols we need
src/network/bridge_driver.c:
auto-generate mac address when needed,
create dummy interface if mac address is present.
tests/networkxml2xmlin/isolated-network.xml
tests/networkxml2xmlin/routed-network.xml
tests/networkxml2xmlout/isolated-network.xml
tests/networkxml2xmlout/routed-network.xml: add mac address to some tests
2011-02-09 08:28:12 +00:00
|
|
|
<dt><code>mac</code></dt>
|
|
|
|
<dd>The <code>address</code> attribute defines a MAC
|
|
|
|
(hardware) address formatted as 6 groups of 2-digit
|
|
|
|
hexadecimal numbers, the groups separated by colons
|
|
|
|
(eg, <code>"52:54:00:1C:DA:2F"</code>). This MAC address is
|
|
|
|
assigned to the bridge device when it is created. Generally
|
|
|
|
it is best to not specify a MAC address when creating a
|
|
|
|
network - in this case, if a defined MAC address is needed for
|
|
|
|
proper operation, libvirt will automatically generate a random
|
|
|
|
MAC address and save it in the config. Allowing libvirt to
|
|
|
|
generate the MAC address will assure that it is compatible
|
|
|
|
with the idiosyncrasies of the platform where libvirt is
|
|
|
|
running. <span class="since">Since 0.8.8</span>
|
|
|
|
</dd>
|
2011-06-24 10:04:36 +00:00
|
|
|
<dt><code>dns</code></dt><dd>
|
|
|
|
The dns element of a network contains configuration information for the
|
|
|
|
virtual network's DNS server. <span class="since">Since 0.9.3</span>
|
|
|
|
Currently supported elements are:
|
|
|
|
<dl>
|
|
|
|
<dt><code>txt</code></dt>
|
|
|
|
<dd>A <code>dns</code> element can have 0 or more <code>txt</code> elements.
|
|
|
|
Each txt element defines a DNS TXT record and has two attributes, both
|
|
|
|
required: a name that can be queried via dns, and a value that will be
|
|
|
|
returned when that name is queried. names cannot contain embedded spaces
|
|
|
|
or commas. value is a single string that can contain multiple values
|
|
|
|
separated by commas. <span class="since">Since 0.9.3</span>
|
|
|
|
</dd>
|
2011-06-24 10:04:40 +00:00
|
|
|
<dt><code>host</code></dt>
|
|
|
|
<dd>The <code>host</code> element within <code>dns</code> is the
|
|
|
|
definition of DNS hosts to be passed to the DNS service. The IP
|
|
|
|
address is identified by the <code>ip</code> attribute and the names
|
|
|
|
for that IP address are identified in the <code>hostname</code>
|
|
|
|
sub-elements of the <code>host</code> element.
|
|
|
|
<span class="since">Since 0.9.3</span>
|
|
|
|
</dd>
|
2011-06-24 10:04:36 +00:00
|
|
|
</dl>
|
|
|
|
</dd>
|
2011-06-24 21:48:55 +00:00
|
|
|
<dt><code>ip</code></dt>
|
|
|
|
<dd>The <code>address</code> attribute defines an IPv4 address in
|
|
|
|
dotted-decimal format, or an IPv6 address in standard
|
|
|
|
colon-separated hexadecimal format, that will be configured on
|
|
|
|
the bridge
|
|
|
|
device associated with the virtual network. To the guests this
|
|
|
|
address will be their default route. For IPv4 addresses, the <code>netmask</code>
|
|
|
|
attribute defines the significant bits of the network address,
|
|
|
|
again specified in dotted-decimal format. For IPv6 addresses,
|
|
|
|
and as an alternate method for IPv4 addresses, you can specify
|
|
|
|
the significant bits of the network address with the <code>prefix</code>
|
|
|
|
attribute, which is an integer (for example, <code>netmask='255.255.255.0'</code>
|
|
|
|
could also be given as <code>prefix='24'</code>. The <code>family</code>
|
|
|
|
attribute is used to specify the type of address - 'ipv4' or 'ipv6'; if no
|
|
|
|
<code>family</code> is given, 'ipv4' is assumed. A network can have more than
|
|
|
|
one of each family of address defined, but only a single address can have a
|
|
|
|
<code>dhcp</code> or <code>tftp</code> element. <span class="since">Since 0.3.0;
|
|
|
|
IPv6, multiple addresses on a single network, <code>family</code>, and
|
|
|
|
<code>prefix</code> since 0.8.7</span>
|
|
|
|
<dl>
|
|
|
|
<dt><code>tftp</code></dt>
|
|
|
|
<dd>Immediately within
|
|
|
|
the <code>ip</code> element there is an optional <code>tftp</code>
|
|
|
|
element. The presence of this element and of its attribute
|
|
|
|
<code>root</code> enables TFTP services. The attribute specifies
|
|
|
|
the path to the root directory served via TFTP. <code>tftp</code> is not
|
|
|
|
supported for IPv6 addresses, and can only be specified on a single IPv4 address
|
|
|
|
per network.
|
|
|
|
<span class="since">Since 0.7.1</span>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt><code>dhcp</code></dt>
|
|
|
|
<dd>Also within the <code>ip</code> element there is an
|
|
|
|
optional <code>dhcp</code> element. The presence of this element
|
|
|
|
enables DHCP services on the virtual network. It will further
|
|
|
|
contain one or more <code>range</code> elements. The
|
|
|
|
<code>dhcp</code> element is not supported for IPv6, and
|
|
|
|
is only supported on a single IP address per network for IPv4.
|
|
|
|
<span class="since">Since 0.3.0</span>
|
|
|
|
<dl>
|
|
|
|
<dt><code>range</code></dt>
|
|
|
|
<dd>The <code>start</code> and <code>end</code> attributes on the
|
|
|
|
<code>range</code> element specify the boundaries of a pool of
|
|
|
|
IPv4 addresses to be provided to DHCP clients. These two addresses
|
|
|
|
must lie within the scope of the network defined on the parent
|
|
|
|
<code>ip</code> element. <span class="since">Since 0.3.0</span>
|
|
|
|
</dd>
|
|
|
|
<dt><code>host</code></dt>
|
|
|
|
<dd>Within the <code>dhcp</code> element there may be zero or more
|
|
|
|
<code>host</code> elements; these specify hosts which will be given
|
|
|
|
names and predefined IP addresses by the built-in DHCP server. Any
|
|
|
|
such element must specify the MAC address of the host to be assigned
|
|
|
|
a given name (via the <code>mac</code> attribute), the IP to be
|
|
|
|
assigned to that host (via the <code>ip</code> attribute), and the
|
|
|
|
name to be given that host by the DHCP server (via the
|
|
|
|
<code>name</code> attribute). <span class="since">Since 0.4.5</span>
|
|
|
|
</dd>
|
|
|
|
<dt><code>bootp</code></dt>
|
|
|
|
<dd>The optional <code>bootp</code>
|
|
|
|
element specifies BOOTP options to be provided by the DHCP server.
|
|
|
|
Two attributes are supported: <code>file</code> is mandatory and
|
|
|
|
gives the file to be used for the boot image; <code>server</code> is
|
|
|
|
optional and gives the address of the TFTP server from which the boot
|
|
|
|
image will be fetched. <code>server</code> defaults to the same host
|
|
|
|
that runs the DHCP server, as is the case when the <code>tftp</code>
|
|
|
|
element is used. The BOOTP options currently have to be the same
|
|
|
|
for all address ranges and statically assigned addresses.<span
|
|
|
|
class="since">Since 0.7.1 (<code>server</code> since 0.7.3).</span>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
2009-10-28 14:57:49 +00:00
|
|
|
</dd>
|
2008-04-29 14:08:08 +00:00
|
|
|
</dl>
|
2008-04-23 17:08:31 +00:00
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h2><a name="examples">Example configuration</a></h2>
|
2008-04-23 17:08:31 +00:00
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h3><a name="examplesNAT">NAT based network</a></h3>
|
2008-04-23 17:08:31 +00:00
|
|
|
|
2008-04-29 14:08:08 +00:00
|
|
|
<p>
|
|
|
|
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.
|
|
|
|
</p>
|
|
|
|
|
2008-04-23 17:08:31 +00:00
|
|
|
<pre>
|
|
|
|
<network>
|
2009-11-06 15:04:19 +00:00
|
|
|
<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>
|
2011-04-07 14:50:43 +00:00
|
|
|
<ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" />
|
2008-04-23 17:08:31 +00:00
|
|
|
</network></pre>
|
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h3><a name="examplesRoute">Routed network config</a></h3>
|
2008-04-23 17:08:31 +00:00
|
|
|
|
2008-04-29 14:08:08 +00:00
|
|
|
<p>
|
|
|
|
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
|
|
|
|
<code>eth1</code> host network device.
|
|
|
|
</p>
|
|
|
|
|
2008-04-23 17:08:31 +00:00
|
|
|
<pre>
|
|
|
|
<network>
|
2009-11-06 15:04:19 +00:00
|
|
|
<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>
|
2011-04-07 14:50:43 +00:00
|
|
|
<ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" />
|
2008-04-23 17:08:31 +00:00
|
|
|
</network></pre>
|
|
|
|
|
2008-05-06 23:23:55 +00:00
|
|
|
<h3><a name="examplesPrivate">Isolated network config</a></h3>
|
2008-04-23 17:08:31 +00:00
|
|
|
|
2008-04-29 14:08:08 +00:00
|
|
|
<p>
|
|
|
|
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 <code>forward</code> element in the XML
|
|
|
|
description.
|
|
|
|
</p>
|
|
|
|
|
2008-04-23 17:08:31 +00:00
|
|
|
<pre>
|
|
|
|
<network>
|
2009-11-06 15:04:19 +00:00
|
|
|
<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>
|
2011-04-07 14:50:43 +00:00
|
|
|
<ip family="ipv6" address="2001:8794:ca2:3::1" prefix="64" />
|
2008-04-23 17:08:31 +00:00
|
|
|
</network></pre>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|