New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
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.
Comments
Have tested without MAC address?
Not yet.
For OVH/SYS should have similar setup with this.
Interesting, wondering how the modules garden proxmox module works with vps creation / IP assign, etc...
>
Not all people use OVH/SYS.
But, your tutorial is interesting.
This is what I waiting for
It is painful to setup ip via VNC when internet connection unstable.
Regarding the network it should has similar setup.
Btw how can I set 2 interface here, for example vmbr0 for public ip, and vmbr1 for local IP?
Hi all! I know this is a bit of an older thread but I came across this and had trouble using it with OVH. For anyone else coming here in the future looking to implement something like this with OVH use the following config:
option rfc3442-classless-static-routes code 121 = array of integer 8;
subnet 0.0.0.0 netmask 0.0.0.0 {
default-lease-time 21600000;
max-lease-time 432000000;
option rfc3442-classless-static-routes 32,e,f,g,h,0,0,0,0,0,e,f,g,h;
host VM1 { hardware ethernet xx:xx:xx:xx:xx:xx; fixed-address a.b.c.d; option domain-name-servers 8.8.8.8,8.8.4.4; }
}
xx:xx:xx:xx:xx:xx=the mac address associated with the IP address you want to assign
a.b.c.d=the IP address to be assigned
e,f,g,h=the default gateway IP address e.g. if your default gatway IP is 192.168.10.23 then e=192,f=168,g=10,h=23 (and yes those are commas, not periods)
Do you set one of these for each individual failover IP on OVH?
I.e. host VM1, host VM2, host VM3 and so on?