defining
Posts: 39
Joined: Tue Mar 08, 2016 9:44 pm

Local DNS

Wed Aug 15, 2018 5:47 pm

Hi,

For the moment, I can access (LOCALLY) my raspberry pi by typing "192.XX.XX.XX:8080" on my Mac computer.

I would like to know if it is possible to give a name instead of number. For example "myraspberry" or even "myraspberry.com" since we are in local.

DirkS
Posts: 8823
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Local DNS

Wed Aug 15, 2018 5:51 pm

Assuming zeroconf / bonjour is already installed on your Mac you should be able to use 'myraspberry.local' already

defining
Posts: 39
Joined: Tue Mar 08, 2016 9:44 pm

Re: Local DNS

Wed Aug 15, 2018 6:02 pm

"myraspberry" was just a random example lol.

Could we give a name "ImAKing" for example?

User avatar
rpdom
Posts: 12737
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Local DNS

Wed Aug 15, 2018 6:07 pm

Alternatively, if it is just the one computer that will be accessing the Pi, you can put an entry in the /etc/hosts file (I think it's still called that in MacOS) for 192.168.x.y and iamaking.

DirkS
Posts: 8823
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Local DNS

Wed Aug 15, 2018 6:07 pm

defining wrote:
Wed Aug 15, 2018 6:02 pm
"myraspberry" was just a random example lol.
I did realise that...
Could we give a name "ImAKing" for example?
mDNS / Bonjour / Zeroconf / Avahi uses the hostname of your computer and then adds '.local;
The default hostname on Raspbian is 'raspberrypi' so you can access it with 'raspberrypi.local'

defining
Posts: 39
Joined: Tue Mar 08, 2016 9:44 pm

Re: Local DNS

Wed Aug 15, 2018 8:14 pm

rpdom wrote:
Wed Aug 15, 2018 6:07 pm
Alternatively, if it is just the one computer that will be accessing the Pi, you can put an entry in the /etc/hosts file (I think it's still called that in MacOS) for 192.168.x.y and iamaking.
in /etc/hosts we can only change the name if we loopback (So, if I'm in my raspberry, I can change the name when it refers to itself) but not if I'm using another computer (locally of course)

bertlea
Posts: 162
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Re: Local DNS

Thu Aug 16, 2018 2:45 am

in /etc/hosts we can only change the name if we loopback (So, if I'm in my raspberry, I can change the name when it refers to itself) but not if I'm using another computer (locally of course)
No, it should work for mapping a name to any IP on that local machine, not only its own (loop-back). I think rpdom meant if you put that name in your Mac, you can use that name to access the Pi from this particular Mac. Other machine still need to use the IP if they didn't change the hostname file for that.

User avatar
rpdom
Posts: 12737
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Local DNS

Thu Aug 16, 2018 5:35 am

bertlea wrote:
Thu Aug 16, 2018 2:45 am
I think rpdom meant if you put that name in your Mac, you can use that name to access the Pi from this particular Mac.
Exactly. Hence my reference to /etc/hosts under MacOS. I'm sure it can be done. Almost everyone else in my office uses Macs, and I'm sure some of them have updated hosts files.

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 5 guests