Skip to content

Commit 41657da

Browse files
committed
README: documentation for the dhcp_release workaround
1 parent d0c20c8 commit 41657da

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ If you require DNS resolution from your VMs to return correct FQDNs, add the
6060

6161
By default, virter uses the libvirt network named `default`.
6262

63+
### DHCP Leases
64+
65+
Libvirt produces some weird behavior when MAC or IP addresses are reused while
66+
there is still an active DHCP lease for them. This can result in a new VM
67+
getting assigned a random IP instead of the IP corresponding to its ID.
68+
69+
To work around this, virter tries to execute the `dhcp_release` utility in
70+
order to release the DHCP lease from libvirt's DHCP server when a VM is
71+
removed. This utility has to be run by the root user, so virter executes
72+
it using `sudo`.
73+
74+
If execution fails (for example because the utility is not installed or the
75+
sudo rules are not set up correctly), the error is ignored by virter.
76+
77+
So, to make virter work more reliably, especially when you are running lots
78+
of VMs in a short amount of time, you should install the `dhcp_release` utility
79+
(usually packaged as `dnsmasq-utils`). Additionally, you should make sure that
80+
your user can run `dhcp_release` as root, for example by using a sudo rule like
81+
this:
82+
83+
```
84+
%libvirt ALL=(ALL) NOPASSWD: /usr/bin/dhcp_release
85+
```
86+
87+
This allows all users in the group libvirt to run the `dhcp_release` utility
88+
without being prompted for a password.
89+
6390
## Usage
6491

6592
For usage just run `virter help`.

0 commit comments

Comments
 (0)