August 2007


Ubuntu consistent network hackery

Posted on Wednesday, 22 August 2007

I use a docking station with my laptop. When it's in the dock it has a wired connection, otherwise it's just wireless.
Since most of my work involves ssh and I tend to have several long running ssh sessions at a time, it's quite annoying if I quickly undock to go and work in another room and have to reconnect everything.
Of course, this is entirely fixable in Linux (albeit by way of some slightly dodgy hackery). Network Manager is just about quick enough to pick up a new connection before TCP connections time out, and Linux's routing stack is somewhat forgiving about connections switching interface. So, with that in mind, and using a DHCP network - all you need to do to preserve a connection across switching interfaces is have the same IP address on both. Sure you could go and hack at the DHCP config to make sure it serves the same IP to both of your MAC addresses, or you could just have both interfaces share the same MAC. I'm quite sure this breaks all manner of rules, conventions and RFCs, but the point is that it works and it makes my life easier :)

I'll happily take suggestions for a better way to override the MAC address, but this is how I do it:

-(cmsj@waishou)-(~)- cat /etc/modprobe.d/local
install ipw2200 /sbin/modprobe --ignore-install ipw2200 ; ifconfig eth1 hw ether XX:XX:XX:XX:XX:XX

So in this case I am setting my wireless card's MAC address to that of my wired interface (replace the XX:XX bit with the MAC from your other interface).

This worked fine for me in feisty, but was failing in gutsy and my wireless interface was coming up as eth1_rename. Obviously something new and strange was going on.

It turns out that, in the same way we handle disks by UUID, we now handle network interfaces by MAC address, so udev was getting a little confused.
A quick change of /etc/udev/rules.d/70-persistent-net.rules to stop recognising them by MAC address and start looking at the driver name instead, and it's all fixed. This is how the file looks now:

-(cmsj@waishou)-(~)- cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x8086:0x1077 (e1000)
SUBSYSTEM=="net", DRIVERS=="e1000", NAME="eth0"

# PCI device 0x8086:0x4220 (ipw2200)
SUBSYSTEM=="net", DRIVERS=="ipw2200", NAME="eth1"
I'd be wary about doing this on a desktop system where interfaces are more likely to change, but this is a laptop and I am quite certain the e1000 NIC isn't going to move on the PCI bus!

So there you have it :)

Update: It's worth noting that sometimes this will confuse some networks (e.g. I recently confused a hotel wired&wifi network into not talking to my laptop anymore and had to change both the wired and wireless MAC address to different addresses)



Posted on Saturday, 18 August 2007

Skype has been having network issues in the last few days. I don't like the fact that I've been using Skype, but I have. Why? Because it's the easiest way to talk to my girlfriend while she's away.
That is, it's easy while it works. It has many downsides, but to be fair to it, it's very good at dealing with firewalls and NAT, something that Ekiga really (really really) isn't.
With Skype broken, and wanting to talk to Ulrike, I suggested we try WengoPhone. She grabbed the windows binary, I grabbed the Linux binary. After a few false starts we got connected and for bonus points, it supports webcams in Windows and Linux, which dramatically improves the value of talking to her (and it's very cool that Ubuntu supports my tiny little Creative laptop webcam out of the box).
To my utter surprise, not only is Wengo GPL'd, it's also really just a SIP client. This is fantastic and it's just a bit of a shame that the interface uses Qt (the Wengo guys say they would love to see a Gtk port. So would I!). I was able to call her Wengo address (translated into the underlying SIP address) from Ekiga, but it took ages to arrange the call, even longer to connect the audio/video to it and even then it got the video wrong.
I know Ekiga has been making great strides in their development version and I very much look forward to being able to use it as a swiss army knife of VoIP. Having said that, I kind of suspect that I will be more tempted by some kind of Telepathy VoIP interface which hides all the tediousness of different forms of instant communication and just lets me type to, talk with, and look at people.

As a result of the Wengo transition, I have just been able to do this:

-(cmsj@waishou)-(~)- sudo dpkg -P skype
(Reading database ... 144578 files and directories currently installed.)
Removing skype ...
Purging configuration files for skype ...