Direct connection to PC

Sometimes it is easier to connect your Raspberry Pi direct to the ethernet port of any PC or laptop. The process is easy but not exactly plug and play as in any other peripheral device with an ethernet port.

Follow one of the next sections in order to establish this connection. You don’t have to follow both! Just choose the one that fits your needs. Personally I am always using the second method right after the flashing of the SD card with Raspbian. Doing so, I am able to configure a few files (mainly the /etc/network/interfaces) and setup a WiFi connection with my home network.


Already connected with the RPi

If you are already connected with your Raspberry Pi (via HDMI cable with your TV, SSH connection, Serial port, your router etc) then on your terminal window of your Pi type:

sudo nano /boot/cmdline.txt

The nano editor will open and you are going to see a big alphanumeric string with many “strange” words for anyone not yet familiarised with the system. This is the cmdline.txt file.

Every single letter and variable is highly critical for the normal operation of the system. Don’t change anything from this string! Just go to the end of it, press your space keyboard button once in order to separate the new entry from the rest and type:


Like in the following screenshot

Actually this address can be anything betwean – if you have setup your computer to automatically allocated an address to anything connected to this ethernet port. This is almost always the default setting to any Windows, Linux or Mac system.

If your computer/laptop settings are set to fixed addresses then find an available address that works with your network settings and place this address. For example if have a subnet mask at and my computer IP is set to then set the Raspberry Pi address to for example. Just don’t use the first or last one of the available addresses.

Now press Ctrl-X, then Y and finally enter to store everything.

Connect the ethernet cable from the RPi to the computer/laptop and then type:

sudo reboot

The RPi will reboot itself and you are done!
Use your favourite method to connect via SSH with the Pi using the previously set IP address. For example if your are using a Mac, open a the terminal window and type:

ssh pi@


Not already connected with RPi

This is the method I am using all the times just after the flashing of my SD card! This is also possible to any SD card already in use, at least with Raspbian inside.

Plug your SD card, if it’s not already there, to your PC. You are going to see a single SD card with the name BOOT (if you have flash the card with an image) or two SD cards a BOOT and a RECOVERY one if you are using Noobs. In the second case you just have two partitions thats why the two SD cards.

Open the BOOT one and you will have something like this:

Locate the cmdline.txt file and open it. Be careful! Don’t change anything else from the card, don’t add or delete files, don’t make any other change! Just open the cmdline.txt. It will look like that:

After the rootwait add your desired IP address. The same rules apply as above

Save the file. Safely eject the SD card and plug it to your Raspberry Pi. Its ready! You can make an SSH connection with a single ethernet cable between the RPi and your PC!


And now a few things before the end:

1. The connection between the computer/laptop and the RPi it may take a fair amount of seconds before everything is ok. No worries about that. It is normal.
2. Most of the times you are going to see something like “limited connection” or “no internet network” or something similar at your network information icon. This is common as well and its because there is not any internet connection between the Raspberry Pi and the computer/laptop over this ethernet cable.
3. The next time you boot your RPi without the network cable attached (in both sides) the boot process will take its time! Sometimes even 2 – 4 minutes more compared to the regular boot time you had before. If this boot up time increase is not accepted for any reason, you can go back and remove the ip address from the cmdline.txt and everything will go back to normal as before.
4. If you are using and another network adapter like a USB to WiFI dongle or a USB to Ethernet adapter sometimes you probably going to have problems. The best way to solve that is to disconnect the secondary adapter and then boot the Raspberry Pi.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: