I have a linux machine (raspberry pi) running Debian and I have configured it to create an ad-hoc network. The machine hosts a web app which allows a person to scan for infrastructure networks and select one and enter security credentials. The raspberry pi will then connect up to the chosen network.

I want to make it simple to get to the webpage hosted by the raspberry pi, regardless of whether it in ad-hoc mode or infrastructure mode. From what I have read, the best way to do this is to install avahi-daemon and configure it to resolve the hostname to it's own address. I have tried doing this but ran into some problems. When the pi is connected to an infrastructure I can run ping raspberrypi.local on my mac and get ping responses back from the pi. However, when the pi is in ad-hoc mode, and I connect my mac up to the adhoc network, the ping does not succeed. It seems as though avahi is only working with infrastructure networking mode.

Here is my attempt:

I added the following service definition in /etc/avahi/services:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE  service-group SYSTEM "avahi-service.dtd">
    <name replace-wildcards="yes">%h</name>

The avahi config file /etc/avahi/avahi-daemon.conf is the same as the default one but I tried adding the following:


which did not help. I thought maybe point-to-point was the same as peer-to-peer network, but maybe not?

Does anyone have any suggestions?

Edit: I'm not sure if it's important or not but I do also have dhcpd running when the Pi is in ad-hoc mode. Could this be a problem? Does avahi try to assign IP addresses?

  • Read this First. It was always my understanding that if no device on the ad hoc network was functioning as a router, you couldn't see the Internet, only information shard between devices
    – eyoung100
    Commented May 2, 2014 at 17:22
  • I'm not trying to access the internet though Commented May 2, 2014 at 19:49
  • I think this is a neat idea! Commented May 3, 2014 at 1:21
  • did you ever get this working? I'm having the same issue Commented Jul 23, 2014 at 13:29

1 Answer 1


I think Avahi needs nss-mdns which is a glibc plugin providing host name resolution via mDNS, and avahi daemon started on bootup.

Suppose you have machines with names maple, fig and oak, all running Avahi. Avahi can be set up so that you do not have to manage a /etc/hosts file for each computer. Instead you can simply use maple.local to access whatever services maple has.

You can get more info on ArchLinux wikipage (refer to Arch's or Gentoo wikipages frequently. These two have simply the best documentation available :) )

  • I think you might be right. I was thinking that nss-mdns was a dependancy of avahi and thus installed automatically, however I just checked and it is listed as a recommended package, not a a dependancy. I will give it a try as soon as I can. Commented May 10, 2014 at 12:36
  • bummer it turns out I did already have libnss-mdns installed. doesn't seem to do the trick. Commented May 11, 2014 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .