If you're happy to give the pi zero a static address, do the following:
1)Add a line something like:
192.168.0.n pi0name pi0name.localdomain
to /etc/hosts on the Pi zero - where 'n' is an unused IP in the
168.192.0 subnet and 'pi0name' is whatever unused host name
you want to give it.
2)Now make sure that /etc/hosts contains a single line containing the
host name you've given
3)Make sure that /etc/resolv.conf has a "nameserver" line that
contains the correct IP of your favourite nameserver (in the UK
that would typically be one provided by your ISP).
4)Then reboot the Pi zero.
"ssh 168.192.0.n" should now connect to the Pi zero provided that your
wifi router is configured to support the 168.192.0 subnet, and it should
be able to connect to external hosts.
The rest of this post assumes that, like me, you are running Linux on
your other computers - if you're not the following advice will need
adjustment to work under other operating systems but, once adjusted to
suit them, should also work.
- If you want to be able to use scp, ssh ftp, etc to connect
to other hosts from the Pi zero (you probably will, particularly if
you're planning to run a version control system for your pi-zero
project, just add additional "168.192.0.ip hostname" lines to the Pi
zero's copy of /etc/hosts for the other local machines you need to
contact from it and add the "168.192.0.n pi0name" line to /etc/hosts on
the machines you want to contact the Pi zero from.
Its good practice to maintain a master copy of /etc/hosts
that contains the IP and name of every local machine and simply
replicate it onto every host on your Lan - this lets all your
machines talk to each other.
I used to work that way. By and large it 'just worked'. Now I run a
local DNS on my house server. This is no better or worse than
distributing /etc/hosts files except that when you have more than 3-4
hosts on the LAN it starts to make sense to use a local DNS as a
central reference point.
Your router may also have a configurable DHCP system in it that can be
used to assign names and specific IPS to computers, but you'll need to
read its manual to find out whether it can do this and, if so, how to
set it up. While you're doing that, you may want to work out how to
lock the router down to keep intruders out because, although your other
machines may have firewalls, to Pi zero probably doesn't and you really
don't want to find out that its just become a member of some blackhat's
botnet.
--
Martin | martin at
Gregorie | gregorie dot org