Local DNS not reliable

I do wonder why client-name is un-commented because if it was commented out, this issue would never had appeared.

on commit {
	set ClientAddress = concat(
		"ADDRESS=",
		binary-to-ascii(10, 8, ".", leased-address)
	);
	set ClientName = concat(
		"NAME=",
		pick-first-value(option host-name, config-option-host-name, client-name, "")
	);

	if (ClientName != "") {
		execute("/usr/sbin/unbound-dhcp-leases-client", "commit", ClientAddress, ClientName);
	}
}

should be:

on commit {
	set ClientAddress = concat(
		"ADDRESS=",
		binary-to-ascii(10, 8, ".", leased-address)
	);

set ClientName = concat("NAME=", pick-first-value(option host-name, config-option-host-name, ""));

	if (ClientName != "") {
		execute("/usr/sbin/unbound-dhcp-leases-client", "commit", ClientAddress, ClientName);
	}
}

In the older versions of windows the wifi and the wired net had the same netbios name and this little bug of theirs assigning a different netbios name is going to cause issues.

But since its been awhile since I heard this, but any time netbios is allowed to run without a wins server it will slow down the network and those names will not be stable. That is why Microsoft abandoned it to a point and I’m surprised they still have it in winjunk 11. Which I already began not liking that os or its commercial version, Server 2025. Why block programs that everyone uses? If its that unsafe of an os to a point its paranoid about standard programs it normally runs, its time to find a better platform and leave windows behind.

The bridge should delete any old IP’s associated with a hostname when a new lease is for that host is created. This allows the same hostname and IP to be reused between WiFi and wired. If this does not work, a bug should be filed.

1 Like

Problem centers around the same hostname with two different mac, ip and netbios name connected at the same time, as well as individually. So that one machine gets a host name, and two netbios names in the lease file sporadically . Deleting netbios option is the solution, or comment it out because others have done this and because of this issue.

Without altering the code, the hostname can be simply fixed by putting two entries in the hosts page (bind9 A record) inside ipfiire for the two different mac addresses. Then you only have one additional netbios name that didn’t map to the hostname if the other interface is connected. Of course turning net bios completely off on the machines is an option too since most have that off.

But what I see by default in the other os is to make this automatic so you don’t have to put static hostname entries, which is having client-name (netbios source) commented out. So basically theirs look like this, when you look at their source code:

set ClientName = concat(
		"NAME=",
		pick-first-value(option host-name, config-option-host-name,
 #client-name,
 "")
	);

so when the same hostname connects with a different mac address and it will not map those netbios names, expire the hostname lease of the other interface. If more interfaces come online, it just gets an ip address. Which is set by the next few lines in the same file.

The only thing I’m not sure of is if changing it will break something in the ipsecvpn part if it uses this file. Because the other router os that I compared it to, doesn’t have all those ipsec/vpn progams.

From what I understand of the /usr/sbin/unbound-dhcp-leases-bridge program

At startup
1 - Saves the static addresses from the /var/ipfire/main/hosts file to /etc/unbound/hosts.conf
2 - Saves the assigned DHCP addresses from the /var/state/dhcp/dhcpd.leases file to /etc/unbound/dhcp-leases.conf
3 - Saves the addresses from the /var/ipfire/dhcp/fixleases file to /etc/unbound/dhcp-leases.conf if it is not already declared static in /etc/unbound/hosts.conf

Then
When a host connects via DHCP, it adds its address and hostname to the local_data if they are not already present in /etc/unbound/dhcp-leases.conf.
At the end of the lease DHCP, removes the host from the local_data

My duplicate registration issue with a different name for my “matebook” stems from the fact that the entry was in both /var/ipfire/main/hosts and /var/ipfire/dhcp/fixleases
Therefore, it wasn’t in /etc/unbound/dhcp-leases.conf

the rule to apply:
Do not define a host in static hosts if it is already defined in DHCP fixedleases

1 Like

All of my systems are running with fixed leases defined in the dhcp page and also entered into the Hosts page and none of them are giving me a duplicate registration effect. If my laptop is connected at home via a wired connection then the wifi is also connected but not used as the wired connection has the higher priority. So wired will always be used if connected but if it is disconnected then the wifi picks up the connection.

So if you are having a duplicate registration then it is not simply the connection being specified in both the /var/ipfire/main/hosts and /var/ipfire/dhcp/fixleases files.

I break that rule with every one of my hosts and I don’t see the problem you are experiencing at all.

Maybe I missed it earlier in this thread or I misunderstood it.

You have the same IP with two different hostnames. If you define a new hostname for the same IP then the IPFire DHCP page will allow it but it shows it in bold to let you know and decide if you want to actually do that.

All my fixed lease hostnames have unique IP’s. I have the same hostname with two different IP’s to deal with the wired and wifi connections of my laptops but I have nothing with two different hostnames on the same IP.

Just to clarify for me. Are you defining huaweimb.pscar.dynu.com and matebook.pscar.dynu.com to have the same IP in IPFire’s DHCP or HOSTS page? If not where are these hostnames coming from?

make a host with the name of your PC windows in IPFire when you switch it from wifi to fixed, you will have the two IP addresses

I have no windows system at all on my network. The last time I used windows was around 20 years ago with XP.

All my systems are Linux based (Arch Linux). Those all seem to accept the hostname I provide via dhcp. None of them come back with a separate hostname.

It looks like windows is insisting on using the hostname matebook, even though you have specified a different one via the dhcp assignment.

Maybe you can set windows to just accept the provided hostname but I have no idea how to do that. Needs input from someone with windows experience.

That’s why the rule I defined works for me, there is no problem in applying it or not.

If it is working for you then use it. I can’t think of a problem but I am not familiar enough with all of the dns/dhcp interactions to figure that out.

If it continues working, without any problem then fine. If later on you identify a problem, you can always come back to the forum for further help from windows experts.

A quick search on windows dhcp looks like the windows dhcp client, at least for earlier versions of windows from around 2012, does not have the option request-hostname to be able to get and accept a hostname provided by a dhcp server.

Not sure if this has changed or not since 2012.

:crossed_fingers: that everything continues to work fine for you.

1 Like

I’m not familiar with all the management rules coded in /usr/sbin/unbound-dhcp-leases-bridge, but they seem consistent.

  • The hosts file must contain only static IP addresses (not using DHCP).

  • The fixleases file must contain the IP addresses to be assigned by DHCP when the client connects.

  • The local DNS records static IP addresses.

  • The local DNS records IP addresses assigned by DHCP (fixed or dynamic).

However, I don’t know the rule that defines the host name, and whether it should be assigned by the client or the DHCP server.

For IPFire (in this version 193):

  • The server defines the hostname if it is present in fixleases; otherwise, it uses the client’s hostname.

This is consistent, but this last rule doesn’t work if the address is previously defined as static.

In this case it records both, the Local DNS contains two hostnames (that of the server and that of the client) for the same IP address

Its a bug, in my opinion.

Its not a bug its correct because when you define static names, it defines the host directly.

To make a redundant host, the function is using the same hostname and ip address with different mac and the first one on the list would get the ip while the other would wait till it went offline.

To make a round-robin redundant host you would use different ip and mac with the same host name. Then it will do like above and try the fist ip then the other.

To make a CDN you make a round robin redundant host, then place that pool of ip numbers into another program called a load balancer
That would distribute queries bases on the lowest ping time from the client.

But your redundant map will always show and that is probably the confusion.

The computer has two netbios names, and the system is going to associate that as two netbios hosts on the same client machine.

So the system responded correctly due to how that windows computer is set up.

It really isn’t a bug, Just that most routers have taken out netbios mapping functionality because people get confused with it and it only exists today in Windows because Microsoft wants to keep compatibility with dot net programs people made that use netbios paths. Since they taken out the controller in widows 10, the first client on the net is not the netbios controller because there isn’t one. So if you are not using a .net program that needs a netbios name path, then having netbios enabled in ipv4 properties is an error and should be disabled. Because its not used for file and print sharing on a DNS based network.

You are just not used to a real DNS used in a system.

And if there is a bug, its Microsoft having netbios enabled by default on their interfaces. Because its not used in networking anymore. Plus they want you to use DNS because Windows never could get netbios to have proper security from hacking. They are all paranoid about malware yet leave the documented attack vector in place in the machine. Makes perfect win-sense.

Thank you @dr_techno for your explanations.
That’s very kind of you.
But I didn’t understand nothing of what you wrote.

If the IPFire team considers everything to be fine, it’s OK. For me, too, I found an answer to my problem.

1 Like

This might be a problem, But how did wlan0 got a hostname? If you defined it (a hostname on your blue interface) then that is what is going to populate dynamically in the hosts. If they are previous ip addresses then its an after effect of the dhcp server because of its configuration.

What IPFire is using is what I use if blue was wired Ethernet at the server and an access point installed. Which is just one dhcp and client control system for all networks. Netbios mapping is enabled on this dhcp server, but for remote host mapping (because vpn services use netbios names in certain ip mapping subroutines)

Personally I think, blue needs a separate system that the netbios mapping is disabled so it would be like everyone’s wifi router. Then there wouldn’t be anything different. However, I would just want that when the ipfire server has a wifi interface on blue.

Wired networking with an access point on blue is working like it should, however when a wifi interface is connected, the dhcp server is not in the configuration from what everyone uses in their wifi routers.

The difference between the two, the access point will never give the system a netbios name and only a hostname.

I also want to mention that every entry in hosts on the webgui has to be a static connection or else its going to pile a bunch of entries in the dhcp lease list until they expire. Because the system can assign multiple ips to a host interface and will do so. The client if its not able to accept multiple ips by dhcp it will drop its current ip for the new one problem is it will go down the list in reverse order (new to oldest) .

I don’t see why IPFire

  • Doesn’t register an IP/client-hostname in the Local DNS if it’s already present in fixleases (log message “Won't update fixed lease
  • But registers this IP/client-hostname if it’s present in both fixleases and hosts

If this isn’t a bug, it looks very similar.

Surely it means that if you use a fixed lease, it automatically uses the name from there. If it is in the hosts file, then that takes precedence over the name from the fixed lease.

That is how it suppose to operate, however, the netbios or client-name is enabled so address reservation turns into an extra A name entry when dhcp enumerates the netbios name. Because the host name already has an ip. However, since the client does not have this as a static entry, it will only get the address that the dhcp request is sent and mapped.

If you look at a different distribution, you will see client-name commented out on purpose or not listed in the options quotient part of the statement. In their DHCP-DNS bridge

The only reason why IPFire is different is because the dhcp is setup for the VPN services which is not really designed to be used for a wifi services that requires a different dhcp setup all together because of the netbios incompatibility with wifi. Which is one of the reasons why that protocal is depreciated. Netbios has unsolvable issues with address reservations.

I think my translator is malfunctioning. :thinking:

It does, however, if the dhcp request has a name not already predefined it will map it and the dhcp ip will be given to that name and reservation will be ignored as it assumes the client has registered the ip address in the client.

Its not a bug, its a reason why its not normally configured that way. However, the dhcp query from the client will only get one ip and it will be the last results from the pick from options routine. since C++ options fallows order of operations, its going to assign an ip address to a name not in the lists from the dhcp client query. That is why client-name is commented out or deleted in everyone else’s router’s operating systems.

Either WIFI or VPN needs to get a separate DHCP server instance, but a DHCP server for the VPN might be the correct direction since the rest of the network should have a different dhcp setting so address reservation works without it getting impeded by netbios or client-name.

I don’t use address reservation. I always use static ip addresses when I need it to have the same ip every time it connects. Since this dhcp server will hand out an ip for the netbios name, you have to add the static ip into the interface properties in windows so the client will always have that ip. Or disable netbios, which should have been disabled by default in windows.