Posts: 16
Joined: Sat Dec 08, 2012 12:44 am

SSH over direct ethernet connection

Sat Dec 08, 2012 1:24 am

Hey, so here's the deal: I no longer have access to a monitor, but I'd like to SSH to it over a direct ethernet connection from my computer to the Raspberry Pi. I've checked that the RPi boots fine and SSH is running. I've read quite a few threads on this topic, but all of them say that the RPi has to be set with a static IP, along with other configurations. Is there a way to connect my computer with the RPi and have them on the same network if all I can configure is my computer and not the RPi?

Basically what I think is happening is that I connect them together, and I can set a static IP, subnet mask, and gateway on my computer, but my computer can't see any other host on the network because it doesn't know where to look for the RPi. I tried using nmap, but I'm guessing it can't find anything because it's in a different subnet? As you may have guessed, I don't know much about networking :) So, my question is, is there any way that I can get them to talk to each other when all I can do with the RPi is turn it on and plug it in? It sounds to me like it has to be possible, it's a direct wire connection after all, but I know far too little about networks to figure it out.

Thanks for any input in advance!

Posts: 518
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: SSH over direct ethernet connection

Sat Dec 08, 2012 7:07 am

Could use a little more info, but I'll make some assumptions and suggest the following. First assumption is that you can remove the SD card from the RPi and put it in a machine with a monitor, if you can not do that, you can ignore the rest of this post as it relies on being able to do that :(

Put the SD card into the computer with the monitor and edit the /boot/cmdline.txt file. Add something like the following to the end of the line in that file, change the ip address stuff to be on the same network as the computer with the monitor, just make sure the ip address, the first address below, is different than the one with the monitor. The first line is what you will basically add to the cmdline.txt file, the second line is just an explanation of the first line, it does not get added to the cmdline.txt file:


Note the :: after the first ip address as the second "field" is blank, no server-ip, you do not have a netboot server, so :: is just an empty field for that spot.

Then boot up the pi, it will have the address you specified in the cmdline.txt file.

Then and this is pretty important (to me at least) edit your /etc/network/interfaces file and change the eth0 entry to look something like this, change it to match what you put in the cmdline.txt file:

iface eth0 inet static

Then edit the cmdline.txt file again to remove the ip= stuff and reboot the pi, it should come up with the same settings on reboot.

the /boot/cmdline.txt thing is a real hack and the /etc/network/interfaces file is really the right way to do it, but if your machine with the monitor is a windows or mac box you can not easily edit that file as it doesn't show up, but the files in the /boot directory do show up on windows/mac. If you can edit the /etc/network/interfaces file from your machine with the monitor, by all means do that and skip the cmdline.txt file part.

Posts: 16
Joined: Sat Dec 08, 2012 12:44 am

Re: SSH over direct ethernet connection

Sat Dec 08, 2012 4:17 pm

Hey, thanks for the reply! I do have access to the SD card, and I added the line to the cmdline.txt file with the same addresses you specified. Then I changed my computer to, netmask, and gateway However, when I connect the two and boot up the RPi, I get the expected IP on my computer, but still cannot ping, the RPi, although they should now be on the same network. It seems I must be going wrong somewhere, but I did just copy and paste that line into the file, and that's pretty much where I could be going wrong.

I tried editing the /etc/network/interfaces file but that partition mounts as read only for some reason. I'm on a mac, but was under the impression I could read/write using fuse-ext2 to mount; I'm guessing something goes wrong in the automount, I'll have a look at that when I have time later because it always gets messy trying to get ext2 working on a mac.

So for now, I could only change the cmdline.txt file to the line you posted, but still not getting them to see each other. Do you know what may be going wrong here?

Thanks again, and let me know if there's any info that could help!

Posts: 518
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: SSH over direct ethernet connection

Sat Dec 08, 2012 4:58 pm

That should have about done it. You are using raspbian 2012-10-28 from the foundation download page?

mine looks just like this and it works:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=
with no return at the end of the line

You could past in the output from:

ifconfig -a

That might give us some helpful info.

edit: sorry, I forgot you do not have access to a monitor on the rpi so you can't put in that command and see the output.

Posts: 16
Joined: Sat Dec 08, 2012 12:44 am

Re: SSH over direct ethernet connection

Sat Dec 08, 2012 5:09 pm

I had an extra line, but removed it to match your cmdline.txt exactly and I still get the same results. I should also mention that all other interfaces are down while I'm connected with the RPi. Maybe I'm configuring my computer wrong.


EDIT: My bad, I misunderstood that the ip= line had to be separate with no return at the end of it, but I know realize you meant there's no return throughout. Tried it and works like a charm, I'll change the /etc/network/interfaces file now, thank you very much :)
Last edited by RasPass on Sat Dec 08, 2012 5:32 pm, edited 1 time in total.

Posts: 518
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: SSH over direct ethernet connection

Sat Dec 08, 2012 5:19 pm

Great, glad to hear you are up and running. Cheers.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: SSH over direct ethernet connection

Sat Dec 08, 2012 6:04 pm

Assuming your other computer is a Windows box, then the best answer to your question ("Can I connect it up so that the Pi ends up on the same network as the rest of my computers?") is to setup a "bridge" on the Windows machine. This is pretty straightforward on Windows (unlike on Linux, where it is a PITA) - and results in the wireless and the ethernet on the Windows machine being "merged" into a single ("bridge") device. Then you should be able to just run a cable between the Windows machine's ethernet and the Pi's ethernet - and the PI should automagically get an IP address on your LAN.

I had to set this up when I was working with running the Pi system under QEMU on Windows.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Posts: 37
Joined: Tue May 15, 2012 5:27 pm
Location: Seattle, WA, United States

Re: SSH over direct ethernet connection

Wed Jan 23, 2013 5:14 pm

Hi , everyone,

I just established a connection with the Pi over an ethernet connection from a computer running Ubuntu using the tutorial below, so I figured I'd post it here as a reference:

http://www.muktware.com/articles/589/ho ... u-machines

Unfortunately, I still need to connect the Raspberry Pi to a screen to figure out what it's ip address is. (Although, once I know the address, I can access it remotely with ssh.)

I hope this helps!

Posts: 281
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK

Re: SSH over direct ethernet connection

Sat Feb 02, 2013 7:44 pm

If all systems in your network are running Apple's Bonjour services the name resolution to IP address is simply raspbmc.local (say) i.e. you just add .local to the known host name you want to talk to.

Bonjour is installed on a Windows system if you have ITunes installed, if you havemn't or don't want it then Google "Bonjour Print Services for Windows” and install that.

On the Pi, raspbian has suitable software installed but you can always run
sudo apt-get update
sudo apt-get install libnss-mdns

On completion, try
ping tom.local

where tom would be a name of a system in your network (which must be running once of the Bonjour variants as well).

End result you don't need static IPs, can use DHCP and get to systems via the fixed hostname.

Posts: 1
Joined: Wed Jan 22, 2014 8:30 pm

Re: SSH over direct ethernet connection

Wed Jan 22, 2014 8:32 pm


after fiddling around and watching LOTS of other webpages, I have found a infinitely easier way to get internet working through headless mode (even without editing cmdline.txt)!
Indeed, go to your wifi settings, check “share connection”. Connect RPi through ethernet, and when you check those ipv4 properties, you will see Windows has probably given it some address like Do not change this, as it will disable the DHCP settings for this connection!
Now, if you open a terminal and type “ping raspberrypi.mshome.net” you will see it automatically resolves to an IP address.
You can also use this in Putty to connect! Just type raspberrypi.mshome.net into the test field and voila! It worked on first try and I could even immediately ping http://www.google.com from the pi!

Posts: 6
Joined: Thu Aug 22, 2013 7:18 pm

Re: SSH over direct ethernet connection

Mon Feb 03, 2014 4:08 pm

What striner has described is the easiest way to enable SSH over direct ethernet. If anybody is confused about the steps, I will written a detailed post with screenshots of what exactly you need to do to enable SSH over ethernet.

http://carbonstone.blogspot.com/2014/02 ... ernet.html

Posts: 1
Joined: Sat Sep 20, 2014 6:36 pm

Re: SSH over direct ethernet connection

Sat Sep 20, 2014 7:11 pm

hey i know it is already some time ago but i have some questions to the first reply.

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::903e:3364:99ca:f78a%12
Autoconfiguration IPv4 Address. . :
Subnet Mask . . . . . . . . . . . :
Default Gateway . . . . . . . . . :

so this is the adapter i want to connect my pi to so i edited the ip=line to

so that the settings are similar can i do that and if yes why is it not working. maybe its because i have a lot newer version of raspian but how can i do it then?

i also tried the method of striner but again when i try to ping it only comes
C:\Users\Thanatus>ping raspberrypi.mshome.net

Pinging raspberrypi.mshome.net [] with 32
Reply from Destination net unreachable.
Reply from Destination net unreachable.
Reply from Destination net unreachable.
Reply from Destination net unreachable.

Ping statistics for
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

The destination host is always unreachable :( i really don't know what I'm doing wrong

Return to “Beginners”