Tuesday, May 3, 2011

Using Avahi/Bonjour to find VNC servers on your local network

This is off topic, but I need to write it down somewhere.

On my home network I have a VNC server running on an Oracle Enterprise Linux box. Since I use DHCP it's not uncommon for the DHCP server to assign a different IP address to the machine each time I bring the machine online. To find the machine's IP address I either have to attach to the console and log in to run "/sbin/ifconfig eth0" or use nmap.

Wouldn't it be great if I could just open my VNC client and have the server just show up in the list?

Yes you can. And the trick is a technology called Zeroconf implemented in a daemon named Avahi on Linux.

In my env I run VNC on :1 (TCP port 5901) so all I had to do was put the following in /etc/avahi/services:

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

Then when I fire up my VNC client this shows up:

(This is from Chicken on the VNC on a Mac).

Hope this helps someone else!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.