0

I am trying to configure a DHCP server on a Ubuntu 18.04 virtual machine. I am able to configure it with the following configuration:

File: /etc/dhcp/dhcpd.conf

Settings:

default-lease-time 600;

max-lease-time 7200;

option subnet-mask 255.255.255.0;

option broadcast-address 192.168.1.255;

option routers 192.168.1.254;

option domain-name-servers 192.168.1.1, 192.168.1.2;

option domain-name "mydomain.example";

subnet 192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.10 192.168.1.100;

range 192.168.1.150 192.168.1.200;

} 

When I run

sudo systemctl restart isc-dhcp-server

and then

sudo systemctl status isc-dhcp-server.service

I see that the dhcp server is active and running, but it is not giving out IPs to the other virtual machines on the local network.

The dhcp server is setup to eth1:

File: /etc/default/isc-dhcp-server

Settings:

INTERFACESv4="eth1"

INTERFACESv6=""

I already setup the eth0 and eth1 with netplan as follow:

network:

  version: 2

  renderer: networkd

  ethernets:

    eth0:

      dhcp4: true

      dhcp6: no

    eth1:

      dhcp4: no

      addresses: [192.168.2.1/24]

      gateway4: 192.168.2.1

      nameservers:

        addresses: [8.8.8.8]

eth0 is setup to 192.168.1.15 which is connecting to an external network.

Any suggestion is welcome.

Thank you,

0
  addresses: [192.168.2.1/24]
  gateway4: 192.168.2.1

This is incorrect, you should not be configuring your host address as your own gateway. You should drop the gateway4 setting.

Also, you have configured dhcpd to hand out IPs on a subnet which is not the subnet configured on your interface (192.168.1.0/24 vs. 192.168.2.0/24). You will want to configure your dhcp server to hand out IPs that are actually on the network you have configured.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.