Virsh net-edit: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 3: Line 3:
* [[virsh#Commands|virsh]]
* [[virsh#Commands|virsh]]
* [[KVM_Virtual_Networking_Concepts#The_DNS_and_DHCP_Server|Virtual Network Concepts]]
* [[KVM_Virtual_Networking_Concepts#The_DNS_and_DHCP_Server|Virtual Network Concepts]]
* [[Linux_Virtualization_Operations#Virtualization_Host_Network_Operations|Linux Virtualization Operations]]
* [[virsh net-update]]


=Overview=
=Overview=
Line 8: Line 10:
Used to edit the configuration of the specified [[KVM_Virtual_Networking_Concepts#Virtual_Network|virtual network]].
Used to edit the configuration of the specified [[KVM_Virtual_Networking_Concepts#Virtual_Network|virtual network]].


<pre>
virsh net-edit <virtual-network-name>
</pre>
The command brings the specified network configuration in the default editor, allowing it to be edited:
<pre>
<network>
<network>
   <name>default</name>
   <name>default</name>
Line 20: Line 29:
   </ip>
   </ip>
</network>
</network>
</pre>
Configuration changes applied with virsh net-edit modify the following:
* [[KVM_Virtual_Networking_Concepts#The_DNS_and_DHCP_Server|DNS and DHCP server's (dnsmasq)]] configuration file  /var/lib/libvirt/dnsmasq/default.conf.
Changes applied with virsh net-edit won't take effect until the network is destroyed and re-started, which will cause a all guests to lose network connectivity with the host until their network interfaces are explicitly re-attached. If we need to avoid losing connectivity, changes may also be applied with [[virsh net-update]].
=Operations=
==Modify DHCP Range==
Execute


<pre>
<pre>
Line 25: Line 46:
</pre>
</pre>


Configuration changes applied with virsh net-edit modify [[KVM_Virtual_Networking_Concepts#The_DNS_and_DHCP_Server|DNS and DHCP server's (dnsmasq)]] configuration file  /var/lib/libvirt/dnsmasq/default.conf.
and modify the following section:
 
<pre>
...
<dhcp>
    <range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
...
</pre>


=Operations=
Upon save, libvirt will update [[KVM_Virtual_Networking_Concepts#The_DNS_and_DHCP_Server|DNS and DHCP server's (dnsmasq)]] configuration file  /var/lib/libvirt/dnsmasq/default.conf.

Latest revision as of 06:02, 19 April 2018

Internal

Overview

Used to edit the configuration of the specified virtual network.

virsh net-edit <virtual-network-name>

The command brings the specified network configuration in the default editor, allowing it to be edited:

<network>
  <name>default</name>
  <uuid>49a07631-ea20-4741-89ea-b0faa7b42d19</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:15:ef:87'/>
  <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>

Configuration changes applied with virsh net-edit modify the following:

Changes applied with virsh net-edit won't take effect until the network is destroyed and re-started, which will cause a all guests to lose network connectivity with the host until their network interfaces are explicitly re-attached. If we need to avoid losing connectivity, changes may also be applied with virsh net-update.

Operations

Modify DHCP Range

Execute

virsh net-edit <virtual-network-name>

and modify the following section:

...
<dhcp>
    <range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
...

Upon save, libvirt will update DNS and DHCP server's (dnsmasq) configuration file /var/lib/libvirt/dnsmasq/default.conf.