Enhancement #1917

Use dhcp-host dnsmasq option for fixed leases

Added by Filippo Carletti about 8 years ago. Updated about 8 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-dnsmasq
Target version:v6.4-beta2
Resolution: NEEDINFO:No

Description

We now use /etc/ethers for fixed dhcp leaeses.
Using ethers has two side effects:
1. a static entry in the arp table
2. the same ip can't be leased to different mac (common for laptops)

I propose to use dnsmasq dhcp-host option to assign static leases.
From dnsmasq man:
This allows an IP address to be associated with multiple hardware addresses...useful to allocate a stable IP address to a laptop which has both wired and wireless interfaces.


Related issues

Related to NethServer 6 - Bug #1923: DNSMasq: dhcp-reservation validator is case-sensitive CLOSED

Associated revisions

Revision e7a158bf
Added by Giacomo Sanchietti about 8 years ago

/etc/ethers: remove template, move code to nethserver-dnsmasq. Refs #1917

Revision 1289769b
Added by Giacomo Sanchietti about 8 years ago

dnsmasq.conf ethers dnsmasq-dhcp-hosts: use dhcp-host option for dhcp reservation. Refs #1917

Revision 11fcf57c
Added by Giacomo Sanchietti about 8 years ago

/etc/dnsmasq-dhcp-hosts: allow association of an ip address to multiple mac addresss. Refs #1917

Revision ed124ddb
Added by Giacomo Sanchietti about 8 years ago

spec: Release 1.0.4. Refs #1917

Revision e26f3e1c
Added by Giacomo Sanchietti about 8 years ago

spec: Release 1.0.2. Refs #1917

Revision 1cf31ceb
Added by Davide Principi about 8 years ago

host-* events: expand /etc/dnsmasq-dhcp-hosts template. Refs #1917

History

#1 Updated by Davide Principi about 8 years ago

  • Target version set to v6.4-beta2

#2 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from NEW to TRIAGED
  • Assignee set to Giacomo Sanchietti
  • % Done changed from 0 to 20
  • Estimated time set to 1.00
Step to use the proposed solutions:
  • remove /etc/ethers file
  • dnsmasq.conf:
    • disable read-ethers option
    • enable dhcp-hostsfile option pointing to a new file (eg. /etc/dnsmasq-dhcp-hosts)
  • adapt template for /etc/ethers to /etc/dnsmasq-dhcp-hosts

#3 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from TRIAGED to ON_DEV
  • % Done changed from 20 to 30

#4 Updated by Giacomo Sanchietti about 8 years ago

Packages in dev repositories:
  • nethserver-dnsmasq-1.0.2-1.0git1289769b.ns6
  • nethserver-hosts-1.0.3-1.0gite7a158bf.ns6

#5 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70

#6 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 70 to 80

Package in testing: nethserver-hosts-1.0.4-1.ns6.noarch.rpm

#7 Updated by Giacomo Sanchietti about 8 years ago

Package in testing: nethserver-dnsmasq-1.0.3-1.ns6.noarch.rpm

For multiple ip-mac association, see Nethserver-dnsmasq

#8 Updated by Davide Principi about 8 years ago

  • Assignee changed from Giacomo Sanchietti to Davide Principi

#9 Updated by Davide Principi about 8 years ago

  • Status changed from ON_QA to ON_DEV
  • Assignee deleted (Davide Principi)
  • % Done changed from 80 to 30

Verification FAILED

In nethserver-dnsmasq: expand /etc/dnsmasq-dhcp-hosts template also in events
  • host-create
  • host-delete
  • host-modify

Tested with dhtest

#10 Updated by Davide Principi about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • Assignee set to Davide Principi
  • % Done changed from 30 to 70

Test case

/etc/dnsmasq-dhcp-hosts must reflect changes on local keys in HostsDB

#11 Updated by Davide Principi about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • Assignee deleted (Davide Principi)
  • % Done changed from 70 to 80

#12 Updated by Davide Principi about 8 years ago

In nethserver-testing repo:
  • nethserver-dnsmasq-1.0.4-1.ns6.noarch.rpm
  • nethserver-hosts-1.0.4-1.ns6.noarch.rpm

#13 Updated by Giacomo Sanchietti about 8 years ago

  • Assignee set to Giacomo Sanchietti

#14 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_QA to VERIFIED
  • % Done changed from 80 to 100

Creating test1 host

Extract from hosts db:

test1=local
    Description=
    IpAddress=192.168.5.127
    MacAddress=08:00:27:77:C3:23

Extract from /etc/dnsmasq-dhcp-hosts

# Host: test1
08:00:27:77:c3:23,192.168.5.127

Editing test1 host

Extract from hosts db:

test1=local
    Description=
    IpAddress=192.168.5.128
    MacAddress=08:00:27:77:C3:23

Extract from /etc/dnsmasq-dhcp-hosts

# Host: test1
08:00:27:77:c3:23,192.168.5.128

Deleting test1 host

Extract from /var/log/messages:

Jul 24 07:47:40 localhost /sbin/e-smith/db[29644]: /var/lib/nethserver/db/hosts: DELETE test1=local|Description||IpAddress|192.168.5.128|MacAddress|08:00:27:77:C3:23
Jul 24 07:47:40 localhost esmith::event[29646]: Processing event: host-delete 
Jul 24 07:47:40 localhost esmith::event[29646]: Running event handler: /etc/e-smith/events/actions/generic_template_expand
Jul 24 07:47:40 localhost esmith::event[29646]: expanding /etc/hosts
Jul 24 07:47:41 localhost esmith::event[29646]: expanding /etc/dnsmasq-dhcp-hosts
Jul 24 07:47:41 localhost esmith::event[29646]: generic_template_expand=action|Event|host-delete|Action|generic_template_expand|Start|1374652060 718622|End|1374652061 67277|Elapsed|0.348655
Jul 24 07:47:41 localhost esmith::event[29646]: Running event handler: /etc/e-smith/events/actions/adjust-services
Jul 24 07:47:41 localhost esmith::event[29646]: adjusting service dnsmasq (reload)
Jul 24 07:47:41 localhost dnsmasq[29141]: read /etc/hosts - 2 addresses
Jul 24 07:47:41 localhost esmith::event[29646]: Reloading dnsmasq: [  OK  ]#015
Jul 24 07:47:41 localhost esmith::event[29646]: adjust-services=action|Event|host-delete|Action|adjust-services|Start|1374652061 69159|End|1374652061 359923|Elapsed|0.290764

No host entry in hosts db and /etc/dnsmasq-dhcp-hosts file.

#15 Updated by Davide Principi about 8 years ago

  • Status changed from VERIFIED to CLOSED
  • Assignee deleted (Giacomo Sanchietti)
  • % Done changed from 90 to 100

Moved to nethserver-updates repository

Also available in: Atom PDF