[SWLUG] setting up a local network using avahi (bonjour)
Daniel Morris
danielm at iee.org
Tue Mar 3 22:08:32 UTC 2009
On Tue, Mar 03, 2009 at 01:51:50PM +0000, Mark Summerfield wrote:
> Hi,
>
> Could anyone tell me how to set up nice avahi (bonjour) networking?
>
> I have a router with 3 network cables: to a desktop, to a Linux laptop
> and to a macbook.
Does your router have built in name services? Can you populate a webpage
with MAC-id, network addresses & names? You basically have a star
network with the always-on router at the hub.
> Usually I have the desktop on and only one or other of
> the laptop and macbook -- so they normally end up with the same IP
> address. I want to ssh and scp between the machines and I want them to
> have names I can remember. I told the macbook in the sharing dialog that
> its avahi name is mac.local, but I have no idea how to do the equivalent
> in Fedora 10 (desktop) or Kubuntu 8 (laptop).
>
> Is there some nice easy (safe) way to give each machine a nice unique
> avahi name so that I can happily do ssh mac.local and ssh destkop.local
> etc. without having to care about the IP addresses?
I don't know about the avahi part, but just today I've setup[1] the
dnsmasq package to serve a fixed name & IP to particular target on one
interface with the following lines to /etc/dnsmasq.conf
#DM 2009-03-03 Serve fixed ip to Nios2 Cyclone2 demo
interface=eth1
dhcp-host=3a:70:01:00:fa:70,ecosphotodemo,192.168.7.90,2h
You'll also need to allow packets through on your firewall for that
interface.
Nicely dnsmasq also supplies a tftp server too, which in my development
& demo environment is great for pulling images off. The config file has
copious notes and examples, at least in the openSUSE package. The man
pages reference that it can pull name information from various different
system files, such as /etc/resolv.conf & /etc/hosts. Looking quickly
at the avahi-daemon setup, I think it too can pull from these files, so
you could setup your desktop as your name server and dhcp server for the
mac & laptop and have a centralised system to maintain, backup and
utilise.
[1] actually I've worked out how I "magically" got the .90 address
*always* when my eCos application made a dchp request. It turns out
that I got dnsmasq working in minutes in September when I was hurriedly
doing a fresh install of openSUSE 11.0 on a brand new hard drive for a
pressing customer visit, and failed to document what I did.
Magically, instead of "dhcp-host..." above, I had:-
dhcp-range=192.168.7.81,192.168.7.100,2h
I have determined that dnsmasq has an "allocate from the middle"
algorithm, which always returned the .90 - I grep'd half my system to
understand why I always got the same IP returned which wasn't listed
in any system file!
I expect dnsmasq will be in the Fedora & Kubuntu repositories. I also
run ssh with StrictHostKeyChecking (default?), so it is easier to have
unique and reliable ip addresses for each machine.
Daniel
More information about the Swlug
mailing list