Crossover Cables and Red Tape

An Eccentric Anomaly: Ed Davies's Blog

The other day Akkana Peck wrote about using a crossover cable to her Raspberry Pi. All good stuff but there are a couple of points worth adding.

Crossover Colours

Starting at the end, she mentions going off to label her crossover cable. I've heard that the convention used at a number of sites is that crossover cables are red or, if they're not red, they should be labelled with red tape at each end. I guess the corollary would be that any red non-crossover cable should have a non-red label.

This seems like a fine convention which I intend to follow. As it happens I bought a crossover cable a few weeks ago in Maplin to connect between my laptop and netbook to move stuff back and forwards more quickly than via Wi-Fi (or if Wi-Fi isn't available). Regrettably they didn't have red ones so:

I only had transparent red tape to hand so used some white paper behind it to make it a bit more visible.

IP Routing

Also, she goes into using IP masquerading to allow her Pi to access the big wide Internet via her laptop. I'm sure that's fine if external connections are needed but unnecessarily complicated if all you want to do is talk between the laptop and the external device (e.g, her Pi or my netbook) locally and, separately, allow Internet access from the laptop.

If that's the case then it's easier just to set up a separate two-device subnet for the communication between the laptop and the external device. This is assuming that the external device isn't relying on DHCP for its setup - if it is then the IP masquerading isn't such overkill.

For historical reasons my /etc/hosts file is set up with local wired connection names for my devices in the 192.168.77/24 subnet. E.g., my laptop is normally called bill (because it's a Hewlett-Packard, if I had another it'd be called dave) but I also have a bill-w entry with address 192.168.77.172

Setting the connection up in Ubuntu connection manager is pretty easy:

This just says that this device should have address 192.168.77.172 on this network and the netmask says that all packets sent to any IP address that matches the first three bytes of this number should be sent to the network.

The netbook is set up the same except that its IP address is 192.168.77.173.

With this setup I can talk to the netbook from the laptop using either the name alice-w as specified in my /etc/hosts file or just with the direct IP address 192.168.77.173.

Similarly, on the netbook I can refer to the laptop as bill-w or by address. E.g., in the browser on the netbook I can preview this page as served by the laptop using http://bill-w:8000/2012/11/xover-cables or http://192.168.77.172:8000/2012/11/xover-cables.

Auto-MDIX

Finally, Akkana is puzzled by reports of connections working when straight-through (non-crossover) cables are used. This is presumably because the interface at at least one end has the ability to automatically detect what connection is being used and connect its transmit and receive lines appropriately. This is called Auto-MDIX.

Actually, having read that I now find that my laptop and netbook will talk quite happily using a straight-through cable. Previously I thought it was only some high-end hubs that could do this direction sensing otherwise I'd have tried before going to the hassle of buying and labelling a crossover cable. Still, the cable might be handy for connecting to other devices such as my Nanodes.

Crib Sheet

Finally, finally, in this context it might be worth mentioning my Structured Wiring Crib Sheet.