Dhcp issues

Windows vps are provided network using dhcp service on server.
For that, dhcp service needs to be installed and active on server.
If its not installed then you can install it on your server :

yum install dhcp (CentOS 7)
yum install dhcp-server (CentOS 8)

apt-get install isc-dhcp-server (Proxmox and Ubuntu servers)
If it asks to over-write existing dhcpd.conf then use N to not to over-write existing dhcp config.

Once its installed you can start it , assuming file : /etc/dhcp/dhcpd.conf is having entries similar to the following :

host vmvVPS-VID {
hardware ethernet VPS/IP-MAC;
option routers Ip-Pool-Gateway;
option subnet-mask IP-Pool-Netmask;
fixed-address VPS-IP;
option domain-name-servers IP-Pool-Namservers;
}

If the above mentioned file does holds the entries then you can create a test vps and then wait for that file to update or if a vps is already created and no entries update in that file or that file does not exists then you can create a symlink of another dhcpd.conf file :

rm -f /etc/dhcp/dhcpd.conf (assuming /etc/dhcpd.conf is already created with proper entries and /etc/dhcp/dhcpd.conf does not holds your custom config)

ln -s /etc/dhcpd.conf /etc/dhcp/dhcpd.conf

Then you can proceed to start dhcp service on your server :

systemctl start dhcpd.service (CentOS 7+)

//To enable the service on boot
systemctl enable dhcpd.service (CentOS 7+)

systemctl start isc-dhcp-server.service (Proxmox and Ubuntu servers)

//To enable the service on boot
systemctl enable isc-dhcp-server.service (Proxmox and Ubuntu servers)

If its failing to start then you can view logs using :

journalctl -xe

If you notice any error messages in logs related to interface name not defined then you can update bridge interface name in /etc/sysconfig/dhcpd (CentOS) or in /etc/default/isc-dhcp-server file.
You can find bridge interface name in brctl show command output.
You can add bridge names separated by spaces in respective file.

DHCPDARGS="viifbr0" (CentOS 7+ servers)

INTERFACESv4="vmbr0" (Proxmox and Ubuntu servers)

If it shows up some other error in logs related to existing dhcp process or its pid then you can try stop/kill existing dhcp process and remove pid file and then start dhcp service again :

killall dhcpd

rm -rf /var/run/dhcpd.pid

Windows/Custom Vps Network issue

Once dhcp service is started on server but Windows vps (created from ISO or custom template) or a vps created using ISO and its network is set to dhcp in its OS , fails to receive network then you will need see if it has Virtio network drivers installed or not.

If Windows vps (in VNC) shows the above x mark for its network adapter then you will need to install Virtio NIC drivers. (assuming network interface for that vps on manage vps is set to Virtio)
You can download the Virtio ISO from here :

https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/#virtio-win-direct-downloads

And then attach the ISO as secondary ISO to the vps and stop and start it from panel.

To install the drivers, you will need to visit device manager and locate network adapter and right click on it and browse for the ISO path and choose NetKVM and choose required Windows version folder and and the arch version.
Once Virtio driver is installed, your network adapter should work fine and also receive network via dhcp from that server.

If the driver installation is not working for you then you can choose Intel e1000 as Network Interface type for vps from manage vps page and then stop and start vps and see if vps receives network.

You can also restart dhcp service and also reset network adapter if vps fails to receive IP lease, simultaneously checking dhcp status where you could view logs of assignment.

systemctl status dhcpd.service -l (CentOS 7 servers)

systemctl status isc-dhcp-server.service service -l (Proxmox and Ubuntu servers)

Note : Dhcp requires that the bridge interface on server to have an IP assigned (even a dummy IP is fine) else it would fail to provide IP lease.

Was this helpful to you?