DHCP: DNSMasq: 2 MAC Addys --> 1 IP Addy.

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
drewp
DD-WRT Novice


Joined: 18 Jun 2011
Posts: 2

PostPosted: Sat Jun 18, 2011 22:57    Post subject: DHCP: DNSMasq: 2 MAC Addys --> 1 IP Addy. Reply with quote
I have a LinkSys WRT160Nv3 and have loaded DD-WRT v24-sp2 (08/07/10) std-nokaid-small firmware onto it.

I setup the Router as follows according to the DNSMasq MAN Pages at http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html



Quote:
As a special case, it is possible to include more than one hardware address. eg: --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2 This allows an IP address to be associated with multiple hardware addresses, and gives dnsmasq permission to abandon a DHCP lease to one of the hardware addresses when another one asks for a lease. Beware that this is a dangerous thing to do, it will only work reliably if only one of the hardware addresses is active at any time and there is no way for dnsmasq to enforce this. It is, for instance, useful to allocate a stable IP address to a laptop which has both wired and wireless interfaces.


As the documentation suggests, I am trying to setup a laptop that has both a wired and wireless connection to obtain the same IP address whether connected wirelessly or via CAT5e and according to the DNSMasq documentation what I’ve done should work. The ‘address=’ line in the DNSMasq section of the GUI Admin Console, should allow me to refer to the laptop by either it’s netbios name [cnd0450dmy] or by a more friendly alias for the laptop [STMP-Laptop]

Since I am posting this here it obviously is not working for me. My /etc/dnsmasq.conf file ends up looking like this..

Code:
interface=br0
resolv-file=/tmp/resolv.dnsmasq
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-lease-max=35
dhcp-option=lan,3,192.168.1.1
dhcp-authoritative
dhcp-range=lan,192.168.1.220,192.168.1.254,255.255.255.0,1440m
stop-dns-rebind
address=/CND0450DMY/SUNTRUST-LAPTOP/192.168.1.203


It’s inserting the ‘address=’ option which it got from the GUI Console but not the ‘dhcp-host=’ option. So the syntax or formatting must be wrong [user error]…. Or is this really some kind of bug?
Sponsor
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Sun Jun 19, 2011 4:53    Post subject: Reply with quote
DD-WRT has an old version of DNSMasq because they removed a feature DD-WRT needs. The version in DD-WRT doesn't support multiple MAC's sharing a static lease.

Also you're inserting your DNSMasq "dhcp-host" option into the "Additional DHCPd" options for udhcpd which is the alternate DHCP server when you have "Use DNSMasq for DHCP" disabled in basic setup.

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
drewp
DD-WRT Novice


Joined: 18 Jun 2011
Posts: 2

PostPosted: Sun Jun 19, 2011 22:02    Post subject: Reply with quote
So let me see if I understand you correctly...

    1 - There are two DHCP Daemons. DNSMasq and 'udhcpd'.
    2 - udhcpd is disabled whenever DNSMasq is enabled. <-- This is the configuration I have.
    3 - I am entering DNSMasq's options [dhcp-host] into udhcpd fields in the UI.


If these three points are correct then how come the static leases are enforced when I use the UI to enter them in the udhcpd [add/remove] fields provided for them?

In other words, with DNSMasq ENABLED, I can go to the section that you've said is only for the uDHCPd and use the Add-Remove buttons to manually enter the mac address, hostname, ip address, and lease time for each host I want to assign a static address to...AND IT WORKS.

Additionally, if I enter a 'dhcp-host' option with only ONE mac address per IP Address [same as using the Add-Remove buttons] in the field that you have designated is only for uDHCPd, it also works and appears correctly in the /tmp/dnsmasq.conf
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Mon Jun 20, 2011 4:28    Post subject: Reply with quote
I'm probably wrong about that second part but multiple MAC's per static lease (dhcp-host) is definitely not supported with the old version of DNSMasq included in DD-WRT. Multiple MAC's is a newer option and so is the similar option to assign a lease based on hostname.
_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
schultzter
DD-WRT Novice


Joined: 29 Jul 2015
Posts: 11
Location: Montreal, QC

PostPosted: Fri Sep 06, 2024 3:06    Post subject: Reply with quote
Sorry, I know this thread is ancient but this is exactly what I'm trying to figure out how to do!

I have a few devices with both a wireless and wired interface and I would like the hostname to point to the active interface, or the preferred interface if both are active (probably the wired one but who knows).

Does the current version of dd-wrt have the version of dnsmasq that supports this? Or is there another way to do this in dd-wrt? Or do I have to setup another DHCP/DNS server somewhere else?

Thanks

_________________
Headed for the second star to the right and straight on 'til morning...
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 15227
Location: Texas, USA

PostPosted: Fri Sep 06, 2024 3:11    Post subject: Reply with quote
Only way to know is to try the Additional Config box to enter the information. Only one MAC address is supported in the webUI static leases entries AFAIK.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6698
Location: UK, London, just across the river..

PostPosted: Fri Sep 06, 2024 6:38    Post subject: Reply with quote
schultzter wrote:
Sorry, I know this thread is ancient but this is exactly what I'm trying to figure out how to do!

I have a few devices with both a wireless and wired interface and I would like the hostname to point to the active interface, or the preferred interface if both are active (probably the wired one but who knows).

Does the current version of dd-wrt have the version of dnsmasq that supports this? Or is there another way to do this in dd-wrt? Or do I have to setup another DHCP/DNS server somewhere else?

Thanks


You as KP-69 advised, do not use the static DHCP/MAC box's but use/add the line in advanced DNSmasq config box

dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,infinite

11:22:33:44:55:66 and ect. are mac addresses

https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

"As a special case, in DHCPv4, it is possible to include more than one hardware address. eg: --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2 This allows an IP address to be associated with multiple hardware addresses, and gives dnsmasq permission to abandon a DHCP lease to one of the hardware addresses when another one asks for a lease. Beware that this is a dangerous thing to do, it will only work reliably if only one of the hardware addresses is active at any time and there is no way for dnsmasq to enforce this. It is, for instance, useful to allocate a stable IP address to a laptop which has both wired and wireless interfaces. "

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 58184 WAP
TP-Link WR1043NDv2 -DD-WRT 58730 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 58694 Gateway/DoT,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 58753 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 58689 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Dynalink DL-WRX36-DDWRT 58753
Broadcom
Netgear R7000 --DD-WRT 58627 Gateway/SmartDNS/DoT,AD-Block,IPsetFirewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum