• Raspberry Pi 3 model B
  • OS: Raspbian 9.3 stretch
  • Kernel: armv7l Linux 4.9.76-v7+
  • CPU: ARMv7 rev 4 (v7l) @ 1.2GHz RAM: 1GB


  • Linux Mint 18.3

I've been able to connect fine via SSH to my RPi when it's connected to Wi-Fi, however, I'd like to be able to set it up so that I can connect my RPi to my laptop via an ethernet cable and still be able to SSH into it.

So far I've done the hardware side, connecting it up as you'd expect. I've then from my laptop ran ifconfig to look at the IP addresses of devices. I don't have an eth0, however, I do have a enp4s0f2? Anyway, the inet addr gives me an IP. I tried to SSH into that IP and there was no luck. I next try scanning the ports to see if everything was alright with nmap [assumed RPi addr] and port 22 isn't open.

I've fiddled around within the network settings of my laptop. I've checked out raspi-config to see if there were anything obvious but I'm stumped even after trying out some guides.

  • "I tried to SSH into that IP and there was no luck" - please post the complete error message
    – Fabian
    Jan 30, 2018 at 19:11

2 Answers 2


if you connected via ssh before, i'll assume that you've enabled ssh, and sshd is running. from your laptop, click the network icon on your taskbar. scroll down to "network settings". select the wired connection after you plug in the ethernet cable between your pi and the laptop. click the gear button for configuration. click ipv4 in settings, and set addresses to link-local only. click apply. while still in network settings, confirm that your wired interface has an ipv4 address. this may take a second, and it should start with 169. after you find the ip address of your pi's wired connection (eth0), you can ssh to it.

  • I've done all that you've said everything matches up as you suggested. Unfortunately, I am still not able to get into it via ethernet (wifi is still fine). Again I nmap scanned and 22 isn't open.
    – shmink
    Feb 4, 2018 at 19:16
  • Is it worth trying to add the wired network to /etc/network/interfaces?
    – shmink
    Feb 4, 2018 at 19:17
  • Or is there anything I can do with raspi-config? I see there are network options there but I just initially added my wireless network to /etc/network/interfaces first time I booted up the RPi.
    – shmink
    Feb 4, 2018 at 19:20
  • the only thing i would do in raspi-config is enable ssh. i would restart the ssh service after plugging in ethernet cable. you said that you can ssh over wifi fine? keep in mind that your pi
    – boomclick
    Feb 5, 2018 at 13:35
  • s wired and wireless interface have different ip addresses. your pi's wired address should also begin with 169.
    – boomclick
    Feb 5, 2018 at 13:36

Firstly, user boomclick's answer helped a lot with getting to this point. It's worth trying his answer first as this one has a bit more faffing.

When in the RPi and able to issue commands you're going to want to type in ip a. You should have a few results, these are your networks. Look for one that stands out as ethernet such as eth0. For me it was not this but rather enxb827eb5a927d. I know it's odd one but it's likely due to my USB to ethernet adapter (ethernet port of laptop is broke). It stood out to me as the other choices were loopback and wlan0. Copy that name of the device (again mine being enxb827eb5a927d) and then sudo nano /etc/network/interfaces. When in here you can add networks at your will, for example I have a custom for CAN networks. The code I put in was the following:

allow-hotplug [name of device]
auto [name of device]
iface [name of device] inet static
    address 169.x.x.x 

That IP address is incomplete as you'll see. For your IP address refer to boomclick's answer for the best way to get it. After you're all done typing out your information Ctrl+X to exit, you'll be asked if you want to save so press Y then asked for a filename but we don't want it to change so hit Enter.

Now that file has been changed you could go ahead and reboot if you wanted to but I did make an additional change to be sure port 22 (SSH port) was open. sudo iptables -L will list your ip table rules. As default you should have nothing there and and all of the policies should be in ACCEPT state. I added a rule that says accept any incoming connections to port 22, they would still have to enter passwords regardless so it's not as unsafe as it sounds. sudo iptables -A INPUT -p tcp --destination-port 22 -j ACCEPT will do the job. If you list the iptables again you should see that rule.

Finally reboot, sudo reboot now for all the changes to become effective. Give the RPi a minute to boot up then SSH in as you normally would but with your 169.x.x.x address. If you're prompted to accept a fingerprint accept and congratulations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.