Assign static IPs to KVM VPS in Proxmox using DHCP

The title said it all. Using this method on Online.net LT DEALS 1701.3.

Install isc-dhcp-server:

apt install isc-dhcp-server


Edit /etc/default/isc-dhcp-server . It should like:

# The default bridge is vmbr0.
INTERFACES="vmbr0"


Modify /etc/dhcp/dhcpd.conf . Example:

subnet 0.0.0.0 netmask 0.0.0.0 {
authoritative;
default-lease-time 21600000;
max-lease-time 432000000;
}

# Bind IP by MAC
host VM1 {

# MAC Address
hardware ethernet 52:54:xx:xx:xx:x1;

# Gateway
option routers 62.xxx.xxx.1;

# Subnet
option subnet-mask 255.255.255.255;

# Failover IP
fixed-address xxx.xxx.xxx.114;

# DNS server
option domain-name-servers 8.8.8.8,8.8.4.4;

}


Starting the dhcp server on boot:

systemctl enable isc-dhcp-server


Reboot the node server.

When creating the VM we just need to specify the MAC address for specific IP and leave the network config using DHCP.

Top News