ClearOS Bug Tracker


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001955ClearOSapp-dhcp - DHCP Serverpublic2014-09-12 09:322020-03-06 06:02
Reporterdloper 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionsuspended 
PlatformOSOS Version
Product Version7.1.0 Beta 2 
Target VersionFixed in Version 
Summary0001955: Move DHCP static leases functionality to DNSMasq parameter dhcp-host instead of /etc/ethers.
DescriptionThe /etc/ethers file exists in much the same way as the /etc/hosts file does and should be used as an override instead of an authoritative source. Additionally, the /etc/ethers file is limited in scope and ability. By switching to using 'dhcp-host' we could add both manageability and functionality to DNSMasq.

Assigning this functionality makes leases specific to DNSMasq while allowing the arp override functionality of /etc/ethers to persist. Moreover, you can define different lease times different than the rest of the scope. For example, create a file called /etc/dnsmasq.d/staticleases.conf and in it define the following sample leases:

dhcp-host=00:20:e0:3b:13:af,wap,10.1.1.50,infinite #Wireless Access Point - Upstairs
dhcp-host=11:22:33:44:55:66,fred,10.1.1.60,45m #Fred's laptop

This would give the device identified by the MAC address '00:20:e0:3b:13:af' the hostname of 'wap'. It would give it an 'inifinite' lease time and the comment section at the end would be useful to administrators. For Fred, his laptop will get the address 10.1.1.60 and have a 45 minute lease.

This feature supports IGW initiative.

Additional Information/etc/dnsmasq.d/staticleases.conf - This file is read in by in by 'conf-dir=/etc/dnsmasq.d' in /etc/dnsmasq.conf

**
'dhcp-host=' This parameter is used by dnsmasq to assign leases to addresses and has even more functionality that will not necessarily be useful. For example, it can assign addresses to hosts based on the hostname they proffer instead of the MAC address. Values associated by this parameter are separated by commas. Commas should be excluded as valid entries in the logic except for the comment field. No space should exists on either side of the '=' sign.

**
'00:20:e0:3b:13:af' This second value and is delimited by the '=' before it and a ',' after. This value must regex as a MAC address, meaning that the allowed characters should be:

^([0-9a-f]{2}[:-]){5}([0-9a-f]{2})$

The input from the web interface should allow upper case ([A-F]) but should be rendered lowercase for dnsmasq.

^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$

**
'wap' This next field is delimited by commas on either side. This is the hostname field and MUST NOT be a FQDN name.

A "name" (Net, Host, Gateway, or Domain name) is a text string up
   to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
   sign (-), and period (.). Note that periods are only allowed when
   they serve to delimit components of "domain style names". (See
   RFC-921, "Domain Name System Implementation Schedule", for
   background). No blank or space characters are permitted as part of a
   name. No distinction is made between upper and lower case. The first
   character must be an alpha character. The last character must not be
   a minus sign or period. A host which serves as a GATEWAY should have
   "-GATEWAY" or "-GW" as part of its name. Hosts which do not serve as
   Internet gateways should not use "-GATEWAY" and "-GW" as part of
   their names. A host which is a TAC should have "-TAC" as the last
   part of its host name, if it is a DoD host. Single character names
   or nicknames are not allowed.

Again, must not have a period in it anywhere.

**
'10.1.1.50' This IP address is delimited by commas. This entry should be validated as a standard IP address regex. This entry should be validated against an active and enabled DHCP scope of addresses (ie. must reside within the active DNS address space for it to work). It is likely that it can be defined for an inactive scope but will not function until the scope is active. This should be tested and hosts placed into a scope that is inactive should begin working if the scope is later activated. If placed in an inactive scope, a warning should be given to an administrator.

**
'infinite' This field is the duration of the lease and is delimited by a comma preceeding and by whitespace+hash or optionally a carriage return. The format for this parameter is either 'infinite' or a combination of a number and a letter signifying units of time. "The lease time is in seconds, or minutes (eg 45m) or hours (eg 1h) or "infinite"." (http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html [^])

**
'#Wireless Access Point - Upstairs' One of the most asked feature requests for DHCP is to leave comments on the addresses. This can be done in the config file by adding a space and hash at the end of the configuration line and placing the comment here. For simplicity, commas should NOT be allowed in the text nor should "#" Characters. Spaces, Dashes '-', Underscores '_', Upper and lower case letters, Numbers should be allowed. Potentially, letters and characters in other languages could also be allowed.

BONUS POINTS FEATURE
As a bonus, this static leases table should be exportable to CSV and should also have an import feature. Since commas are ONLY used as delimiters in the config file and are expressly excluded from every field (including the comments field), CSV is a natural pick.

LINKS:

HOSTNAMES (RFC 952): http://tools.ietf.org/html/rfc952 [^]
DNSMasq.conf example: http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example [^]
Current DNSMasq migration HowTo: http://www.clearcenter.com/support/documentation/clearos_guides/migrating_dhcp_settings [^]
TagsNo tags attached.
Attached Files

- Relationships
related to 0001946closed Add comment field to dhcp static addresses. 

-  Notes
(0013451)
NickH (developer)
2020-03-06 06:02

Migrated to https://gitlab.com/clearos/clearfoundation/app-dhcp/-/issues/12 [^]

- Issue History
Date Modified Username Field Change
2014-09-12 09:32 dloper New Issue
2014-09-12 12:32 user2 Status new => confirmed
2019-03-22 04:38 NickH Relationship added related to 0001946
2020-03-06 06:02 NickH Note Added: 0013451
2020-03-06 06:02 NickH Status confirmed => closed
2020-03-06 06:02 NickH Resolution open => suspended