Ubuntu consistent network hackery

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/localinstall 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)