DHCP Server for Guests - yi-hsuan/Proxmox GitHub Wiki
Create in Proxmox VE Web UI or modify /etc/network/interfaces.
auto vmbr197
iface vmbr197 inet static
address 192.168.197.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
- Replace vmbr197 with the name which you want to use in your Proxmox VE Server.
- Replace 192.168.97.1/24 with the subnet which you want to use for the guests.
- Use
ifup -a
to apply the change of network configuration.
Install isc-dhcp-server
apt install isc-dhcp-server
Update DHCP Server Configuration
Update INTERFACESv4 with nano /etc/default/isc-dhcp-server
.
INTERFACESv4="vmbr197"
INTERFACESv6=""
Replace vmbr197 with the name of Linux Bridge in your Proxmox VE.
Make a backup of /etc/dhcp/dhcpd.conf.
cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bkp
Edit /etc/dhcp/dhcpd.conf with nano /etc/dhcp/dhcpd.conf
.
Below is an example of dhcpd.conf.
subnet 192.168.197.0 netmask 255.255.255.0 {
range 192.168.197.101 192.168.197.200;
option routers 192.168.197.1;
option domain-name-servers 8.8.8.8, 4.4.4.4;
authoritative;
default-lease-time 21600000;
max-lease-time 432000000;
}
Restart the DHCP service with systemctl restart isc-dhcp-server.service
.
Check the status of DHCP service with systemctl status isc-dhcp-server.service
.
You should see the service is running.
● isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
Active: active (running) since Tue 2022-07-05 09:00:29 UTC; 14s ago
Docs: man:systemd-sysv-generator(8)
Process: 914128 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=0/SUCCESS)
Tasks: 4 (limit: 76945)
Memory: 5.0M
CPU: 28ms
CGroup: /system.slice/isc-dhcp-server.service
└─914143 /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf vmbr197
Jul 05 09:00:26 pve-cloud systemd[1]: Starting LSB: DHCP server...
Jul 05 09:00:26 pve-cloud isc-dhcp-server[914128]: Launching IPv4 server only.
Jul 05 09:00:26 pve-cloud dhcpd[914143]: Wrote 0 leases to leases file.
Jul 05 09:00:27 pve-cloud dhcpd[914143]: Server starting service.
Jul 05 09:00:29 pve-cloud isc-dhcp-server[914128]: Starting ISC DHCPv4 server: dhcpd.
Jul 05 09:00:29 pve-cloud systemd[1]: Started LSB: DHCP server.
If the service could not start properly, you could refer to the steps below for debugging.
systemctl status isc-dhcp-server.service
Get the status of DHCP services. Below is an example of the output.
● isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
Active: failed (Result: exit-code) since Mon 2022-07-04 11:25:00 UTC; 16h ago
Docs: man:systemd-sysv-generator(8)
Process: 752846 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
CPU: 16ms
Jul 04 11:24:58 pve-cloud dhcpd[752861]: before submitting a bug. These pages explain the proper
Jul 04 11:24:58 pve-cloud dhcpd[752861]: process and the information we find helpful for debugging.
Jul 04 11:24:58 pve-cloud dhcpd[752861]:
Jul 04 11:24:58 pve-cloud dhcpd[752861]: exiting.
Jul 04 11:25:00 pve-cloud isc-dhcp-server[752846]: Starting ISC DHCPv4 server: dhcpdcheck syslog for dia>
Jul 04 11:25:00 pve-cloud isc-dhcp-server[752868]: failed!
Jul 04 11:25:00 pve-cloud isc-dhcp-server[752869]: failed!
Jul 04 11:25:00 pve-cloud systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, stat>
Jul 04 11:25:00 pve-cloud systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jul 04 11:25:00 pve-cloud systemd[1]: Failed to start LSB: DHCP server.
Get the PID of dhcpd from the output. The PID of dhcpd above is 752861.
You could use journalctl _PID=752861
to get detailed information. (Replace 752561 with the PID in your output)
You could get the detailed information below.
-- Journal begins at Thu 2022-06-30 03:57:44 UTC, ends at Tue 2022-07-05 04:01:53 UTC. --
Jul 04 11:24:58 pve-cloud dhcpd[752861]: Wrote 0 leases to leases file.
Jul 04 11:24:58 pve-cloud dhcpd[752861]:
Jul 04 11:24:58 pve-cloud dhcpd[752861]: No subnet declaration for vmbr197 (192.168.197.1).
Jul 04 11:24:58 pve-cloud dhcpd[752861]: ** Ignoring requests on vmbr197. If this is not what
Jul 04 11:24:58 pve-cloud dhcpd[752861]: you want, please write a subnet declaration
Jul 04 11:24:58 pve-cloud dhcpd[752861]: in your dhcpd.conf file for the network segment
Jul 04 11:24:58 pve-cloud dhcpd[752861]: to which interface vmbr197 is attached. **
Jul 04 11:24:58 pve-cloud dhcpd[752861]:
Jul 04 11:24:58 pve-cloud dhcpd[752861]:
Jul 04 11:24:58 pve-cloud dhcpd[752861]: Not configured to listen on any interfaces!
Jul 04 11:24:58 pve-cloud dhcpd[752861]:
Jul 04 11:24:58 pve-cloud dhcpd[752861]: If you think you have received this message due to a bug rather
Jul 04 11:24:58 pve-cloud dhcpd[752861]: than a configuration issue please read the section on submitting
Jul 04 11:24:58 pve-cloud dhcpd[752861]: bugs on either our web page at www.isc.org or in the README file
Jul 04 11:24:58 pve-cloud dhcpd[752861]: before submitting a bug. These pages explain the proper
Jul 04 11:24:58 pve-cloud dhcpd[752861]: process and the information we find helpful for debugging.
Jul 04 11:24:58 pve-cloud dhcpd[752861]:
Jul 04 11:24:58 pve-cloud dhcpd[752861]: exiting.