1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
This file is autogenerated from formatnetwork.html.in
Do not edit this file. Changes will be lost.
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="SHORTCUT ICON" href="32favicon.png" />
<title>libvirt: Network XML format</title>
<meta name="description" content="libvirt, virtualization, virtualization API" />
</head>
<body>
<div id="header">
<div id="headerLogo"></div>
<div id="headerSearch">
<form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><div>
<input id="query" name="query" type="text" size="12" value="" />
<input id="submit" name="submit" type="submit" value="Search" />
</div></form>
</div>
</div>
<div id="body">
<div id="menu">
<ul class="l0"><li>
<div>
<a title="Front page of the libvirt website" class="inactive" href="index.html">Home</a>
</div>
</li><li>
<div>
<a title="Details of new features and bugs fixed in each release" class="inactive" href="news.html">News</a>
</div>
</li><li>
<div>
<a title="Get the latest source releases, binary builds and get access to the source repository" class="inactive" href="downloads.html">Downloads</a>
</div>
</li><li>
<div>
<a title="Information for users, administrators and developers" class="active" href="docs.html">Documentation</a>
<ul class="l1"><li>
<div>
<a title="Information about deploying and using libvirt" class="inactive" href="deployment.html">Deployment</a>
</div>
</li><li>
<div>
<a title="Overview of the logical subsystems in the libvirt API" class="inactive" href="intro.html">Architecture</a>
</div>
</li><li>
<div>
<a title="Description of the XML formats used in libvirt" class="active" href="format.html">XML format</a>
<ul class="l2"><li>
<div>
<a title="The domain XML format" class="inactive" href="formatdomain.html">Domains</a>
</div>
</li><li>
<div>
<span class="active">Networks</span>
</div>
</li><li>
<div>
<a title="The storage pool and volume XML format" class="inactive" href="formatstorage.html">Storage</a>
</div>
</li><li>
<div>
<a title="The driver capabilities XML format" class="inactive" href="formatcaps.html">Capabilities</a>
</div>
</li><li>
<div>
<a title="The host device XML format" class="inactive" href="formatnode.html">Node Devices</a>
</div>
</li></ul>
</div>
</li><li>
<div>
<a title="Hypervisor specific driver information" class="inactive" href="drivers.html">Drivers</a>
</div>
</li><li>
<div>
<a title="Reference manual for the C public API" class="inactive" href="html/index.html">API reference</a>
</div>
</li><li>
<div>
<a title="Bindings of the libvirt API for other languages" class="inactive" href="bindings.html">Language bindings</a>
</div>
</li></ul>
</div>
</li><li>
<div>
<a title="User contributed content" class="inactive" href="http://wiki.libvirt.org">Wiki</a>
</div>
</li><li>
<div>
<a title="Frequently asked questions" class="inactive" href="FAQ.html">FAQ</a>
</div>
</li><li>
<div>
<a title="How and where to report bugs and request features" class="inactive" href="bugs.html">Bug reports</a>
</div>
</li><li>
<div>
<a title="How to contact the developers via email and IRC" class="inactive" href="contact.html">Contact</a>
</div>
</li><li>
<div>
<a title="Miscellaneous links of interest related to libvirt" class="inactive" href="relatedlinks.html">Related Links</a>
</div>
</li><li>
<div>
<a title="Overview of all content on the website" class="inactive" href="sitemap.html">Sitemap</a>
</div>
</li></ul>
</div>
<div id="content">
<h1>Network XML format</h1>
<ul><li>
<a href="#elements">Element and attribute overview</a>
<ul><li>
<a href="#elementsMetadata">General metadata</a>
</li><li>
<a href="#elementsConnect">Connectivity</a>
</li><li>
<a href="#elementsAddress">Addressing</a>
</li></ul>
</li><li>
<a href="#examples">Example configuration</a>
<ul><li>
<a href="#examplesNAT">NAT based network</a>
</li><li>
<a href="#examplesRoute">Routed network config</a>
</li><li>
<a href="#examplesPrivate">Isolated network config</a>
</li></ul>
</li></ul>
<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>
<h2>
<a name="elements" id="elements">Element and attribute overview</a>
</h2>
<p>
The root element required for all virtual networks is
named <code>network</code> and has no attributes.
The network XML format is available <span class="since">since 0.3.0</span>
</p>
<h3>
<a name="elementsMetadata" id="elementsMetadata">General metadata</a>
</h3>
<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
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><dt><code>uuid</code></dt><dd>The content of the <code>uuid</code> element provides
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></dl>
<h3>
<a name="elementsConnect" id="elementsConnect">Connectivity</a>
</h3>
<p>
The next set of elements control how a virtual network is
provided connectivity to the physical LAN (if at all).
</p>
<pre>
...
<bridge name="virbr0" />
<forward mode="nat" dev="eth0"/>
...</pre>
<dl><dt><code>bridge</code></dt><dd>The <code>name</code> attribute on the <code>bridge</code> element
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.
<span class="since">Since 0.3.0</span>
</dd><dt><code>forward</code></dt><dd>Inclusion of the <code>forward</code> element indicates that
the virtual network is to be connected to the physical LAN. If
no attributes are set, NAT forwarding will be used for connectivity.
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
0.4.2</span></dd></dl>
<h3>
<a name="elementsAddress" id="elementsAddress">Addressing</a>
</h3>
<p>
The final set of elements define the IPv4 address range available,
and optionally enable DHCP sevices.
</p>
<pre>
...
<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>
</network></pre>
<dl><dt><code>ip</code></dt><dd>The <code>address</code> attribute defines an IPv4 address in
dotted-decimal format, that will be configured on the bridge
device associated with the virtual network. To the guests this
address will be their default route. The <code>netmask</code>
attribute defines the significant bits of the network address,
again specified in dotted-decimal format. <span class="since">Since 0.3.0</span>
</dd><dt><code>dhcp</code></dt><dd>Immediately 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.
<span class="since">Since 0.3.0</span>
</dd><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></dl>
<h2>
<a name="examples" id="examples">Example configuration</a>
</h2>
<h3>
<a name="examplesNAT" id="examplesNAT">NAT based network</a>
</h3>
<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>
<pre>
<network>
<name>default</name>
<bridge name="virbr0" />
<forward type="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>
</network></pre>
<h3>
<a name="examplesRoute" id="examplesRoute">Routed network config</a>
</h3>
<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>
<pre>
<network>
<name>local</name>
<bridge name="virbr1" />
<forward type="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>
</network></pre>
<h3>
<a name="examplesPrivate" id="examplesPrivate">Isolated network config</a>
</h3>
<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>
<pre>
<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>
</network></pre>
</div>
</div>
<div id="footer">
<p id="sponsor">
Sponsored by:<br /><a href="http://et.redhat.com/"><img src="et.png" alt="Project sponsored by Red Hat Emerging Technology" /></a></p>
</div>
</body>
</html>
|