/etc/ethers ignored?

In LuCI -> Network -> DHCP and DNS, I have “Use /etc/ethers [checked]
Read /etc/ethers to configure the DHCP-Server”.

root@turris:~# cat /etc/ethers
6c:ad:f8:23:ae:fd fairphone

root@turris:~# cat /etc/hosts
127.0.0.1 localhost
192.168.2.254 turris
192.168.2.15    fairphone

But when the client connects, the Turris does not give it the fixed
address 192.168.2.15 but an address from the dynamic range:

2016-11-01T14:16:14+00:00 info dnsmasq-dhcp[2952]: DHCPDISCOVER(br-lan) 6c:ad:f8:23:ae:fd
2016-11-01T14:16:14+00:00 info dnsmasq-dhcp[2952]: DHCPOFFER(br-lan) 192.168.2.35 6c:ad:f8:23:ae:fd
2016-11-01T14:16:14+00:00 info dnsmasq-dhcp[2952]: DHCPREQUEST(br-lan) 192.168.2.35 6c:ad:f8:23:ae:fd
2016-11-01T14:16:14+00:00 info dnsmasq-dhcp[2952]: DHCPACK(br-lan) 192.168.2.35 6c:ad:f8:23:ae:fd fairphone

Everything works when I configure the DHCP static leases in
/etc/config/dhcp.

So, did I do something wrong or is this /etc/ethers option broken (and
therefore it should be removed from LuCI)?

I haven’t configured a mac-address bind-to ip on linux, but what you have done should not be done like that.

the hosts file is for something else. I think what you need to do is to configure the dhcpd.conf file.

DHCP-server is the one who is giving ip addresses. The hosts file is simply a file which you can make a sort LAN-DNS.

So for example, if i put www.google.com to a local ip, redirection will be done…

@Big_boss As I said, it works when I configure /etc/config/dhcp (and not dhcpd.conf: this is OpenWRT, remember). But LuCI has an option to use /etc/ethers and this option must either work or be removed.

I used /etc/hosts because ethers(5) says you can use a host name in /etc/ethers but, apparently, the DHCP server does not read /etc/hosts. If I put the IP address directly in /etc/ethers, it works, I get my static address. So, it seems host names in /etc/ethers are not supported (or only if they can be resolved by DNS?)

You don’t need /etc/hosts nor /etc/ethers, fill in LuCl > Network > DHCP and DNS > Static Leases

and then once again (unfortunately) LuCl > Network > Hostnames

Both will be written in /etc/config/dhcp, once as config host (for static MAC > IP) and once as config domain (for hostname)

Then just a small change is needed in /etc/init.d/kresd, you need to add two lines, reading the /etc/config/dhcp, as discussed here: https://www.turris.cz/forum/topic_show.pl?tid=39

After /etc/init.d/kresd restart everything works as expected, I hope the two lines change will get officially included soon.

The modified /etc/init.d/kresd is here (look for # added by Sten)

(some funny limitation here: New users can add only two links in a post? Pastebin is how many links then?)

I know /etc/ethers is not mandatory, I wrote it from the beginning. But what is the point of documenting in the LuCI Web interface something which is useless?

1 Like

Apparently, the trick is that /etc/ethers need IP addresses, not host names (even if the mapping name->address is in /etc/hosts).

(This is despite what you found in typical man pages about ethers(5).)

1 Like