[clug] How to connect two Linux boxes? [SEC=UNCLASSIFIED]

Francis James Whittle fudje at grapevine.net.au
Thu Sep 3 21:34:49 MDT 2009


On Fri, 2009-09-04 at 08:47 +1000, steve jenkin wrote:

> A question/comment on network addressing.
> 
> IIRC, someone (Brad?) did a CLUG talk about ZeroConf: 169.254.0.0/16
> 
> <http://en.wikipedia.org/wiki/Zero_configuration_networking>
> 
> It is exactly for this situation "I have two machines on their own
> network". Even Winders & OS/X have some version of it.

I believe both Microsoft and Apple were party to the group that came up
with it.

> 
> For extra credit, anyone want to explain how it works on either Ubuntu
> or Redhat or any linux. Commandline or GUI.

The canonical (not Canonical Ltd.) way to do it on Linux is using the
avahi suite <http://avahi.org/>.  The particular piece is is Link-Local
version 4 addressing and is handled by avahi-autoipd;  This is designed
to hook into ISC's dhcp-client and activate when it doesn't get an IP
address from a DHCP client.

Wall of text follows.

This software comes in the main package bundle on Most Recent Linux
Systems(tm).  (Although a quick test just now confirms it didn't come
with Debian Lenny, at least not on my installation - although,
admittedly, I skipped the tasksel part, so didn't install a whole bunch
of stuff that normally would have been installed).

Most systems with Network Manager should, in essence, just work with
this.  You know, plug in the cable, go grab some coffee and a doughnut
(or your poison of choice), come back, and it's done.  Either it got a
DHCP supplied address, or it gave up and assigned itself and address in
the 169.254../16 range.  Or that's how it should work in theory anyway,
Sometimes I've needed to do a bit of futzing around to get it to work.
Alternatively, you can force an interface to use LLv4 addressing ONLY
using the Connection Editor - Under the IPv4 settings tab there's a
"Method" drop-down from which you select "Link-Local Only" (or whatever
that's translated to in you locale).

On systems without Network Manager but WITH avahi-autoipd you can, from
the console, call `avahi-autoipd IFACE' as root, it'll grab the device,
drop privileges, and start searching.  You should get output something
like:

Found user 'avahi-autoipd' (UID 116) and group 'avahi-autoipd' (GID
122).
Successfully called chroot().
Successfully dropped root privileges.
Starting with address 169.254.9.118
Callout BIND, address 169.254.9.118 on interface wlan0
Successfully claimed IP address 169.254.9.118

Obviously with differences where appropriate.  (ie. UID, GID, address
and interface are liable to be different).  If the interface already has
an address assigned it will tell you about it ("Routable address already
assigned, sleeping."), then sit there waiting for the state of the
device to change ;) 
If avahi-autoipd was installed as a package you should be able to cover
your bases by doing `dhclient IFACE' instead.  Be aware that this will
take much longer – About 90 seconds on my system.  Running
`/sbin/ifconfig IFACE' will confuse you at this point by not showing
anything – avahi creates an alias with the name "IFACE:avahi":

$ /sbin/ifconfig wlan0:avahi
wlan0:avahi Link encap:Ethernet  HWaddr 00:0f:3d:a8:d3:88  
          inet addr:169.254.9.118  Bcast:169.254.255.255
Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1

This will be destroyed when you call `ifconfig IFACE down'.

Of note to Ubuntu users – you can specify ipv4ll as your method
in /etc/network/interfaces to force link-local addressing.

The intention of the avahi developers is that you should _not_ force
link-local addressing however, and should rather use the dhcp-client
hook method.

> I'm just a poor soul wandering in the dark... Wondering how any of this
> magic works.
> 
> Need to upgrade and adjust those goggles!
> [I was issued safety glasses for Lab use in early 1970's.]
> [Still have them, not sure about the Lab coat & it wouldn't fit :-(]
> 
> 
> > All the best
> > Hal Ashburner
> 
> 
> -- 
> Steve Jenkin, Info Tech, Systems and Design Specialist.
> 0412 786 915 (+61 412 786 915)
> PO Box 48, Kippax ACT 2615, AUSTRALIA
> 
> sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin



More information about the linux mailing list