[GLLUG] Getting "self awareness" with Avahi and CentOS 6

Mike Szumlinski szumlins at mac.com
Sun Mar 11 13:50:39 EDT 2012


Hey all, been a while since I've posted to the list.  I'm working on a project for a small appliance that might be plugged in on any network and I would like to advertise the location of the web administration panel for the software I'm using over mDNS.  I have avahi installed and all seems to be working externally (my Macs on the network see the registered service and can ping the archipliance.local mDNS name).  The problem I'm having is that the CentOS system itself doesn't appear to know its own mDNS name.  When I ping on the CentOS box itself to archipliance.local, it says no host found.  

I've done a fair bit of search the internet to see if I can figure out why this is happening without much luck.  The only reason I need to to work is that the application I am installing looks up its own hostname when it runs, so the appliance has to know its name.  When I try to hit the web interface externally at http://archipliance.local, the page loads properly but the underlying software then defaults back to the hostname "archipliance" in the browser, which is unknown on the network.  

Obviously this is easy in a non-dhcp world, but since this box may be on any network with any IP range at any given time, I'm not quite sure how to have it fall back onto its .local name when a static IP is not configured and good DNS is not around.  Interestingly enough, this software running on a Mac seems to have no issue doing this, so I know it is just a network configuration issue on my linux server.

Some shell dumps just so you get an idea of what is going on:

[root at archipliance ~]# ps aux | grep avahi
avahi     1262  0.0  0.0  27880  1836 ?        S    04:51   0:00 avahi-daemon: running [archipliance.local]
avahi     1263  0.0  0.0  27712   516 ?        Ss   04:51   0:00 avahi-daemon: chroot helper
root      5991  0.0  0.0 103292   872 pts/0    S+   13:41   0:00 grep avahi

[root at archipliance ~]# ping archipliance.local
ping: unknown host archipliance.local

[root at archipliance ~]# hostname 
archipliance

[root at archipliance ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 50:E5:49:E8:03:54  
          inet addr:192.168.3.100  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::52e5:49ff:fee8:354/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:91112 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27852 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:71441071 (68.1 MiB)  TX bytes:4833542 (4.6 MiB)
          Interrupt:28 Base address:0xe000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1446 (1.4 KiB)  TX bytes:1446 (1.4 KiB)

[root at archipliance ~]# cat /etc/resolv.conf 
; generated by /sbin/dhclient-script
search copperbell.lan.
nameserver 192.168.3.50
nameserver 192.168.3.51
nameserver 172.16.0.1

>From my Mac on the same network:

[szumlins at octane:~]: ping archipliance.local
PING archipliance.local (192.168.3.100): 56 data bytes
64 bytes from 192.168.3.100: icmp_seq=0 ttl=64 time=0.172 ms
64 bytes from 192.168.3.100: icmp_seq=1 ttl=64 time=0.277 ms

Any ideas would be much appreciated.

-Mike


More information about the linux-user mailing list