Use hostname to reach OpenVPN clients
-
@Unoptanio There could be many reason for that. Is the Server5K connected directly to this pfSense? If so the pfSense should register the hostname via DHCP, or if there's a static DHCP lease. I really can't give you much info here without knowing the exact setup. But ask yourself - how would the pfSense know about the existence of this Server5K and have the pfSense had a good reason to register the hostname in DHCP?
-
-
I would add the pfSense IP in the list of DNS servers:
You could just remove 8.8.8.8 and replace it with 192.168.1.1.
How does the Server5K get it's IP address? Is it static on the Server5K itself? Or a static lease in pfSense? Or just DHCP without Statis Lease?
-
-
@Unoptanio That explains why it isn't working. Set it to use DHCP on the server itself. Then on pfSense go to Services -> DHCP Server and at the bottom Add static mapping. Then fill everything out and make sure you get the MAC address right.
You just have to fill out this:
-
Are you sure?
But the server's ip address 192.168.1.250 is out of dhcp rangeThe DHCP range is :
-
@Unoptanio That's exactly as it should be. The DHCP range is for devices where you don't care about what IP they get, so clients, not servers. You cannot make a static mapping that lies within the DHCP range, only outside of it.
When you set the IP static on the server itself then it will never talk to the DHCP on the pfSense and that's why the pfSense doesn't really know that the server is even there. When you set a static mapping the server will talk to the DHCP server on pfSense and based on the MAC address of the server pfSense will assign it the correct IP address (outside of the DHCP range).You can try to assign the server an IP inside of the DHCP range, that will give you an error. It has to be outside of the DHCP range.
-
I'm going to dinner at my place, it's 8pm, I'll talk to you as soon as I make the changes. for now thanks
-
@Unoptanio I would just leave them blank, assuming you have set some DNS servers in General Setup. Then you can read below the fields what happens by default. Or do as you've done here, adding the pfSense as the first option.
-
-
@Unoptanio Make sure this option is enabled in Services -> DNS Resolver:
If you enable it then you almost certainly need to release and renew IP config on Server5K so it makes a new request to DHCP.
I'm a bit confused why you see 192.168.1.1 in the list of DNS Servers under DNS Lookup, you should only see 127.0.0.1 at the top (that's the pfSense localhost address) and below that any other DNS Servers you have added. Did you add 192.168.1.1 under General Setup? If so remove it there as it is not necessary.
When I use DNS Lookup on a local hostname it looks like this:
This is my DNS settings under General Setup:
-
-
@Unoptanio Perfect! And sorry I forgot to mention that earlier, I had forgotten it wasn't enabled by default. So many things to remember! :)
-
All other machines that are under dhcp do not have their names resolved.
Is there a cure for them too? -
@Unoptanio After enabling the option to Register DHCP leases in the DNS Resolver you must release/renew those machines or reboot them. The registration only happens when a machine request info from the DHCP. You can also just wait until their leases run out and they renew them automatically. It seems the leases are valid for 2 hours by default so it's not that long to just wait.
-
@zapador said in Use hostname to reach OpenVPN clients:
leases are valid for 2 hours
Default lease time
Controls how long a lease will last when a client does not request a specific lease length. Specified in seconds, default value is 7200 seconds (2 hours)Maximum lease time
Limits a requested lease length to a stated maximum amount of time. Specified in seconds, default value is 86400 seconds (1 day).
https://docs.netgate.com/pfsense/en/latest/services/dhcp/ipv4.html -
@Unoptanio Ah yeah so it could vary depending on the device, but depending on the number of devices it might be easier to just wait 24 hours for all of them to renew their lease.
-
I confirm, name resolution also works for clients under DHCP.
Why did we say to insert the IP address 192.168.1.1 first in the DNS list?
This thing had nothing to do with it
thanks for the support
thanks for the support
-
@Unoptanio I think just a bit of confusion, it's difficult for me to know your exact setup when I don't have it in front of me.
What I would recommend is this:
In General Setup put the DNS servers you want
Under DHCP Server leave all DNS fields blank.
Anywhere else only enter something in DNS fields if there's a good reason, otherwise leave them blank.
So turn off this:
-