[Dnsmasq-discuss] Give ip for client only if mac and hostname are specific one

Simon Kelley simon at thekelleys.org.uk
Wed Oct 30 12:18:25 GMT 2013


On 28/10/13 15:21, Beat Meier wrote:
> Simone
>
> Thanks a lot! This works nice but I have an other problem.
> I want to give this special host a specific ip with this BUT other hosts
> should receive the "normal way".
>
> If I use:
>
> dhcp-match=set:hostname-ok,12,<myname>
> dhcp-mac=set:mac-ok,<mymac>
> dhcp-range=tag:hostname-ok,tag:mac-ok,10.0.0.220,10.0.0.220
>
> dhcp-authoritative
> dhcp-range=10.0.0.106,10.0.0.106,255.255.255.0,12h
> dhcp-leasefile=/tmp/dhcp.leases
>
> My host will receive 10.0.0.106 even mac and hostname are ok
> If I remove the 10.0.0.106 range it my host receives 10.0.0.220.
> How can I use "2 ranges"?


You have to use tag-if to calculate a tag which is set if the mac and 
hostname are OK, and configure the "normal" range to be valid only when 
that tag is not set

tag-if=set:all-ok,tag:hostname-ok,tag:mac-ok

dhcp-range=tag:!all-ok,10.0.0.106,10.0.0.106,255.255.255.0,12h

Cheers,

Simon.

> I have fixed macs using /etc/ethers, dynamic for all hosts not known expect
> the special host I want to have other ip which will have no access...
>
> Is there any way to do that?
> I cannot divide range by interface if it's the same :-(
>
> Greetings and thanks for the nice work
>
> Beat
>
> On 10/18/2013 10:38 AM, Simon Kelley wrote:
>> On 18/10/13 14:27, Beat Meier wrote:
>>> Hi Simon
>>>
>>> Exactly!
>>> I need and mac&&   hostname to give this ip.
>>> How is this possible?
>>
>> OK, this is ugly, and I've not tested it, but it should work.
>>
>> First, set a tag if the hostname is correct
>>
>> dhcp-match=set:hostname-ok,12,<hostname-to-select>
>>
>> then, set a tag if the MAC is correct
>>
>> dhcp-mac=set:mac-ok,00:11:22:33:44:55:66
>>
>>
>> finally, set a tag if _both_ match
>>
>> tag-if=set:all-ok,tag:hostname-ok,tag:mac-ok
>>
>> Finally, make a dhcp range with one address that's only used when
>> all-ok is set
>>
>> dhcp-range=tag:all-ok,192.168.1.99,192.168.1.99
>>
>>
>> I'd be very interested to know if that works!
>>
>>
>> Cheers,
>>
>> Simon.
>>
>>
>>
>>
>>>
>>> Thanks!!
>>>
>>> On 10/18/2013 10:22 AM, Simon Kelley wrote:
>>>> On 18/10/13 14:18, Beat Meier wrote:
>>>>> Hello
>>>>>
>>>>> I wanto to give a client a specifi ip only if the mac and the
>>>>> "hostid or
>>>>> hostname" which is logged
>>>>> in dhcp.leases is a speficic one, else give and other ip.
>>>>> Is this possible with dnsmasq and someting like remoteid?
>>>>> Any help
>>>>>
>>>>> Thanks
>>>>>
>>>>> Beat
>>>>>
>>>>
>>>>
>>>> Assigning a specific IP address if a host has a specific hostname or
>>>> MAC address is trivial. Doing only if BOTH the mac address and
>>>> hostname match is more difficult, but should be possible. Is that what
>>>> you need?
>>>>
>>>>
>>>> Simon.
>>>>
>>>> _______________________________________________
>>>> Dnsmasq-discuss mailing list
>>>> Dnsmasq-discuss at lists.thekelleys.org.uk
>>>> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>>>>
>>>
>>>
>>
>>
>
>




More information about the Dnsmasq-discuss mailing list