At last, direct ethernet connection

It all started when I took a hurried bag full of Raspberry Pi-related bits and bobs to Norwich, and then spent over an hour trying to get a simple network connection working between my laptop and the Raspberry Pi. Ever since then I have been looking for a way to quickly and simply connect the two devices.

I have tried some things which kind of worked: connecting using a serial port (slow, and often conflicts with expansion boards and other plug-in devices), a portable access point with built-in DHCP (faster, but needs extra power and cables, and is clumsy to transport and use) . I have also spent a lot of time trying to get other approaches working: Windows ICS (Internet Connection Sharing) is supposed to provide DHCP to connected devices, but every time I have tried to set it up it has broken some other aspect of the networking. There are several installable DHCP servers which can run on Windows (see here, or here, for example) - I have used these successfully on a local network connected through a switch, but have not yet managed to succeed using a simple wire between the laptop and the Pi.

As you can imagine, I was very happy to read that Meltwater has written a detailed guide to solving this very problem. It took me a while to get it all going, though. I already had all the PC software in place as I use ssh all the time (although I did need to fiddle with the laptop IP address settings), but I had somehow skipped the bit about starting the Pi with the network cable already plugged in. Several reboots and some head scratching later I got it working. The key insight for me from the whole article was that it is possible to set the IP address of the Pi by simply adding an extra section to cmdline.txt, a process which can be done by editing the file on the SD card before the Raspberry Pi is started.

Now I know that as long as I can find a micro-USB power lead and a CAT5 ethernet cable, I can work on my Raspberry Pi projects with just the Pi and my laptop. A delightful feeling!

No related content found.

6 Comments

  1. ” starting the Pi with the network cable already plugged in”
    I didn’t make that part totally clear, as I didn’t think it was essential. But you are correct, it will wait during boot if the cable isn’t attached (will continue once it is), I hadn’t noticed that. It does boot eventually, but only after a long time or after key-combo (shall have to find the setting!).

    Also it can take a while for windows etc to decide that it will use the direct link (I expect because it is looking for servers first).

    Can you let me know what you had to change regarding your laptops IP settings (you should be able to use the automatic IP address, or the laptops fixed IP depending on what the settings already are).

    Thanks!

  2. Thanks for all the comments. Great to come home to!

    As for IP settings, I probably made things a bit more difficult for myself by trying to ensure that the Pi got the same IP address from the cmdline.txt and from th DHCP server. This was important to me as I have a whole load of tools and scripts set up to expect a Raspberry Pi on that address.

    The Raspberry Pi end was the easy bit, I just added ip=192.168.0.232 to the command line.

    Windows was more tricky. In the end I used the “alternate address” mechanism (see here and here) to set up a static address of 192.168.0.229.

    The bit they don’t mention is that a typical laptop has two network ports – wifi and cable ethernet. I found that Windows did not seem to bother using the alternate address for the cable if it got a valid DHCP address from the wifi, so for now I am switching off the wifi module when I connect to the Pi. This works, but means I can’t easily look stuff up if there is wifi available.

    My next step will be to look for tools to make the setting of a static IP address easier. Something like Simple IP Config seems a possibility.

    • Thanks for the extra detail, yes, using a fixed IP on your current LAN is possible. If your networks support it, you may get away with using hostnames instead (again you can set via the cmdline.txt).
      I’ve tried it with a USB2LAN dongle, and it looks like windows will ping and use the 1st valid connection (so had to disconnect the original cable, before it would use the 2nd one). I guess it is probably similar with your Wifi (although mine seemed to be fine).
      Cheers.

  3. Pingback: First steps with Beagleboard Black | Raspberry Alpha Omega

Leave a Reply

Your email address will not be published. Required fields are marked *