Frequently Asked Question
Add a hosts entry for local resolution
Last Updated about an hour ago
Answer
To add a hosts entry that resolves local.example.gen to 192.168.128.10 on Windows 10, Windows 11 or Windows Server 2025, follow these steps:
- Open Notepad as Administrator
- Search for Notepad in the Start menu.
- Right‑click and choose Run as administrator. This is required because the hosts file is protected by system permissions.
- Open the hosts file
- In Notepad, click File → Open.
- Navigate to C:\Windows\System32\drivers\etc\.
- Change the file‑type dropdown from Text Documents (.txt) to All Files (.*) so you can see hosts.
- Select hosts and click Open.
- Add the entry
192.168.128.10 local.example.gen
- Scroll to the bottom of the file (or to an empty line) and add the following line exactly as shown:
- Ensure there is at least one space (or tab) between the IP address and the hostname.
- Save the file
- Click File → Save (or press Ctrl + S).
- If you receive a permission error, confirm the UAC prompt and save again.
- Flush the DNS cache (to apply the change immediately)
ipconfig /flushdns
- Open Command Prompt as administrator (right‑click Start → Windows Terminal (Admin) or Command Prompt (Admin)).
- Run:
- Verify the resolution
ping local.example.gen
- Open a new Command Prompt (no admin rights needed).
- Ping the hostname:
- You should see replies from 192.168.128.10.
- Alternatively, use
nslookup local.example.gento confirm the IP returned.
- Troubleshooting tips
- No effect after editing – double‑check that Notepad was run as administrator and that the file was saved correctly.
- Incorrect IP returned – ensure there are no stray characters, extra spaces, or duplicate entries for the same hostname.
- Ping fails – verify that the target device (192.168.128.10) is reachable on the network and that no firewall is blocking ICMP.
What to check next
- Confirm that the hostname local.example.gen is not already defined elsewhere (e.g., in DNS or another hosts entry).
- Ensure the IP address 192.168.128.10 is assigned to the correct network interface on the target machine.
Following these steps will add a permanent local DNS entry for local.example.gen on any Windows 10/11/Server 2025 system.
