Raspberry Pi Remote Connections – Without A Network!

This tutorial from : https://pihw.wordpress.com/guides/direct-network-connection/

Quick Setup / Setting up when you don’t have a monitor

This quick method skips all of the testing which can be performed if we have a Raspberry Pi running with a monitor and keyboard attached.  If you run into problems, then follow the steps in Option 2, to test the network settings.

1. Ensure the Raspberry Pi is powered off, and remove the SD-Card.

  1. Insert the SD-Card into a card reader and plug it into your laptop.
  2. Find the drive and you should find several files on the Card (note it a lot smaller than you’d expect since it is only the boot section of the Card (the rest is hidden)).
  3. Make a copy of cmdline.txt and rename it cmdline.normal
  4. Edit cmdline.txt and add the IP address at the end (be sure you don’t add any extra lines).

For network settings where the IP address is obtained automatically, use an address in the range 169.254.X.X ( –


For network settings where the IP address is fixed, use an address which matches the laptop/computers addressexcept the last digit.


Ensure you take note of this IP address (you will need it every time you want to directly connect to the Raspberry Pi).

  1. Make new copy of cmdline.txt and rename it cmdline.direct
  2. To swap between configurations, just replace cmdline.txt with either cmdline.normal or cmdline.direct (or use the commands in Option 2 to do it directly on the Raspberry Pi – the change will take effect next time you power up)
  3. Return the card to the Raspberry Pi.   Attach the network cable attached to both the computer and Raspberry Pi and power up.


  1. You will need to wait for your computer to finish detecting the network settings (you may see a small networking icon flashing in your system tray while it does, or open up the network settings to see when it has finished and has an IP address) – it can take around 1/2 minute.  Your computer may report the connection as  “limited or no connection” when connected to the Raspberry Pi in this way, this is normal as indicates it is a direct computer to computer connection rather than a standard network.
  2. If you forget or decide not to plug in the network cable, the Raspberry Pi will wait 2 minutes (or until you connect the cable) before completing it’s start-up (so if you only have a keyboard and monitor attached, you need to wait!).
  3. If you are using multiple wired network adaptors (i.e. Using an extra USB-LAN dongle) on your computer you may find you have to unplug the other network cable and reattach afterwards (my Windows XP machine needed this before it would connect through the direct link).

Option 2: Set-up using a monitor and keyboard (i.e. before you really need it):

You will now see that having a keyboard and monitor available at this stage is helpful for when we set this up, as we can test each step.

  1. Boot up the Raspberry Pi and plug in the network cable to both machines.
  2. When the Raspberry Pi has booted ensure you log in and open the terminal if not already open.

Type the following:

hostname -I

You will probably find that nothing is shown, as this is trying to show you the current IP address (which is not allocated yet).  If it does show something, then you may have already have a fixed IP address (if you do take note of it in case you need to put it back later).

  1. Now set the new address as follows:

For network settings where the IP address is obtained automatically, use an address in the range 169.254.X.X ( –

sudo ifconfig eth0

For network settings where the IP address is fixed, use an address which matches the laptop/computers address except the last number.

sudo ifconfig eth0
  1. We can check this has worked by rechecking the IP address:
hostname -I

You will see we now have the IP address set.

We should now be able to “ping” the laptop.

  1. Find the laptop address (if it wasn’t a fixed address) by returning to the list of Network Adaptors in windows and double clicking on the icon to see it’s “Status” (don’t worry about the warning of “limited or no connection”).

Then select the “Support” tab and then “Details”.  You should see the laptop’s IP address.


We should get lots of responses (the laptop is responding the Raspberry Pi through the network cable)!  Ctrl+C to stop that.  (If you didn’t then double check your connections and the IP addresses you are using).

As mentioned before, the new IP address will be lost when we reboot, so we need to ensure it is set every time we boot (or at least every time we want it to be when we boot).

To do that we can edit the “cmdline.txt” file which is located on the boot partition of the SD Card.

  1. Make a copy of the file, with the following command:
sudo cp /boot/cmdline.txt /boot/cmdline.normal
  1. Next edit the original file using nano:
sudo nano /boot/cmdline.txt

At the end of the long line, add the following (you will need to add a space between the last item and “ip”:


Ctrl+x and y to save and exit.

  1. Make a copy of this file too:
sudo cp /boot/cmdline.txt /boot/cmdline.direct
  1. You can now reboot the Raspberry Pi (sudo reboot), and next time the IP address will be automatically set.
  2. To change between configurations, simply use the following commands (just remember to edit  /boot/cmdline.direct if you need to change the IP address in future).
sudo cp /boot/cmdline.normal /boot/cmdline.txt
sudo cp /boot/cmdline.direct /boot/cmdline.txt
Facebook Comments

Leave a Reply

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