Web lists-archives.com

Re: changing local domain name




David Wright wrote:
>> If you lease a public domain name, there is no real
>> difficulty about using it also in a private network, just a matter of
>> making sure that external resources using the name can also be found in
>> local DNS or hosts files.
>
> If you could elaborate. Say I have leased example.org, currently at
> 93.184.216.34, and apart from what's out there on the Internet I have
> hosts foo.example.org at 192.168.1.2 and bar.example.org at 192.168.1.3
> with a router at 192.168.1.1. What do I need to do? For simplicity, I
> use dhcp from the router which also has no DNS server. So /etc/hosts.

Assuming that you want to connect to "foo.example.org" from somewhere
else on the internet, you use DNS to do the "foo.example.org =
93.184.216.34" translation (if 93.x is static, your registrar's DNS
servers are fine.  If it's not, a dynamic service like no-ip.com,
afraid.org, or similar).  Then you use DNAT on your router to do the
translation for "93.184.216.34, port 80 => 192.168.1.2, port 80"

Now, you'll run into problems since DNAT can only use one target IP
address / port combination to forward (so, hosts foo and bar CANNOT both
be forwarded to by triggering the router on destination port 80).

On the other hand, if you're only concerned about hosts INSIDE your
network (and don't necessarily need them accessible from the public
internet), you have two options:

  1. Manually set /etc/hosts entries on your devices. OR
  2. Run your own DNS server (bind, unbound, others).

The first option is simpler, but a real pain in the neck after a dozen
hosts or so.  It also will likely fall over if some of your hosts are
phones / tablets (although, I've never really bothered looking into the
tools for them).

The second option is more involved, but it's also not terribly hard (I
mean, I set it up in a weekend between reading the manpages, and some
tutorials).  However, spending a weekend or three setting it up means
you never have to go through *that* particular headache again -- you
just point all your hosts at it (of course, don't forget to make your
backups!).

-- 
|_|O|_| Registered Linux user #585947
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5  4AEE 8E11 DDF3 1279 A281