- IT Resources
- Windows Server
- System Center
- Microsoft Edge
- Exchange Server
- SharePoint Products
- Skype for Business
- See all products »
- Channel 9 Video
- Evaluation Center
- Learning Resources
- Microsoft Tech Companion App
- Microsoft Technical Communities
- Microsoft Virtual Academy
- Script Center
- Server and Tools Blogs
- TechNet Blogs
- TechNet Flash Newsletter
- TechNet Gallery
- TechNet Library
- TechNet Magazine
- TechNet Wiki
- Windows Sysinternals
- Virtual Labs
- Cloud and Datacenter
- Virtualization
- Service Packs
- Security Bulletins
- Windows Update
- Windows Server 2016
- System Center 2016
- Windows 10 Enterprise
- SQL Server 2016
- See all trials »

Related Sites
- Microsoft Download Center
- Microsoft Evaluation Center
- Expert-led, virtual classes
- Training Catalog
- Class Locator
- Free Windows Server 2012 courses
- Free Windows 8 courses
- SQL Server training
- Microsoft Official Courses On-Demand
Certifications
- Certification overview
- Special offers
- MCSE Cloud Platform and Infrastructure
- MCSE: Mobility
- MCSE: Data Management and Analytics
- MCSE Productivity
Other resources
- Microsoft Events
- Exam Replay
- Born To Learn blog
- Find technical communities in your area
- Azure training
- Official Practice Tests
Support options
- For business
- For developers
- For IT professionals
- For technical support
- Support offerings
More support
- Microsoft Premier Online
- TechNet Forums
- MSDN Forums
- Security Bulletins & Advisories
Not an IT pro?
- Microsoft Customer Support
- Microsoft Community Forums
- Forums home
- Browse forums users
- Remove From My Forums
Answered by:
How to assign hostname to clients dynamically via dhcp using uanttended installation ( wds ).
I have a WDS environment and responds to both known and unknown client. I deploy completely unattended installations to my client computers.
I want to use DHCP server to dynamically assign host name to my clients using 012 tag. I have made a reservation based on clients mac id for ip and hostname
I have not added computer name to my unattend.xml file.
But somehow my client computers do not take hostname dynamically.
I think there should be a way to specify in my unattend.xml file for clients to go to DHCP for hostname, which i have not been able to figure out.
Just put the %MachineName% variable in the ComputerName tag. Basically, during installation, Windows Deployment Services will retrieve the name of the prestaged account from Active Directory Domain Services (AD DS) and replace the %MACHINENAME% string with the actual computer name.
Best Regards
- Marked as answer by anshul somani Thursday, March 17, 2011 8:19 AM
All replies
Can you explain exactly how you want your computer names to be?
Please read the following computer naming policy, specify the correct variable in the Microsoft-Windows-Shell-Setup | ComputerName component in your unattended file.
Set the Computer Naming Policy
http://technet.microsoft.com/en-us/library/cc771624(WS.10).aspx
In WDS we can use a naming policy, thats true , but I have more than 500 systems in my network of which we have a specific naming convention.
when I install a particular system using WDS unattended I want it to query for host name on DHCP based on reservation that I have made according to its MAC address
Hence when I install more that one system at a time all of them will go to DHCP for their hostname and will get it there, reason being If I have to format a system which is already in domain and already has a hostname it should take the same hostname after the istallation completes and joins the domain with the same hostname it had prior to installation. For that if i make a reservation on DHCP based on its MAC address for hostname it will take the hostname that i have specified. But unfortunately its not working. Thats why I am looking for a option in Unatted.xml where i can specify the system to go to DHCP for the hostname.
In Microsoft-Windows-Shell-Setup when i apply it in Pass 4 Specialize it gives me an option to set the computer name but i cannot have 500 unattend file for every system. It would be great if i can have the clients to go to DHCP for their hostnames.
Thanks A lot for your help Dale !
Works fine.
Best regards
Glad to see it worked. :)
Configure hostname via DHCP
Author : Ingmar Verheij

Giving the device a human readable hostname makes it easier to troubleshoot issues and is sometimes required to to apply to a naming convention. Having an asset tag on the device makes it easier for a user to explain what device he/she is using.
But what if you’re unable to change the hostname of a device or don’t want to specify this for each device? Think of thin clients (or zero clients) like a HP Smart Zero Client where you can’t (or want) to configure the hostname per device.
Well, you can push the hostname via the Dynamic Host Configuration Protocol (DHCP) .
A client can be configured with static or dynamic IP configuration, by default all systems are configured with a dynamic configuration. This means that a client requests an IP configuration from a server on the network, the DHCP server. DHCP works basically works in three phases:
- Initialization

Popular Topics in Windows Server

DHCP does not assign hostnames; it assigns addresses, and specifies your DNS server(s), default gateways, and other assorted information.
The hosts are all "assigned" the same hostname, because you didn't change them during the installation process.
Here's a primer (not exactly Windows specific): https://technet.microsoft.com/library/dd145320(v=ws.10).aspx Opens a new window
Specificaly: " ...(DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway "

IT Professionals of Florida, Inc. is an IT service provider.
Sounds like you are using a "golden image" to deploy your hosts, with the host set up to get an IP address from the DHCP server? If so, you may need to sysprep and shut down your golden image before you copy it, or assign a new name to each machine when you start it up with the -RenameComputer command in PS.

Actually it's the non-Windows machines (like VMware ESX) that are a problem. There is nothing in the ESX setup that specifies (at least none that I can see) a host name. After install is complete, a DHCP-assigned address is present, but so is a host name, and that hostname is sometimes a duplicate of other host names. It's not always the same, but a host name that is a copy of an existing host name is there. I can always change the hostname after the setup, but it's these new DHCP leases that have different IP addresses and MAC addresses, but the same host name. Other non-Windows devices get this, too (Linux, IT phones, hardware appliances, etc.). I've looked at the Windows DHCP server option called "DHCP name protection", but the description is a little non-intuitive. I also have DCHP set up update DNS automatically. We typically can be running hundreds of VMs on the network, and it would be impossible to update DNS otherwise.
Philip9524 wrote: I've looked at the Windows DHCP server option called "DHCP name protection", but the description is a little non-intuitive. I also have DCHP set up update DNS automatically.
After install is complete, a DHCP-assigned address is present, but so is a host name,
But it is possible to configure hostnames (excepting non-PE Windows machines) with DHCP option 12. Can you check your scope and/or server options to see if you have option 12 configured? I've never given much thought to this because the advanced legwork never seemed appealing to me.
Option 12 is not configured in my DCHP scope options. I think I may not be describing the problem very well. If I start up a non-windows machine, such as the ESX server installer, it doesn't let me supply an IP address or host name during installation. Other non-windows devices are like this, too. I find that when I have completed the ESX installer and restart, the ESX host has indeed acquired an IP address from my DHCP scope. However, it has also acquired the host name of an already-existing Windows machine. If I look at my DHCP address leases, I will now see two identical hostnames with two different IP addresses. One of these hosts is correct, one is my non-Windows machine's new DCHP lease with the duplicate name, but different IP addresses and MAC IDs. This can happen many times throughout the day, as there are always new machines being created or re-installed.
Philip9524 wrote: If I start up a non-windows machine, such as the ESX server installer, it doesn't let me supply an IP address or host name during installation.
Philip9524 wrote: I think I may not be describing the problem very well. If I look at my DHCP address leases, I will now see two identical hostnames with two different IP addresses.
The default hostname for ESXi installations is "localhost," if memory serves me correctly.
What you are seeing (on ESX anyway - I can't sort out what you're getting with other Operating Systems) is the result of a (stale) PTR record being present. When booting up, ESX performs a reverse lookup of it's IP to see if it can determine its hostname. The PTR record is present (albeit, its probably stale), and ESXi uses the information to set its hostname.
You need to prune/clean your reverse records.
Check this log on your ESX server: /var/log/dhclient.log
grep for "hostname"
What other operating systems were you seeing this with?
This topic has been locked by an administrator and is no longer open for commenting.
To continue this discussion, please ask a new question .
Read these next...

Snap! -- Customizable AI Personalities, Time Travel Prototype, Grasshopper Bots
Your daily dose of tech news, in brief. Welcome to the Snap! Flashback: March 3, 1971: Magnavox Licenses Home Video Games (Read more HERE.) Bonus Flashback: March 3, 1969: Apollo 9 launched (Read more HERE.) You need to hear this. N...

There is no Admin (anymore)
I decided to let MS install the 22H2 build. I had to remove the machine from the domain Before doing that . I added a "LocalAdmin" -- but didn't set the type to admin. I realized I messed up when I went to rejoin the domain and was challenged. ...

What are some reputable on-prem password managers?
After LastPass's breaches, my boss is looking into trying an on-prem password manager. What are some of the best ones? And what are the pros and cons vs cloud based?

Spark! Pro Series - March 3rd, 2023
Friday, my favorite Spark day (a little bias there). In the quest to bring ever more interesting content, I asked my search engine, “What is the most interesting thing to ever happen on March 3rd. The list was long...

Windows Jump Box Design
Currently, we have separate RDP credentials to RDP into a server of any kind. That administrator has 2 factor and is separate from my regular user. Then they must elevate on that particular server in order to do any administration. I would like to take th...
Assign hostname to specific DHCP client

There are client devices on my network that show up in the DHCP leases without a hostname or with something random and unidentifiable. Where in pfsense can I assign a hostname to a client based on their MAC address that will show up in the leases? I know that I could assign a static IP and assign a hostname but I'd prefer to keep these particular clients dynamic. I tried assigning a hostname in the DHCP static mapping section and not entering an IP. It sort of works because then the hostname shows up in the leases but then the IP address and lease times are missing. Any ideas?

any particular reason to leave the clients as dynamic? the easiest solution is probably the one where you just give that static entry you already created a static IP
Nothing other than minor inconvenience. I was just hoping there was a simple way to do what I was looking for. I'm coming from OPNsense and it works as intended with assigned hostnames on dynamic clients.
Although there is a DHCP option for setting client hostname, most clients do not support it. What you can do is have the DHCP clients+server work together to register the hostnames in DNS. This is easy to set up with Windows server, but it's buggy with pfSense since the DNS service needs to be reloaded every time an A record is added, which can cause problems if it is happening often.
You can just put in a DNS host override for that particular device if it has a static mapping.
Sorry, I don't follow. The idea was to keep the client using DHCP but define it's hostname within pfsense so the custom hostname shows up in the list of leases.
About Community

Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Assigning a hostname of the fqdn assigned to a dhcp client with dnsmasq?
I'm aware that you can assign static DNS entry names by doing the following in dnsmasq.conf:
and then assigning a static ip address using the mac address of the machine in question using DHCP (see the UCI configuration from OpenWRT below):
However, how then can I set the hostname of the Linux machine with option DHCP option 12? (or am I already doing that with the second snippet?)
I'm expecting the machine in question to be able to run the command hostname and receive the hostname assigned by option 12.
- dhcp-option
- 1 To make it clear: You wish to assign the hostname of the client based on the fqdn you assigned in the dnsmasq server? – Leo Jul 16, 2018 at 7:40
2 Answers 2
In Dnsmasq, if you can edit the config file directly, you can specify a hostname for dhcp clients as follows:
dhcp-host=f8:da:0c:0a:af:c9,192.168.1.222,SpecialMachine,30d
This will assign client with the MAC address f8:da:0c:0a:af:c9 the IP 192.168.1.222, the hostname "SpecialMachine" and a DHCP lease time of 30 days.
[Apologies. In lieu of deleting this post, I figured, best to explain that in my case, what I wanted to accomplish was ensure that the device hostname showed up in my router as I wanted it. I did not verify that the device actually changed it's hostname].
If I undestood the question correctly, and you wish to assign the hostnames from the dnsmasq DHCP Server to the clients, on most Linux distributions it is the default for dhclient to send the hostname.
You can confirm if your clients are sending their hostname to the DHCP server in dhclient.conf, with the send host-name option:
You might get what you want by commenting that line and making sure you have assigned hostnames for every host in dnsmasq so the clients get one. You might have to load them in the /etc/hosts or equivalent source for your server.

Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged dhcp dnsmasq openwrt fqdn dhcp-option or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
Hot Network Questions
- OK to delete Windows.db file on PC?
- Recovering from a blunder I made while emailing a professor
- Why doesn't my passport show if a foreign country has banned me?
- The region and polygon don't match. Is it a bug?
- Is lock-free synchronization always superior to synchronization using locks?
- Does a barbarian benefit from the fast movement ability while wearing medium armor?
- Finite abelian groups with fewer automorphisms than a subgroup
- Voronoi-Lloyd ASCII art
- What video game is Charlie playing in Poker Face S01E07?
- How does fire heat air?
- Wahoo Kickr with 8 speed cassette?
- What is the purpose of this D-shaped ring at the base of the tongue on my hiking boots?
- How to prove that the supernatural or paranormal doesn't exist?
- Why is there a voltage on my HDMI and coaxial cables?
- Does Counterspell prevent from any further spells being cast on a given turn?
- Biodiversity through radiation
- Nought and Crosses (tic-tac-toe) in C++
- Largest Binary Area
- Checking system vs. SEPA and the like
- Why are physically impossible and logically impossible concepts considered separate in terms of probability?
- Coasting Along the Coast
- Is it possible to create a concave light?
- "We, who've been connected by blood to Prussia's throne and people since Düppel"
- Why are trials on "Law & Order" in the New York Supreme Court?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
How to set the hostname assigned by DHCP server?

I have a client which obtains an IP via DHCP. This of course works without issue. However, I can not make this machine keep the machine name as it is assigned via DHCP. I have found networkd, hostnamed, and NetworkManager all capable of setting the hostname and I think they do… it just ends up with whatever is in /etc/hostname. I have tried setting the name to localhost in the /etc/hostname which should be overwritten by the DHCP name. I have modified NetworkManager.conf only to see “warnings” in systemctl that the change to the DHCP name was blocked due to “systemd security” and I should use sethostname or hostnamectl (I don’t recall which for sure, atm).
Anyone have clues as to what I need to change? Accepting the hostname assigned by DHCP should be the default… but it is not or it does not function properly or one of the other systemd services is resetting it. Sure wish we still lived in the day of, do one thing and to do it well.
Did you set up a static hostname in /etc/hostname ? It should be empty if you want to use the Transient hostname or containing localhost . If possible remove the /etc/hostname file, without network the fallback hostname is used and it is hardcoded in systemd. NM and systemd-netweorkd will only update the Transient hostname with the value receiving from the DHCP server. The static hostname will not be touched.
By default systemd/hostnamectl will ignore the Transient hostname if a valid static hostname in /etc/hostname is found. If the static hostname is localhost the Transient hostname is used. But again the /etc/hostname file will not be touched. The problems are programs that read form /etc/hostname . But for example journalctl will pick up the Transient hostname.
For example (with systemd-networkd, DHCP provided Hostname arch)
With /etc/hostname containing localhost
With /etc/hostname removed
with a hostname on /etc/hostname
Please post the real log entry.
I will edit this post as I work through there various configuration changes:
First, no static hostname assigned:
I have also tried an empty /etc/hostname file and a /etc/hostname file with localhost
If I then modify /etc/NetworkManager/NetworkManager.conf:
And then restart NetworkManager and check the status:
And you see it did successfully set the name to “rpi” which is indeed the dhcpd assigned name. So at this point I thought I had it… but…
Now reboot…
So on reboot, systemd security kicks in… I did not even know this existed.
But as you can see from log of the reboot… something changes the name to archlinux outside of NetworkManager.
I have even tried masking systemd.hostnamed thinking it was dynamically changing it, but that does not resolve the issue. Usually the fight is to stop a system from accepting the DHCP assigned name… as it is usually the default. So I am fairly stumped at the moment.
(I am finished making edits of this post and await any assistance.)
Please check the complete journal, specially the first try to set up the hostname and the first error.
Also double check if no other dhcp client is running on this machine. Manjaro Arm has a long history of staring multiple dhcp client at boot.
I tried it with now with Manjaro XFCE on real Hardware (x86-64) and NM, and it worked with the default settings (no need form hostname-mode=dhcp )
I do not see multiple dhcp clients being launched on boot but I do see several starts of systemd.hostnamed and dbus-org.freedesktop.hostname1.service being launched. So I think there are 4 processes at play here: dbus, NetworkManager, networkd and dhcpcd. And there is the NetworkManager “Policy”, whatever that is.
This is a problem. networkd and dhcpcd can start its own dhcp clients. Also they might try to set up Network contentions. If you want use NetworkManager make sure that networkd and dhcpcd are disabled and in case of dhcpcd better remove it.
You are already using NetworkManager with dhclient which works often but is also not a default. NM has its own dhcp-client build in. But sometimes the build in dhcp-client follows to rules to strictly, resulting in no connection.
Agreed, it does appear there are multiple processes messing with the hostname. I’ll start there in the morning.
What’s the drop-in for?
This is not from the actual machine but a very similar one, I expect them to be the same. This is not my handy work but part of the Manjaro RPi image. I assume it is just a helper file to keep the startup order correct if one is using openvswitch. However, I am not.
You have a good eye though, I did not notice it.
If you’re not using it…drop it.
Then, just to be sure:
Then restart NM.
I am pretty sure the openvswitch file does not factor into this issue. I am however confident the issue with NetworkManager and its policies or something that can confine/alter those policies. As you can see below, NetworkManager attempts to set the hostname correctly but is blocked by policy. Either its own policy or some other policy set by polkit-1.
I have tried modifying a couple of the relevant files in /usr/share/polkit-1/actions but no success yet. I am still hunting around for the correct file to modify.
I also think this has nothing to do with it.
Since this seems to be a problem in Manjaro ARM, which Device and which image do you use?
I tried it today with a “Raspberry Pi 3 Model B” and “Manjaro-ARM-xfce-rpi4-20.10” image. I used the “First Time setup” via SSH, after reboot did an update and removed the hostname file. After another reboot NM set up the “Transient hostname” without any problems. Even with systemd-networkd enabled but not configured.
Now, that is interesting… hmm. Guess it is time to backup to the beginning and start again. This build did start with the 20.8 image… I’ll try with a clean 20.10 image.
It seems the 20.10 image works as expected. In checking the /etc/NetworkManager directory, I do not see the policy files that my previous image has. Now I am wondering if this is related to my installation of sssd, as it has a reason to protect the hostname from changes. I’ll move forward with my configuration on this image while keeping an eye on that directory and how sssd might effect things.
If it turns out that sssd is the cause, it will be rather ironic, as it is the use of sssd that I need the hostname to change via dhcpd.
For my setup, it seems that all that seems to be required is to delete the /etc/hostname file.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
DHCP client send hostname "linux"
I start by saying that my experience in networking is somewhere between low and medium.
I'm working on a Linux machine with DHCP configured and from tcpdump traces I see that the dhclient send the hostname "linux" in Option 12, Request packages. I verified the files /etc/hostname, /etc/hosts and /etc/dhclient.conf and there's no parameter related to the hostname that have the value "linux". I must specify that I use dhcpcd.
Any help/hint is appreciated since I don't have any ideas where that value is set.
From man 5 dhclient.conf , the config entry is send host-name <...> . It's near the bottom. The example they give is:
But, I doubt you need to put it under an interface section. I would not worry if it's sending Linux , just override it.
It may be being set via systemd. on openSUSE, the manpage for dhclient says it has a -H switch. YMMV.
- I checked the dhclient.conf and there's no send host-name. Only some send fqdn, but with the correct domain name. While in DHCP file from /etc/sysconfig/network there's DHCLIENT_HOSTNAME_OPTION="AUTO". – 23ars Mar 30, 2022 at 8:38
- 1 It doesn't matter whether it's in dhclient.conf or not, just go by what the man page says. That send fqdn id for DDNS, again, look at the manpage. – Bib Mar 30, 2022 at 8:43
- Thankgs, I'll try! – 23ars Mar 30, 2022 at 8:44
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged dhcp dhcpcd or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
Hot Network Questions
- Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers)
- How to handle missing value if imputation doesnt make sense
- BASIC line input buffer location on ZX Spectrum
- Replacing broken pins/legs on a DIP IC package
- Jordan's line about intimate parties in The Great Gatsby?
- QGIS - Countif function
- If a law is new but its interpretation is vague, can the courts directly ask the drafters the intent and official interpretation of their law?
- Mathematica not solving this integral
- About an argument in Famine, Affluence and Morality
- Equations in two lines
- Is there a proper earth ground point in this switch box?
- Nought and Crosses (tic-tac-toe) in C++
- Theoretically Correct vs Practical Notation
- What is the purpose of this D-shaped ring at the base of the tongue on my hiking boots?
- What is pictured in this SHERLOC camera?
- Time arrow with "current position" evolving with overlay number
- Why are Suriname, Belize, and Guinea-Bissau classified as "Small Island Developing States"?
- How do I align things in the following tabular environment?
- The region and polygon don't match. Is it a bug?
- Confusion About Entropy
- How can I explain to my manager that a project he wishes to undertake cannot be performed by the team?
- How to prove that the supernatural or paranormal doesn't exist?
- Short story taking place on a toroidal planet or moon involving flying
- Is a PhD visitor considered as a visiting scholar?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
What is the difference between “Change hostname via DHCP” versus “Assign Hostname to Loopback IP” in SUSE Linux network configuration setup?
I am using SUSE Linux and would like to know, what’s the difference between:
Specifically, what happens if you check both or only check one? Such as when assigning a hostname and domain name with YaST ? It seems like once you make a choice from YaST it cannot be changed again through YaST… At least on this specific item.

First, I don’t believe you can check both options to mix a localhost hostname with a DHCP-based hostname. But the specifics of the options you mention are well explained here ; bold emphasis is mine:
If you are using DHCP to get an IP address, the hostname of your computer will be automatically set by the DHCP. You may want to disable this behavior if you connect to different networks, because they may assign different hostnames and changing the hostname at runtime may confuse the graphical desktop. To disable using DHCP to get an IP address uncheck Change Hostname via DHCP . Assign Hostname to Loopback IP associates your hostname with 127.0.0.2 (loopback) IP address in /etc/hosts . This is an useful option if you want to have the hostname resolvable at all times, even without active network.
Knowing that it can be distilled like this:
Change Hostname via DHCP : This means that your hostname would be determined by what the DHCP server assigns you. Much like if you use an ISP that sets a hostname for your IP address each time you connect like user-1234.some_isp.somewhere .
Assign Hostname to Loopback IP : This would basically just edit the /etc/hosts file to set a hostname that will most likely be your computer name to your local loopback.
As far as personal preference goes, in my experience assigning the localhost loopback hostname via a setting in /etc/hosts is the way most systems work. Which is why—I assume—your configuration screen has that enabled by default.
The whole hostname via DHCP seems like an option one would setup for extremely non-permanent devices that one would not want to routinely access or check on remotely in any way. Just assign a hostname to make it easier to parse through DHCP than just looking at a pile of numbers. If anyone has any better ideas as to why DHCP hostnames would/should be preferable, please comment to explain the benefits; I can’t see the immediate benefit of something like that.
Then you ask this:
It seems like once you make a choice from YaST it cannot be changed again through YaST… At least on this specific item.
Perhaps that is the case. But honestly, Linux is Linux as and as explained on the YaST page itself this can be adjusted; bold emphasis is mine:
There are many supported networking types on Linux. Most of them use different device names and the configuration files are spread over several locations in the file system. For a detailed overview of the aspects of manual network configuration, see Section 21.6, Configuring a Network Connection Manually .
So there goes that; manual override is an option. While manual network configuration can seem daunting, honestly you should be able to adjust and change any network setting you might make in the future. All YaST—or any system configuration tool—would actually do is just tweak plaintext configuration files anyway. So if somehow you want a DHCP-based hostname in the future, read up on how to do that, make the adjustments and see what happens.
- 3 excellent answer. I can't fathom when or why you'd want the DHCP server, let's just say another server, to assign host names...but, different strokes for different folks... To me, that sounds confusing. – Thufir Mar 20, 2015 at 6:54
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged linux networking dhcp localhost yast or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
Hot Network Questions
- FAA Handbooks Copyrights
- Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers)
- How can I find out which sectors are used by files on NTFS?
- Is there any way to orbit around the object instead of a 3D cursor?
- Is there a single-word adjective for "having exceptionally strong moral principles"?
- How can I explain to my manager that a project he wishes to undertake cannot be performed by the team?
- Did any DOS compatibility layers exist for any UNIX-like systems before DOS started to become outmoded?
- Is there a proper earth ground point in this switch box?
- Nought and Crosses (tic-tac-toe) in C++
- Spacing in tuplets (in sheet-music)
- The region and polygon don't match. Is it a bug?
- Does Counterspell prevent from any further spells being cast on a given turn?
- Who owns code in a GitHub organization?
- How to handle missing value if imputation doesnt make sense
- QGIS - Countif function
- About an argument in Famine, Affluence and Morality
- How do I align things in the following tabular environment?
- Why is this sentence from The Great Gatsby grammatical?
- "We, who've been connected by blood to Prussia's throne and people since Düppel"
- What video game is Charlie playing in Poker Face S01E07?
- Does a summoned creature play immediately after being summoned by a ready action?
- Jordan's line about intimate parties in The Great Gatsby?
- Replacing broken pins/legs on a DIP IC package
- What is the correct way to screw wall and ceiling drywalls?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

How to set up security camera hostname via DHCP (example with Axis camera)
In this article, I show how to set up the security camera hostname via DHCP.
I use an Axis camera P3225 MKII and the Open DHCP server as an example.
The following picture shows the camera with the hostname displayed on the top.

The hostname information is offered to the device via DHCP option 12 .
Let's see how it works...
How to set up the DHCP server
A DHCP (Dynamic Host Configuration Protocol) server sends information such as IP , Subnet Mask , DNS, and Default Gateway to a device in the network.
Yeah, that's usually the basic information a device such as a computer or IP camera needs to become a part of the network and navigate the Internet.
But the DHCP server can give much more information to the devices.
It's possible to use options for Hostname, NTP Server, and much more...
These options are configured in the DHCP server and are represented by numbers.
Here are some examples:
- Option 3: Gateway address to be assigned to the clients.
- Option 6: DNS server IP address to be assigned to the clients.
- Option 12: The hostname assigned to the clients.
- Option 33: Classful static routes a client should add into its routing table
- Option 51: The IP address lease.
- Option 53: Identifies the type of the DHCP message.
- Option 55: DHCP client request specified configuration parameters.
- Option 60: DHCP client to identify its vendor.
- Option 66: The TFTP server domain name to be assigned to the clients.

DHCP server option 12 configuration
The configuration varies according to the DHCP server you have available.
You can use a Cisco router or software running on Linux or Windows.
I'm using the Open DHCP Server running on Windows for the tests.
I can specify which IP and hostname the camera gets via its MAC Address.
Here's an example of the server configuration.
[AC:CC:8E:9B:A3:EE]
IP=192.168.0.212
HostName=P3225_MKII
This is the extra configuration that is done beyond the standard one.
It's meant to tell the DHCP server to always give the camera with a specific MAC Address the same IP address and hostname.
DHCP server option 12 test
After configuring the server with the hostname option, you can run a test.
Just connect the camera to the same network as the DHCP server and observe the logs showing the IP and hostname allocation for that device.
The following picture shows the hostname P3225_MKII allocated to the camera.

As you can see, the IP address was allocated as well based on the MAC address.
You can also use Wireshark to check the negotiation between camera and server.
The picture below shows the Host Name offer under Option 12 .

This is the offer and then the client has to accept it.
The picture below shows the ACK (acknowledgment).

And then you have your camera with the IP and hostname set.
But remember that the camera must have the correct configuration to negotiate the hostname and display it as well (as seen in the first picture in this article).
Let's take a look at how to set up the camera.
How to set up the camera to get a hostname
Yeah, I'm using an Axis camera in this example.
The concept is similar for other make/models, but that option may be available or not according to the device you are using. Here, let's see how it work on Axis.
Enable the Network Volatile HostName
You must enable the " Obtain from DHCP " option in the camera.

This option is under the " plain config " menu in an Axis camera.
The location varies according to the model. Here's an example of how you can find this option for two different cameras that use an old and new menu.
For the Old menu (e.g. P3225-V MK II camera)
Go to: Setup > System Option > Advanced > Plain Config > Network .
For the New menu (e.g. P5624-E MKII camera)
Go to: Settings > System > Plain Config > Network .
For both cases, you need to look for the Network Options and ensure the option "Obtain from DHCP" is checked (as seen in the previous picture).
After checking the box, the camera is ready to get the hostname from the server.
Now you need to check if everything is working on the camera side.
How to check the camera hostname
Axis cameras allow you to add overlay text on the screen.
The camera can display information that includes its hostname.
You can use different variables to display such information.
Here's how to display the hostname in the Axis camera (e.g. P3225-V MK II)
- Open the setup menu;
- Go to Video > Video Stream > Overlay Settings;
- Mark the " I nclude Text " checkbox;
- Insert the #n variable in the box;
- Save the configuration.

And now you can see the hostname on the top of the screen.
As long as your setup is OK, you will be able to see the camera's hostname.
And that's all you have to do.
I hope this article can help you.
Video: How to use the DHCP option 12
Here's a video on how to use the DHCP option 12 to give the device the hostname.
Please hit the playback button
Related Articles
How to record Axis Camera on a FTP Server
How to view Axis Camera on a Roku TV
How to Axis Camera to Fire Stick TV
How to add a overlay text to Axis Cameras
How to enable ONVIF on Axis Cameras
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Dynamic Host Configuration Protocol (DHCP)
- 2 minutes to read
- 6 contributors
Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016
You can use this topic for a brief overview of DHCP in Windows Server 2016.
In addition to this topic, the following DHCP documentation is available.
- What's New in DHCP
- Deploy DHCP Using Windows PowerShell
Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway. RFCs 2131 and 2132 define DHCP as an Internet Engineering Task Force (IETF) standard based on Bootstrap Protocol (BOOTP), a protocol with which DHCP shares many implementation details. DHCP allows hosts to obtain required TCP/IP configuration information from a DHCP server.
Windows Server 2016 includes DHCP Server, which is an optional networking server role that you can deploy on your network to lease IP addresses and other information to DHCP clients. All Windows-based client operating systems include the DHCP client as part of TCP/IP, and DHCP client is enabled by default.
Why use DHCP?
Every device on a TCP/IP-based network must have a unique unicast IP address to access the network and its resources. Without DHCP, IP addresses for new computers or computers that are moved from one subnet to another must be configured manually; IP addresses for computers that are removed from the network must be manually reclaimed.
With DHCP, this entire process is automated and managed centrally. The DHCP server maintains a pool of IP addresses and leases an address to any DHCP-enabled client when it starts up on the network. Because the IP addresses are dynamic (leased) rather than static (permanently assigned), addresses no longer in use are automatically returned to the pool for reallocation.
The network administrator establishes DHCP servers that maintain TCP/IP configuration information and provide address configuration to DHCP-enabled clients in the form of a lease offer. The DHCP server stores the configuration information in a database that includes:
Valid TCP/IP configuration parameters for all clients on the network.
Valid IP addresses, maintained in a pool for assignment to clients, as well as excluded addresses.
Reserved IP addresses associated with particular DHCP clients. This allows consistent assignment of a single IP address to a single DHCP client.
The lease duration, or the length of time for which the IP address can be used before a lease renewal is required.
A DHCP-enabled client, upon accepting a lease offer, receives:
A valid IP address for the subnet to which it is connecting.
Requested DHCP options, which are additional parameters that a DHCP server is configured to assign to clients. Some examples of DHCP options are Router (default gateway), DNS Servers, and DNS Domain Name.
Benefits of DHCP
DHCP provides the following benefits.
Reliable IP address configuration . DHCP minimizes configuration errors caused by manual IP address configuration, such as typographical errors, or address conflicts caused by the assignment of an IP address to more than one computer at the same time.
Reduced network administration . DHCP includes the following features to reduce network administration:
Centralized and automated TCP/IP configuration.
The ability to define TCP/IP configurations from a central location.
The ability to assign a full range of additional TCP/IP configuration values by means of DHCP options.
The efficient handling of IP address changes for clients that must be updated frequently, such as those for portable devices that move to different locations on a wireless network.
The forwarding of initial DHCP messages by using a DHCP relay agent, which eliminates the need for a DHCP server on every subnet.
Submit and view feedback for
Additional resources
Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How to get the hostname from a DHCP server
I want Ubuntu to get the hostname and DNS name from a DHCP client. The default installation of Ubuntu 11.10 (Oneiric Ocelot) does not do that.
The same question was asked and is unsolved on Ubuntu Forums .
10 Answers 10
Oli's answer is demonstrably false ("You don't get your hostname from the DHCP server"), as evidenced by the other answers here, and also by my recent experience on a RHEL7 system. Said system got its host name from the DHCP server.
And, indeed, there are things in the DHCP configuration files that are supposed to make it happen. For example:
Is supposed to tell that host that his name is host4.
As it turns out, isc's dhclient DOES NOT APPEAR TO SUPPORT THIS!
However, dhcpcd5 does, out of the box. Stop dhclient, install dhcpcd5, run dhcpcd, renew your lease, and poof, your hostname on your DHCP client is set to the name sent from the DHCP server. No dhclient-exit-hooks.d scripting, no hacks in rc.local , nothing.
As an end-note, I've spent a lot of time trying to get this to work using ISC's dhclient. Absolutely no joy, even when the server sends the host name.
My initial solution to the problem was writing some cute code in rc.local to detect when the network came up and forcing a (in my case) search of /etc/hosts to get the hostname and then running hostname with that host name. It works, but until the network comes up your hostname is probably wrong (when first deploying a host, I remove /etc/hostname , so the host name is localhost until I can run /etc/init.d/hostname.sh start once the network comes up - so when first getting a new name you need to boot twice - once to get your hostname, and once to have that name available when everything starts up...).
- > This option is only honored by dhclient-script(8) if the hostname for the client machine is not set. kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options – Dzintars Apr 23, 2021 at 16:11
There is a way to do it with a little script for a dhcp hook as described here .
Create a new file:
and paste the following code:
Replace eth0 and wlan0 with the names of the interfaces from which you want to obtain the hostname. In most cases eth0 and wlan0 should stay the same.
Make sure it is readable...
That's all. On the next dhcp response your hostname will update automatically.
- 1 this script actually uses a DNS query (using the host command) to extract the hostname associated with the assigned IP address. DHCP servers can actually explicitly set a host name option (option 12), which can potentially be different from the hostname you obtain from a DNS query on the IP (this could potentially also fail, if no PTR record for the IP exists on the DNS) – Ale Feb 12, 2015 at 10:21
Note that when using Ubuntu 18.04 the tie-in scripts are no longer necessary. If the hostname of the install is set to localhost in /etc/hostname the DHCP client will set the hostname automatically at startup using the name issued by DHCP, if present. When running hostnamectl it will list localhost as the permanent hostname, and whatever DHCP issues as a transient hostname.
- This worked for me. Much better than the accepted answer. I also had to add this to dhcpd.conf: use-host-decl-names on; – Michael Fox Aug 11, 2022 at 21:44
You can get your hostname from your DHCP server - it is part of the DHCP specification.
https://www.rfc-editor.org/rfc/rfc1533#section-3.14
"This option specifies the name of the client"
- 4 How do you get the server to send it? – Olathe Oct 24, 2013 at 12:18
d_inevitable's answer almost solved my problem, but not completely. The problem was that although:
The DHCP server was sending a hostname (by adding the
in the dhcpd.conf) and I actually verified it by capturing and analyzing the contents of the DHCP offer with wireshark
The DHCP client was expecting the hostname from DHCP server (by adding
in the dhclient.conf)
The client was not getting a new hostname (easily verified by typing
in terminal and getting the old hostname, or no hostname if I had deleted the contents/file). As a result, the proposed solution by d_inevitable was only copying an empty string.
To solve that, I applied a crud solution, that generally should not be followed unless you are desperate to make it work, like I was.
First, open with edit capability the DHCP client control script:
There, you will have to locate the function
Just use the search and it should come right up. Now, at least on my computer, this function has three if-then-else conditions, encapsulated to each other:
# set host name set_hostname() { local current_hostname if [ -n "$new_host_name" ]; then current_hostname=$(hostname) # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP if [ -z "$current_hostname" ] || [ "$current_hostname" = '(none)' ] || [ "$current_hostname" = 'localhost' ] || [ "$current_hostname" = "$old_host_name" ]; then if [ "$new_host_name" != "$old_host_name" ]; then hostname "$new_host_name" fi fi fi }
Now, what you need is to force the assignment of the new hostname to your host, no matter what. Therefore you want to comment out the two encapsulated if-then-else. The result should look something like:
# set host name set_hostname() { local current_hostname if [ -n "$new_host_name" ]; then current_hostname=$(hostname) # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP #if [ -z "$current_hostname" ] || # [ "$current_hostname" = '(none)' ] || # [ "$current_hostname" = 'localhost' ] || # [ "$current_hostname" = "$old_host_name" ]; then # if [ "$new_host_name" != "$old_host_name" ]; then hostname "$new_host_name" # fi #fi fi }
Now the d_inevitable's or this should work as expected. Hope that helps if you are in a similar desperate frustration as I was.
You don't get your hostname from the DHCP server.
You can send your hostname to the server, which may change the IP you're assigned. You can change what name is sent either by editing your Network Manager connection (the field is called DHCP Client ID) or you can edit (as root) /etc/dhcp/dhclient.conf . Look for the line that says:
... and change <hostname> to whatever you like.
By default Ubuntu will get its DNS settings from the router (if it sends them) but I suspect you're talking about l ocal DNS/mDNS where you can access other computers by their hostname. This is called Ahavi or Zeroconf in Ubuntu and it's installed by default.
You should be able to access your computer by <hostname>.local
- I have dns and dhcp (windows 2008) server on my network. Ant it assigns hostname and dns name to each ip, but ubuntu does not update it's hostname and dns name. I should be able to see this assigned hostname by typing hostname and domain by typing hostname -d . so it's fqdn should be hostname.domain – Oguz Bilgic Feb 17, 2012 at 1:31
- AFAIR if the client is not joined to the Windows domain, the Windows DHCP server will not dynamically update the Windows DNS entries. I'm not really sure though... depends on the Windows DHCP/DNS configuration – oddfellow Feb 17, 2012 at 20:54
- By default 12.04 has this line "send host-name = gethostname();" and you can see that value by typing "hostname" on the command line. By default, this will not have any effect on a windows network. As per the original question. – Móż Nov 22, 2013 at 3:09
- Although zeroconf is installed by default, it's horribly unreliable. I'm frankly surprised when it works, as pinging hostname or hostname.local rarely results in success even though nothing's changed on my network in months. – Cerin Apr 18, 2015 at 19:14
- 2 This is not quite true. While you can send your host name to DHCP server with send host-name "example.com"; in order to obtain a specific IP address, you can just as well request one with request host-name; . – Dmitry Grigoryev Nov 17, 2015 at 10:33
The answer depends on whether or not you are using static leases on your DHCP server. If you are, it is unnecessary to get the hostname from DNS. You can change this line in d_inevitable's solution
But this should happen automatically if your hostname is originally set to localhost.localdomain, so you don't have to write a script. However, if you want to set the hostname to the FQDN, you'll need to change d_inevitable's script to
Again, all this only works if you're using static leases.

If found that can be a dhcpclient scripts bug. http://blog.schlomo.schapiro.org/2013/11/setting-hostname-from-dhcp-in-debian.html
Try to clean $old_host_name on ip renew
echo unset old_host_name > /etc/dhcp/dhclient-enter-hooks.d/unset_old_hostname
Also static /etc/hostname seems to has prority over dhcp answer so leave it empty
> /etc/hostname
Tested on ubuntu 14.04 and dnsmasq server.
Don't have enough reputation to comment, but I'd like to piggy-back on the previous answer as it almost solved the problem for me using a dhclient hook.
I've found that using the standard ISC DHCP Server for some reason, the aforementioned hook outputs a host name with a '.' period character at the end of the hostname for some reason.
So, in the previous answer you might need "cut out" the extraneous period with a sed:
Would become:
First get an IP address for your client from your DHCP server, then you'll find the client hostname in /var/lib/dhcp/dhcpd.leases looks for the client-hostname entries. HTH
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged networking dns dhcp hostname or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
- Announcement: AI-generated content is now permanently banned on Ask Ubuntu
Hot Network Questions
- Stored Procedure Tuning Help
- Acidity of alcohols and basicity of amines
- Has 90% of ice around Antarctica disappeared in less than a decade?
- Can I tell police to wait and call a lawyer when served with a search warrant?
- Do I need a thermal expansion tank if I already have a pressure tank?
- ncdu: What's going on with this second size column?
- What is the point of Thrower's Bandolier?
- If a law is new but its interpretation is vague, can the courts directly ask the drafters the intent and official interpretation of their law?
- Finite abelian groups with fewer automorphisms than a subgroup
- Is it correct to use "the" before "materials used in making buildings are"?
- Movie with vikings/warriors fighting an alien that looks like a wolf with tentacles
- Is there a proper earth ground point in this switch box?
- Wahoo Kickr with 8 speed cassette?
- Topological invariance of rational Pontrjagin classes for non-compact spaces
- Why is this sentence from The Great Gatsby grammatical?
- What is the correct way to screw wall and ceiling drywalls?
- Styling contours by colour and by line thickness in QGIS
- How can I explain to my manager that a project he wishes to undertake cannot be performed by the team?
- Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers)
- How do you get out of a corner when plotting yourself into a corner
- Who owns code in a GitHub organization?
- If you preorder a special airline meal (e.g. vegan) just to try it, does this inconvenience the caterers and staff?
- Is there any way to orbit around the object instead of a 3D cursor?
- Why is there a voltage on my HDMI and coaxial cables?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
How The ISC DHCP Server Derives Host Names
Like most DHCP implementations, the ISC DHCP server supports sending host names in response to a DHCP DISCOVERY message. The host name is sent when DHCP option 12 is requested by the client, and the name is derived from one of two locations:
- The ISC DHCP server will look up the IP address in DNS
- The server will use an administratively defined host name
To configure ISC DHCP to set the host-name option based on DNS data, you can set the “get-lease-hostnames” directive to true:
get-lease-hostnames true;
If you are unable to use DNS to derive the host name, you are still in luck. You can specify the name to assign to the client in a host block:
In the example above, the host name “thecrue.prefetch.net” will be assigned to the client with mac address 00:24:8c:4e:07:f6. If you have a large number of hosts and you want to use the name that is attached to the host directive, you can use the “use-host-decl-names” directive. Here is an example that enables the directive, and defines two hosts that will get their host name from the entry attached to the host directive:
There a couple of additional options that are useful for integrating ISC DHCP with DNS, but I’ll save those for a future post.
This article was posted by Matty on 2009-07-14 23:07:00 -0400 -0400

- Search forums
- Wireless Networking
- ASUS Wireless
- Asuswrt-Merlin
DHCP Hostnames
- Thread starter AdrianH
- Start date Dec 4, 2020
- Tags dnsmasq dhcp host name client name
Occasional Visitor
- Dec 4, 2020
Hi All, I know the stock Asus firmware does not "publish" out the configured client names for DHCP clients. I presume neither does Merlin FW? I am waiting for the alpha builds to go to beta before installing on my RT-AX88U. Once I upgrade though, what is the easiest way to configure client names so that they are "published" for my DHCP clients. I have been reading up about configuring dnsmasq Custom config files · RMerl/asuswrt-merlin.ng Wiki · GitHub and by adding Code: /jffs/configs/dnsmasq.conf.add I can add some entries like so to set the client name Code: dhcp-host=3C:8D:20:...,192.168.2.154,GHubKitchen Question is, can I add a client name just by MAC address, or would I have to include a static IP? Ultimately I would just want to add client names to MAC address and let DHCP assign whatever IP it so wishes. Thanks
ColinTaylor
Part of the furniture.
I have no idea what you mean by "publish out". Also, are you talking about client names (which are just arbitrary names you can assign to clients in the Network Map) or host names (which can be resolved through DNS)? Merlin's firmware allows you to assign a host name to a client when you create a DHCP IP reservation for it (LAN > DHCP Server > Manually Assigned IP...). Stock firmware does not have this feature.
ColinTaylor said: I have no idea what you mean by "publish out". Also, are you talking about client names (which are just arbitrary names you can assign to clients in the Network Map) or host names (which can be resolved through DNS)? Merlin's firmware allows you to assign a host name to a client when you create a DHCP IP reservation for it (LAN > DHCP Server > Manually Assigned IP...). Stock firmware does not have this feature. Click to expand...
I assume that your AdGuard Home query log does a reverse lookup on the client's IP address. If you inserted the client name into DNS that would be the same as defining a normal host name. I believe the problem with trying to use the client name in DNS is that it can contain characters that are not allowed in DNS host names. IMHO it's much better and simpler to not use client names at all and just use hosts names exclusively. That way the same names are used consistently everywhere, both on the router and on the LAN.
ColinTaylor said: I assume that your AdGuard Home query log does a reverse lookup on the client's IP address. If you inserted the client name into DNS that would be the same as defining a normal host name. I believe the problem with trying to use the client name in DNS is that it can contain characters that are not allowed in DNS host names. IMHO it's much better and simpler to not use client names at all and just use hosts names exclusively. That way the same names are used consistently everywhere, both on the router and on the LAN. Click to expand...
I think you're making this more complicated than it is (unless I'm missing something). The names used by ARP, FreshTomato (AFAIK) and AGHome would just be regular DNS host names, not the arbitrary client names used by Asus' Network Map. I don't know what you mean "setting it up in AGHome". I'm not suggesting any changes to AGHome. You could indeed use a custom dnsmasq config to assign specific host names to MAC addresses. But that's just unnecessary complication. You would have to administer them manually by editing the file and make sure that they didn't conflict with anything setup in the GUI. Whether a MAC address has a reserved IP address or not is of no concern to you AFAICT. There is already a GUI page in Merlin's firmware that allows you to easily associate a host (DNS) name with a MAC address so I can't think why you could not use this. Maybe if you install Merlin's firmware what I'm trying to describe will become more obvious.

AdrianH said: I don't mind where I set the names to be honest, was just hoping I could assign names to a MAC address and not IP address. Click to expand...
ColinTaylor said: I think you're making this more complicated than it is (unless I'm missing something). The names used by ARP, FreshTomato (AFAIK) and AGHome would just be regular DNS host names, not the arbitrary client names used by Asus' Network Map. I don't know what you mean "setting it up in AGHome". I'm not suggesting any changes to AGHome. You could indeed use a custom dnsmasq config to assign specific host names to MAC addresses. But that's just unnecessary complication. You would have to administer them manually by editing the file and make sure that they didn't conflict with anything setup in the GUI. Whether a MAC address has a reserved IP address or not is of no concern to you AFAICT. There is already a GUI page in Merlin's firmware that allows you to easily associate a host (DNS) name with a MAC address so I can't think why you could not use this. Maybe if you install Merlin's firmware what I'm trying to describe will become more obvious. Click to expand...
john9527 said: make a /jffs/configs/dnsmasq.conf.add with the following lines (use the dhcp-host directive and just leave out the ip address) dhcp-host= mac_address,hostname make sure you follow the rules for dhcp hostnames and not the 'take everything' network names Click to expand...

EventPhotoMan
Very senior member.
What about custom_clientlist in /jffs/nvram/ ?
- Apr 6, 2021
Similar threads
- Started by Igor
- Feb 23, 2023

- Started by RocketJSquirrel
- Feb 20, 2023
- Started by aiwaxxx
- Feb 19, 2023
- Started by Rici
- Feb 15, 2023
- Replies: 31
- Started by jjones7791
- Jan 31, 2023
- Started by seabass
- Jan 24, 2023
- Started by TheScotsman
- Jan 20, 2023

- Started by drinkingbird
- Jan 19, 2023
- Jan 16, 2023
- Replies: 24
Latest threads
- Started by Jack Yaz
- Today at 3:23 PM

- Started by TheLyppardMan
- Today at 9:59 AM
- Started by n00bftwin
- Today at 9:23 AM

- Started by Protik
- Today at 1:09 AM
- Started by cc666
- Yesterday at 10:16 PM
Sign Up For SNBForums Daily Digest
Members online.
- maxbraketorque
- ivooliveira
- Webheadfred
- Paul Smedley

Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts , Ranker and plenty more!
- This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register. By continuing to use this site, you are consenting to our use of cookies. Accept Learn more…
- Network management and monitoring

Getty Images/iStockphoto
A guide to Windows DHCP server configuration
The main steps to configure DHCP on Windows Server are installation, Active Directory authorization, creating a scope and DNS registration. Learn about other tasks and best practices.

- Damon Garn, Cogspinner Coaction
Network nodes require an IP address configuration that usually comprises the IP address, subnet mask, default gateway IP for the router, name servers and other values.
Administrators can manually set this information, resulting in a static configuration. A Dynamic Host Configuration Protocol (DHCP) server can also dynamically provide the information.
Generally, servers, routers, network printers and other such devices have a static configuration. Workstations, laptops, phones, tablets and other end-user devices receive their configuration via DHCP.
Client devices lease their IP address configuration by using the following four-step DORA process:
- Discover. The client broadcasts an attempt to discover a DHCP server.
- Offer. DHCP servers that receive the client broadcast offer an IP address configuration.
- Request. The client formally requests the IP configuration from the first DHCP server to respond.
- Acknowledge. The DHCP server acknowledges the lease and doesn't offer that same address to another client.
The lease must be renewed by the client periodically.
Now that we've briefly reviewed how IP addresses are allocated and the lease generation process, let's delve into more detail about how to configure the Windows Server DHCP service.
1. Install DHCP on Windows Server 2019
The DHCP service is not automatically installed on Windows Server 2019. It is easy to add, however, using either Server Manager or Windows PowerShell.
To add DHCP using Server Manager, select Add Roles and Features , and then select DHCP in the Roles list.
To add the DHCP role using the command line, open Windows PowerShell (Admin), and type the following:

The installation takes about one minute to complete.
Once admins install the DHCP service, they can manage it by selecting Tools > DHCP.
2. Authorize DHCP in Active Directory
Windows-based DHCP servers must be registered with Active Directory ( AD ) before they begin offering IP address configurations to clients.
Right-click on the server node in the DHCP console, and select Authorize to accomplish this authorization. You need Enterprise Admin privileges to authorize DHCP.
3. Create a scope
Before building the first pool of available IP addresses, it's critical to plan the deployment. Devices, such as servers, routers and even printers, may have static IP address configuration. Make sure you have identified these addresses and that you allow for them in scope. Many administrators place all statically assigned IP addresses at the front of the scope.
Here is a simple example design:
- Scope address range: 192.168.2.0/24
- Static IP addresses: 192.168.2.1 through 192.168.2.25 (be sure to leave some room for additional devices)
- Dynamic IP addresses: 192.168.2.26 through 192.168.2.254
You also need to gather additional configuration details, including the following:
- Name and description. The scope name and an optional description.
- Default gateway value. The IP address of the network interface card in the router attached to this network.
- Name resolution servers. The IP address of one or more DNS servers .
- Reservations. Any IP addresses that are dynamically allocated to specific clients, enabling those clients to acquire a consistent IP configuration from DHCP.
- Lease time. The time the IP address lease is valid. It needs to be renewed at the halfway point of the lease. The Windows Server DHCP default is eight days.
4. Configure and activate the scope
Once you have documented the above values, you can configure the scope. Right-click the server node in the DHCP console, and then select New Scope . A wizard prompts you for the information you collected above. These settings can be changed later.

Once activated, the DHCP server begins responding to DHCP client discover messages by offering IP addresses. The scope can be deactivated, the DHCP service can be stopped or restarted, and the DHCP server can be deauthorized in AD.
5. DNS registration
DNS relates easy-to-remember hostnames with difficult-to-remember IP addresses. This database can be populated in several ways.
One method is to configure the DHCP server to create resource records for the client. The DHCP server can be set to create A records (hostname to IP address), pointer (PTR) records (IP to hostname) or both.
The default is for DHCP to create the PTR record, while the client itself registers its record with DNS.

Administrative DHCP tasks
The DHCP service is simple to configure. But sys admins often find some additional settings to be useful.
Create reservation
In some cases, it's useful to allow a client machine to maintain a consistent IP address. While you could set the IP address configuration statically, it's often better to reserve the IP address for the client in DHCP. The client goes through the DORA process to receive its settings, so values, such as router and name resolution servers, can still be updated via DHCP.

DHCP failover
With Windows Server 2012, Microsoft introduced DHCP failover . It seems many administrators are unaware of this capability. Configuration is straightforward and requires no special software.
To configure DHCP failover , use the following steps:
- Ensure the DHCP role is installed on both DHCP servers and that they have network connectivity with each other.
- Configure a DHCP scope on one of the servers.
- Right-click the scope, and select DHCP Failover from the context menu.
- Complete the wizard.
- Select the second DHCP server, and observe that the new scope appears.

Managing service log files is a standard function for sys admins. DHCP writes messages to Event Viewer and to text files.
Sys admins can check the system log for general DHCP and network messages. They can find DHCP entries by drilling down to Applications and Services > Microsoft > Windows > DHCP-Server > Microsoft-Windows-DHCP-Server-Events > Operational.
DHCP also generates text-based log files stored at C:\Windows\System32\dhcp. These logs are extremely useful for troubleshooting . They can display information for why the server was unable to lease configurations to clients.

Note that the text file logs are named based on days of the week and are overwritten weekly. If you want to retain these logs, you must rename them before the upcoming day of the week can overwrite them.
The DHCP role is not installed by default, so the first step is to add it. From there, create a new scope based on your plan.
Be careful of conflicting scopes
As more subnets -- and, therefore, more DHCP scopes -- are added to the network, it's imperative that sys admins accurately document the IP address ranges. Overlapping scopes, where two DHCP servers are offering the same IP addresses to clients, result in a variety of network communications issues.
This is part of the reason why Microsoft requires DHCP servers to be authorized in AD. That authorization can only be implemented by Enterprise Admins, who should have enough broad knowledge of network configuration to prevent conflicting scopes.
Avoid duplicate IP address offers
One of the most serious misconfigurations is a client computer configured with a static IP address that falls within the DHCP server's scope. In that case, the server can offer the IP address to a client because it is unaware of the static IP. This results in an IP address conflict.
The Windows DHCP service can be configured to ping an IP address before offering it to a client. If the ping returns a response, the DHCP server knows the address is already in use and should not be offered. The server offers a different address to the client.

The ping request occurs between the Discover and Offer steps of the lease generation process. It introduces a significant delay, so only configure this setting if you have a real concern about undocumented static IP addresses on client devices.
Microsoft has made the configuration of a DHCP server straightforward. Make sure you have a solid understanding of the entire network's IP address configurations before you begin and plan your scope around both dynamic and static IP address assignments.
The DHCP role is not installed by default, so the first step is to add it. From there, create a new scope based on your plan. Add any options, such as DNS and reserved addresses. Review log files regularly. DHCP is simple but critical for network communication.
Comprehensive PowerShell guide for new and seasoned admins
Dig Deeper on Network management and monitoring

DHCP (Dynamic Host Configuration Protocol)

Automatic Private IP Addressing (APIPA)

Configure DHCP failover for Windows Server

DHCP client configuration for Linux, Windows and macOS
Part of: DHCP configuration and troubleshooting
Static IP addresses are typically used for servers, routers and switches. Dynamic IP addresses, however, are commonly used for workstations, phones and tablets.
Network and system admins can use command-line and GUI tools to configure DHCP clients in Linux, Windows and macOS. Here's a breakdown of which commands to use for each OS.
DHCP errors often result from DHCP server failure, a lack of available IP addresses and network failure. But troubleshooting steps vary depending on the error symptoms and causes.
More organizations are adopting ESG initiatives, and UC vendors have begun to offer new programs and capabilities in response. ...
The tech giant's $10 billion investment in OpenAI brings AI-supported updates to its basic Teams offering, on top of features ...
The new platform moves to the modern cloud infrastructure and offers a streamlined inbox, an AI-supported writing tool and ...
Configuration profiles make it easier to manage BYOD iPhones, but they're also associated with malware. Mobile security policies ...
User Enrollment creates a management profile for BYOD iPhones, but IT must remove that data in cases such as device loss or theft...
User Enrollment in iOS can separate work and personal data on BYOD devices. IT teams should learn how to enable it in Microsoft ...
Linux admins can use Cockpit to view Linux logs, monitor server performance and manage users. Use the tool to help admins manage ...
Hyperscale data centers can hold thousands of servers and process much more data than an enterprise facility. However, they can ...
Organizations that build 5G data centers may need to upgrade their infrastructure. These 5G providers offer products like virtual...
Software and services companies are adding personnel and expanding their offerings, as venture funds invest in tech startups with...
Businesses working with aging network architectures could use a tech refresh. While the easing of equipment backlogs works in ...
Industry studies underscore businesses' continuing struggle to obtain cloud computing benefits. A greater focus on strategy, ...

IMAGES
VIDEO
COMMENTS
Initial configuration of DHCP1 consists of the following steps: Install the operating system and configure TCP/IP on DHCP1 Install AD DS, DNS Server, and DHCP Server Create a domain administrator account Create a DHCP scope on DHCP1 Install the operating system and configure TCP/IP on DHCP1
I want to use DHCP server to dynamically assign host name to my clients using 012 tag. I have made a reservation based on clients mac id for ip and hostname I have not added computer name to my unattend.xml file. But somehow my client computers do not take hostname dynamically.
With ISC's DHCP server, which is freeware and included in most Linux distributions, you can create a setup with a filter list that allows only clients sending specific option 12 values (hostname option) and denies the rest. However, there is absolutely no security around this.
Right-click the DHCP lease, and then select Add to Reservation In the left pane, select the Reservations in the scope where the device has a DHCP lease Right-click the Reservations, and then click Configure Options Select option 012 Host Name and enter the name of the device in the Data entry field Verify the information is correct and click OK
There is nothing in the ESX setup that specifies (at least none that I can see) a host name. After install is complete, a DHCP-assigned address is present, but so is a host name, and that hostname is sometimes a duplicate of other host names. It's not always the same, but a host name that is a copy of an existing host name is there.
I can assign "Jonathan-Linux.local" to 192.168..12 for example, but it won't change automatically when the IP address of my computer automatically changes. How do I assign it to an IP address that changes by DHCP? Not sure that it would work to assign the DNS name of 127.0.0.1.
Running Centos 6.x using dhcp, we want to set the hostname to be FQDN that's obtained from a combination of dhcp options. As an example if I have two dhcp options option host-name "foobar"; option domain-name "mydomain.com"; When a client obtains those options via dhcp I would like the hostname to show "foobar.mydomain.com".
Although there is a DHCP option for setting client hostname, most clients do not support it. What you can do is have the DHCP clients+server work together to register the hostnames in DNS. This is easy to set up with Windows server, but it's buggy with pfSense since the DNS service needs to be reloaded every time an A record is added, which can ...
In Dnsmasq, if you can edit the config file directly, you can specify a hostname for dhcp clients as follows: dhcp-host=f8:da:0c:0a:af:c9,192.168.1.222,SpecialMachine,30d This will assign client with the MAC address f8:da:0c:0a:af:c9 the IP 192.168.1.222, the hostname "SpecialMachine" and a DHCP lease time of 30 days. [Apologies.
Accepting the hostname assigned by DHCP should be the default… but it is not or it does not function properly or one of the other systemd services is resetting it. Sure wish we still lived in the day of, do one thing and to do it well. How to set the hostname assigned by DHCP server? fallback-hostname breaks transient hostname
While in DHCP file from /etc/sysconfig/network there's DHCLIENT_HOSTNAME_OPTION="AUTO". - 23ars Mar 30, 2022 at 8:38 1 It doesn't matter whether it's in dhclient.conf or not, just go by what the man page says. That send fqdn id for DDNS, again, look at the manpage. - Bib Mar 30, 2022 at 8:43 Thankgs, I'll try! - 23ars Mar 30, 2022 at 8:44
To disable using DHCP to get an IP address uncheck Change Hostname via DHCP. Assign Hostname to Loopback IP associates your hostname with 127.0.0.2 (loopback) IP address in /etc/hosts. This is an useful option if you want to have the hostname resolvable at all times, even without active network. Knowing that it can be distilled like this:
Q. My DHCP server configured to assign static IPs to few Debian / Ubuntu Linux boxes using hostnames. My Windows 2000 and XP client computer sends hostname automatically. How do I send my hostname under Linux using dhcp client? A. By default, the DHCP server requests the subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers and host-name […]
For the New menu (e.g. P5624-E MKII camera) Go to: Settings > System > Plain Config > Network. For both cases, you need to look for the Network Options and ensure the option "Obtain from DHCP" is checked (as seen in the previous picture). After checking the box, the camera is ready to get the hostname from the server.
Deploy DHCP Using Windows PowerShell Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway.
You don't get your hostname from the DHCP server. You can send your hostname to the server, which may change the IP you're assigned. You can change what name is sent either by editing your Network Manager connection (the field is called DHCP Client ID) or you can edit (as root) /etc/dhcp/dhclient.conf. Look for the line that says:
The host name is sent when DHCP option 12 is requested by the client, and the name is derived from one of two locations: The ISC DHCP server will look up the IP address in DNS. The server will use an administratively defined host name. To configure ISC DHCP to set the host-name option based on DNS data, you can set the "get-lease-hostnames ...
with the following lines (use the dhcp-host directive and just leave out the ip address) dhcp-host=mac_address,hostname make sure you follow the rules for dhcp hostnames and not the 'take everything' network names
One method is to configure the DHCP server to create resource records for the client. The DHCP server can be set to create A records (hostname to IP address), pointer (PTR) records (IP to hostname) or both. The default is for DHCP to create the PTR record, while the client itself registers its record with DNS. Configure DNS options.