Sunday, December 29, 2013

Avahi works great with wifi - finally

One of the first things I do when I setup a new SD card for my Raspberry Pi is to make sure I can connect to it headlessly; this means setting up the SSH daemon to start automatically, configure it to boot to a command prompt (both of these can be done using raspi-config), change the computer name (as described here) and install and configure avahi (as noted on this page). Lately, I also install wifi - in the past, I had some problems doing this but I found that Adafruit's directions work very well, both with my new WiPi and the old wifi dongle I had. Also, on newer Raspbian installs, the gui tool works great - at some point I was even able to launch wpa_gui and configure the wifi in putty using Xming and X11 forwarding.

One thing that bothered me though was that after configuring wifi I was able to connect to my RasPi using raspberrypi.local but only at home; every time I brought my RasPi to work, I had to use the wired connection. I thought the main problem is the avahi configuration that somehow works on 192.168.x.x (at home) but not on 10.x.x.x (at work). I tried so many things without success that I gave up at some point. Until a few days ago when I realized what was happening: at work, the wired and wireless networks are on different IP subnets (if this is the right word - I am no network guru); so, I connected both my laptop and my RasPi to the same wireless network and this time I was able to connect to my Pi using the raspberrypi.local shortcut using only wifi. This was so awesome!

I am pretty sure everyone using a Raspberry Pi knows this by now but for me it was a huge revelation and success so I decided to publish this post, maybe it will help others as well.

No comments: