How to give a domain name to a local ip?

26,699

The clue is in the question: Domain name. For this to resolve, you'll need to have a local server that'll resolve this for you, instead of passing the request on to the internet.

Option 1: Set up a local DNS server that all of your computers use. This DNS server has an entry for your Pi, so that any requests to its domainname/hostname will result in looking up a local IP. Any other requests gets passed on upstream.

Option 2: If your router/gateway (presuming you have one) supports it, you could have it act as the DNS server mentioned in Option 1.

Option 3: You could edit the hosts-file to include an entry for your Pi. This will have to be done on all other computers on the network that want to be able to do the same lookup as well.

Once upon a time I did Option 1 myself. I already had a webserver with DNS running on it, so it was simple to just add another entry. I'm currently using Option 3.

PS: There might also be other platform-specific alternatives available.

Share:
26,699

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I have a Raspberry Pi with a local ip address of 192.168.2.x (where x is a number).

    To make it easier to remember, I want to give it a domain name like mediacenter.raspberrypi. It is a domain name that should only work on my own network, or only on my own pc if that doesn't work.

    How can I do this?

    Thanks in advance.