Absolute beginner on RasPi WiFi

Hello! : a stupid question:

I would like connect my RasPis in domestic lan, using only the "hostname" of RasPI, not his IP address (static).

I have a desktop with an static IP and another with DHCP; on the first one, i must enter only the IP address (es. 192.168.0.151), on second i can connect also with hostname (es. pi151).

How can i repair?

Thanks in advance!

Claudio.

Reply to
Sberla
Loading thread data ...

You need sonme sort of name resolution. DNS or perhaps netbios. Put the pi on a static IP address.

I do not know how you are resolving pi151 into an IP address.

The problem is there are more than one strategy you can use, and its lttle to do with a raspberry pi and a whole lot about designing and configuring a private IP network.

This isnt hard, but its not trivial for a beginner.

formatting link

is not a bad place to start

--
"In our post-modern world, climate science is not powerful because it is  
true: it is true because it is powerful." 
 Click to see the full signature
Reply to
The Natural Philosopher

Possible approaches. These are all ways to attach names to the things on your local network, i.e. give a unique name to your router, PCs, RPis, network-attached printer(s) etc. When reading the following, note that my LAN is all wired, so I haven't tried any of this with wifi.

1) some DHCP systems will let you assign a name and IP address to every device (PC, RPi, printer, router...) attached to your network.

Whether this would work for you depends on the DHCP server. Yes, there is usually one in an ADSL modem/router but not all of them support an ability to link a name to an IP address and, unless it will allow you to configure it with the hardwired ID of the network chip, you'll need to assign a fixed IP to everything on the network.

2) Don't use DHCP at all: configure everything to use a static IP address. This is done by editing a text file, /etc/hosts by extending it to include the name and IP of everything on your LAN and then putting a copy of that file on every PC and RPi on you network.

This is used as a lookup table to convert the hostname into an IP and then connect to the IP.

This is simple to do, but tiresome to manage if there are more than 4-5 machined on the LAN

3) Don't use DHCP at all: decide which is the master PC or RPi on your LAN, ideally something that runs 24x7, and set up a DNS server on it as the authoritative source for IP addresses for your LAN. Effectively you give it the same information as goes into /etc/hosts if you use solution (2) but now its only held in one place.

This probably has the steepest learning curve of the three, but requires the least maintenance.

The most commonly used DNS servers are called 'bind' and 'unbound', and are standard packages for almost all Linux versions, so installation is dead simple: its just getting the moderately complex configuration right that has the learning curve.

Of the above, I'd say (2) is easiest to understand. (3) is probably the hardest, and (1) might be easy, hard or not do what you want: it all depends on which DHCP support is in your router and/or of you decide to install the Linux DHCP package. My router is configured to be invisible from the outside and to support unnamed/visitor's devices via DHCP. Everything that is permanently resident on my LAN has a fixed IP address. I run bind, the DNS server, on my 24x7 house server to provide a naming service for permanent LAN residents.

HTH

--
Martin    | martin at 
Gregorie  | gregorie 
 Click to see the full signature
Reply to
Kiwi User

You may edit a file named "hosts". It is a lookup table to translate names to IP adresses. This file is referenced before DNS lookup is used.

The hosts file actually is a table with at least two columns per numeric IP address. Usually it start with

127.0.0.1 localhost ::1 ip6-localhost ip6-loopback

The second line has three columns to make two words translate into one numeric IP Adress.

So you need to append

192.168.0.151 pi151 to your hosts file.

The location of this file depends on the operating system. Windows: %windir%\system32\drivers\etc Linux: /etc

HTH norbert

Reply to
Norbert Hahn

For small networks there's dnsmasq which is much lighter and simpler to manage than either bind or unbound (it uses hosts files not zone files).

--
Steve O'Hara-Smith                          |   Directable Mirror Arrays 
C:\>WIN                                     | A better way to focus the sun 
 Click to see the full signature
Reply to
Ahem A Rivet's Shot

Thank you Nobert, I edited the "host" file and: resolved. Simple and effective!

Reply to
Sberla

Il 29/12/2017 19:03, Sberla ha scritto:

Thank you so much to all of you!

I have not only solved my little immediate problem, but also I threw a look over the wide networking field. I still have a lot to learn.

Happy New Year to You and your families.

Reply to
Sberla

The difference is probably that the one with a static ip also has a fixed external dns (from your isp or google etc), while dns queries of the one with dhcp get handled by your router: external ones relayed to your external dns and local queries translated to the right computer in your lan, which is what you want. So you might be able to fix it by changing the dns address of the static ip computer to your router?s address.

You might also be able to reach local hosts by name if both ends and your router support zeroconf / avahi / bonjour. For the rpi, it?s in the standard repo under ?avahi? and for Windows you can install Apple Bonjour, but like I said, your router must be able handle it (mDNS). Every modern router does, afaik, but I have an old cable modem here which doesn?t.

Reply to
A. Dumas

A compromise could be to edit the /etc/hosts on one machine and make all the others copy it over automatically, e.g. at every boot time, or copy it from the cental machine to all the others after each edit using a small script. The latter rquires write access and might be a security issue.

--




/ \  Mail | -- No unannounced, large, binary attachments, please! --
Reply to
Axel Berger

When I worked on big systems, networking was a black art. Our large site had two specialists who worked with it, and nobody else knew what they did. The Internet put all that into the hands of people like us. Happy New Year, all.

Reply to
Mel Wilson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.