For a while now I’ve been battling with the router my ISP gave me. In the name of user-friendliness it has a Japanese administration interface with a lot of katakana for the IT terms. More importantly it simply doesn’t offer IP issuance over DHCP based on MAC addresses. Which means with the linux box and the MacBook switched on and off randomly they’d get completely different IP addresses and I have nothing to prevent that.

(The MAC Address Filtering only works if the wireless extension is installed, not with wired LAN.)

Now that started being a major nuisance after I shared everything via NFS. OS X can connect to NFS shares with the Command+K “Connect to Server…” option in Finder but it needs the IP address of the machine. I also set up the NFS server to accept connections only from the IP of the MacBook – I don’t like open doors – but then that had to be changed as well every time the bloody machines swapped IPs after a restart.

Not too sophisticated.

It recently occurred to me that there must be some implementation of the zero configuration networking technology of Apple called Bonjour. The idea behind this is that no matter what their IP is machines broadcast the services they offer and find each other on the network without any user interaction whatsoever.

A prime example is when there are two Macs on a network and you set up file sharing on one of them in matter of seconds it will pop up at the “Shared” section of the other’s Finder. With Leopard this feature has been extended so Windows machines are recognised automatically as well. When I visited home upon connecting to the LAN the public shares of all the Windows PCs in our house appeared almost instantly. After supplying the usernames and passwords of the respective computers I could browse the files without configuring anything. (You need to set up Samba – well not as much set up more like tick a checkbox in the System Preferences – if you want Windows computers to see Mac shares over the network.)

I think we can all agree that the zeroconf approach is pretty cool. But what if you have a linux box?

Surprisingly it didn’t take long at all to figure out a solution. I wonder why I didn’t do it earlier to be honest. Here’s how it should go on a Gentoo box:

Step 1, Set up netatalk, the open source implementation of AFP, Apple’s file sharing protocol. After emerging it needs a few tweaks. In /etc/netatalk/netatalk.conf some protocols are better switched off.

Then proceed on configuring the shares. They can be added at /etc/netatalk/AppleVolumes.default but I just went with the default sharing of the home folder.

With the following command add the netatalk daemon to the default runlevel (so it autostarts every time with the machine) and start it.

rc-update add atalk default
/etc/init.d/atalk start

Step 2, Configure Avahi, the open source replacement of Bonjour (zero configuration networking). AFP shares is one thing but if you want them to pop in Finder without any hassle you need Bonjour to advertise their presence on the network. Apple has its own source code available for linux but I found mDNSResponder vastly inferior to Avahi. (i.e. I had no idea how it worked…)

Avahi needs a config file at /etc/avahi/services/afpd.service to contain the following:

The txt-record entry specifies the type of machine OS X will think your share is on. This will result in OS X machines to display your linux box with a nice Xserve icon. Undefined shares get an Apple monitor icon or a Windows CRT with BSOD on it as far as I know.

Update 1: In order to be able to use machine names instead of IP addresses from the linux box you will need to emerge the nss-mdns package too. In /etc/nssswitch.conf find the line starting with hosts: and add mdns to the end of the line. Mine looks like this now:

hosts: files dns mdns

Finally add to the default runlevel and start Avahi as well.

rc-update add avahi-daemon default
/etc/init.d/avahi-daemon start

Step 3, profit. That’s all to it because after starting Avahi an icon for the linux box will appear in matters of seconds in Finder. Press Shift-Command-K to go directly to the Networks location and wait for your server there. When it pops a double click will result in a can’t connect error but don’t panic. Just use the “Connect As…” button and specify your linux username and password. Congratulations, you can now browse the linux server as if it was any other Mac on the network.

If you want to use more types of services the Gentoo Wiki page on Avahi can help with the configurations. If you’d like to use the linux server as a Time Machine backup location Matthias Kertschmann’s guide explains that as well. My post is based upon his guide except I changed the file locations to their Gentoo equivalents.

It is important to mention that if you run any firewalls on the machines they need to be disabled or adjusted to work with Bonjour/AFP. This mainly means you have to allow communications over port 548 and 5353.

Oh I know it’s so yesterday to rant about how great Wall-E is. This is a little like Firefly that rested on my hard drive unnoticed and mostly forgotten for over a year only to be found and to turn my world upside down.

With Wall-E I was caught from the very beginning with the grandiose shots of mountains of trash and dirt so alike live-action. Later I half-expected the protagonist machine to don a leather jacket and track away into the sun Fallout-like, because La vie en Rose is very similar to A Kiss to Build a Dream On.

And of course any self-respecting geek stifles a joyful yelp when Wall-E’s fully charged sound turns out to be the Mac’s boot-up chime. Eve’s sleek design is also reminiscent of the white iMac, and I learned from the castlist that the evil Autopilot speaks via MacInTalk, OS X’s built-in text-to-speech software.

To test I typed “Captain? Captain? Let go!” to TextEdit and had it voiced. It really is the same (with some change of pitch and tone).

The part of the internet who’s not yet apathetic about Microsoft’s announcements is happily blathering about the new features. Well it’s interesting enough – in my opinion – that the inclusion of options for the user to switch annoying notifications off has to be considered a feature…

Also, it might be just me, but the new taskbar reminds me of KDE’s (especially KDE 4’s) a great deal. Also it’s hard not to notice that with the Libraries added the folder view is increasingly reminiscent that of OS X’s. I’m quite sure Steve won’t fail to mention it in the next Keynote.

Not passing judgement here, just saying. It’ll be interesting to see by the time W7 ships (promised 2011) how linux desktop systems and Mac OS would look.