Is it possible to configure network interface via the DHCP server hosted on the same machine?

Currently, I have next records in my /etc/network/interfaces:

auto enp0s8
iface enp0s8 inet dhcp

Also, dnsmasq listening to enp0s8.

But I can't achieve the desired effect that way. (OS: Ubuntu server 16)


I'm configuring a virtual network for educational purposes. So, it is just an interest: how to touch as less files as possible while configuration? And is it possible to make dnsmasq to handle that case?

My topology:

I have a central node with the dnsmasq and some other nodes in the same network. Central node has two interfaces:

  • enp03 which faces the host network. It configured by host network DHCP and has a dynamic IP address.
  • enp08 which faces the virtual network. dnsmasq is listening this interfase.

Now, if have the next central node configuration:


auto lo
iface lo inet loopback

auto enp03 
iface enp03 inet auto

auto enp08
iface enp08 inet static



The problem starts if I make a mistake and assign some static IP for enp0s8 out of the dhcp-range. So now I have to maintain the consistency between /etc/network/interfaces and /etc/dnsmasq.conf

  • 1
    The way I understand the question, which doesn't make sense to me, is that you're trying to setup a router that would use a dynamic IP address. If that's the case, you should explain why you need to do something like that, hoping that we can offer a better approach. – Julie Pelletier Jan 21 '17 at 1:54
  • 1
    @JuliePelletier The question can be interpreted to make sense, because the DHCP server can serve a fixed IP to, erm, the host itself when it tries to get one. It is possible that it can't be made to work because a broadcast packet might not sent back to the port it came in on by an Ethernet switch (i.e., does the sending host of a broadcast packet ever see it incoming?). I don't really know the details. – DepressedDaniel Jan 21 '17 at 4:32
  • @DepressedDaniel: I was pushing to get details but OP doesn't seem available to provide them. – Julie Pelletier Jan 21 '17 at 7:10
  • The question updatet. – Silk0vsky Jan 21 '17 at 11:24
  • 1
    As far as I know it is not possible that the host which the DHCP server is running on can get an IP address from that DHCP server, to assign a IP address to itself. If you are worried about assigning static IP addresses to your DHCP range, shorten your DHCP range to, and you can use the first 10 IP addresses for static assignments. – Thomas Jan 21 '17 at 11:56

Your Answer

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

Browse other questions tagged or ask your own question.