[Dnsmasq-discuss] Assign IP range by hostname with wildcard

Simon Kelley simon at thekelleys.org.uk
Wed Sep 5 15:45:12 BST 2012


On 04/09/12 09:51, Christian Zenker wrote:
> Hi.
> 
> First of all: I have less than one day of experience with DHCP, so please forgive me if my terminology is a bit off or I do some terrible beginners mistake.
> I'm trying to set up DHCP for our small company. This far everything worked really smoothly (thanks to dnsmasq), but I'm struggling with some minor issue:
> 
> I want to separate the dhcp ranges from the workstations from any other machines. As the workstations have a hostname naming scheme like "foobar-1", "foobar-2", etc. I thought it would be nice to work with wildcards, like:
> 
> dhcp-host=set:baz,foobar-*
> dhcp-range=tag:baz,192.168.1.1,192.168.1.42,infinite
> dhcp-range=tag:!baz,192.168.1.43,192.168.1.254,12h
> 
> But this is not a valid syntax. The extensive way
> 
> dhcp-host=set:baz,foobar-1
> dhcp-host=set:baz,foobar-2
> # [...]
> 
> works, but is not really nice and hard to maintain. Is there any way to use some kind of wildcard to keep the configuration short?
> 
> Christian Zenker.
> 

Where are the workstation names set? If they are locally to the
workstations, (rather than being set by DHCP) then the machines will be
sending their hostnames in DHCP requests. If so you should be able to
use dhcp-match to look at the hostname options.

dhcp-match=set:baz, option:domain-name, foobar-

It's not an ideal solution, but it might work for you.


Simon.






More information about the Dnsmasq-discuss mailing list