Modify

Opened 9 years ago

Last modified 4 years ago

#5067 accepted enhancement

/etc/init.d/dnsmasq [dhcp_host_add()]

Reported by: mitchix@… Owned by: nunojpg
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Kamikaze 8.09
Keywords: dnsmasq, static dhcp Cc:

Description

More Complete support for the --dhcp-host option in config files and also luci...
I'll include part of the -dhcp-host options from the man page for reference.

http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html


-G, --dhcp-host=[<hwaddr>][,id:<client_id>|*][,net:<netid>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]

Specify per host parameters for the DHCP server. This allows a machine with a particular hardware address to be always allocated the same hostname, IP address and lease time. A hostname specified like this overrides any supplied by the DHCP client on the machine. It is also allowable to ommit the hardware address and include the hostname, in which case the IP address and lease times will apply to any machine claiming that name. For example

*(1) --dhcp-host=00:20:e0:3b:13:af,wap,infinite tells dnsmasq to give the machine with hardware address 00:20:e0:3b:13:af the name wap, and an infinite DHCP lease.
*(2) --dhcp-host=lap,192.168.0.199 tells dnsmasq to always allocate the machine lap the IP address 192.168.0.199. Addresses allocated like this are not constrained to be in the range given by the --dhcp-range option, but they must be on the network being served by the DHCP server. It is allowed to use client identifiers rather than hardware addresses to identify hosts by prefixing with 'id:'. Thus: --dhcp-host=id:01:02:03:04,..... refers to the host with client identifier 01:02:03:04. It is also allowed to specify the client ID as text, like this: --dhcp-host=id:clientidastext,.....


there are a few usages of this...
*(1) part of option this option seems to be what is implemented in the config file
*(2) this is the version that i require so i cheated and put hostname in the mac field...
there are more but my head hurts...


dhcp_host_add() {

local cfg="$1"

config_get name "$cfg" name

[ -n "$name" ]
return 0

config_get mac "$cfg" mac

[ -n "$mac" ]
return 0

config_get ip "$cfg" ip

[ -n "$ip" ]
return 0

append args "--dhcp-host=$mac,$ip"


Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by nunojpg

  • Owner changed from developers to nunojpg
  • Status changed from new to accepted

comment:2 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as accepted .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.