Local unbound allows to set your specific records , for your PC.Many, many years ago I set up an "authoritative" domain with a bogus TLD .home. For multiple reasons, the first was that I wanted to learn about DNS and how it worked. The second reason was to have something I could use for my homelab to register all sorts of services, hostnames and whatnot, without actually having to properly register a domain. And the third reason was that FreeBSD had BIND named in the base at that time. So I had all the tools I needed already available to me.
Should still be fine to use as a TLD. Then set up something like balanga.home. And you can create A (and/or AAAA) records for myserver.balanga.home for example. Not suggesting setting up BIND but there are other (probably easier to use) alternatives.
Or, you could go with a hosts file option of course, but the downside of it is that you have to distribute that hosts file to every computer on
That's exactly what I'm looking for. I want a simple solution. I'm running in a jail so would like to access the server from anywhere on my network.The way you have written "ServerName" makes me think you mean Apache Web Server -- and you can add a DNS entry your local DNS server zone file or to a local /etc/hosts file. Though on local LANs a lot of people are (also?) using Zero Conf solutions these days like mdns.
Using IP address works, but I'd like to use a hostname. Getting assigned by the network would be my preferable solutionNot sure.. (by my read?) was the OP wanted (other hosts) on his LAN or network to locate his web sever. 127.0.0.1 will work find if you are just running a local web server you only plan to use with your FreeBSD host.
Change: 127.0.0.1 to the IP Address to the desired Ethernet/Wifi/etc card if you want to allow other hosts to be able to access it. Also remember to punch a firewall hole using PF (or similar) if you are using a firewall.
While that would give the host a proper hostname and IP address, that relationship (hostname to IP address) isn't known to any other computer on your network. That's what DNS is for. Didn't you recently set up dnsmasq? You can set up an 'authoritative' DNS with that too.I do have a dhcp server and I would try assigning an IP address and hostname via MAC address, but don't know if I can do that in a jail.
Yes I have dnsmasq running, but have only set it up for assigning IP addreses for known MAC addresses. I don't know if I can do that with jails.While that would give the host a proper hostname and IP address, that relationship (hostname to IP address) isn't known to any other computer on your network. That's what DNS is for. Didn't you recently set up dnsmasq? You can set up an 'authoritative' DNS with that too.
I would need to maintain a hosts file on every system on my network.
The problem I'm having is knowing how to set an IP address for a jail since it does not have a MAC address.I run local DHCP and DNS with a made up home domain. For my static IPs I let the DHCP server set a fixed address (name) based on the mac address of the device connecting and then that name is being translated to an ip by the DNS server.
This is to have all devices on DHCP but still control what devices that get static IPs (or not).
/grandpa
I am using dnsmasq which is a dns server but not sure how to assign hostnames to specific IP addresses.You could install one central dns server , it will consolidate all /etc/hosts files , then redirect all dns request on all servers to it.
Central configuration.
I'm not a network and FreeBSD expert, but for mine homelab I used:The problem I'm having is knowing how to set an IP address for a jail since it does not have a MAC address.