# assign dhcp-IP to server-local interface with dnsmasq

## rer

Short question: Is it possible for a local-running dnsmasq-server to assign a dhcp-IP-address to a local-interface on the same machine? Thought it is a simple thing but obviously it is not. And if not with dnsmasq, is it possible with an other dhcp-server?

----------

## kimmie

That makes no sense unless the interface is virtual. You need a network to talk DHCP. What are you trying to do?

----------

## rer

I disagree, It makes very much sense. Every distro has its own heterogenous net-conf-file, /etc/conf.d/net in gentoo, /etc/network/interfaces in debian and even multiple places in arch. I want to overcome all that design-crap, and have only one central, homogenous, unified file in all distros where I maintain my addresses /etc/dnsmasq.conf, I could even replicate that file over all my machines. And I have already a network, at least if-lo. I know, its a little bit a chicken/egg-problem and I don't know the dhcp-protocol in detail, but if thats not possible, its a massive design-flaw in DHCP

My machines work sometimes as a server, sometimes as a client. I could forget about all the rubbish with different profiles or something like that, simply set up all my netinterfaces with DHCP in a unified way, no matter if I'm connected to my local or a public network, never again static addresses, or if they are needed for some reason, as mac/ip-tuples in dnsmasq.conf

----------

## kimmie

Your goal of consolidating configuration makes some sense, and so does your frustration with having to use different profiles etc.

But allowing a DHCP server to get its own address from itself because you happen to want to put a piece of information in a particular file doesn't make any sense at all. A DHCP server leases out IP addresses to clients on a particular subnet. Allowing it to lease its own address from itself would be like... I don't know, lending money to yourself. The massive flaw is in your thinking, not in the DHCP protocol. Trying to put all your network configuration in dnsmasq.conf is impossible. It's not a unified network configuration bucket.

How would distributing dnsmasq.conf files be any better than distributing /etc/hosts files? Why does it really matter that the config is in more than one file? An extreme example of this is the windows registry. Sure, it's in one file.  What's inside that file? A hierarchical filesystem, which you need special tools to access, rather than the normal filesystem ones. What's really been achieved? Nothing at all.

If you want to automate your network config further, look into zeroconf, ifplugd and multiple runlevels. Most of the time, it doesn't make sense to be using a multi-function machine as a DHCP server, you're better off using the one in your router/DSL modem or wireless access point.

----------

