2

I've been SSH'ing into my Raspi 3 B+ for some time now from my Mac OS with no issues.

I recently set a static IP address for my Pi on a LAN network connected via ethernet cable. I edited sudo nano /etc/dhcpcd.conf

and then added at the bottom;

interface eth0 static ip_address=my.desired.ip.address static routers=router.address static domain_name_servers=DNS.address

Where my router address and DNS address were retrieved using route -n and cat /etc/resolv.conf respectively.

I successfully SSH'd from a different laptop onto my Pi using this static IP address - this network is not connected to the internet.

Going back to my personal laptop which is on a wireless network (same as Pi) which is connected to the internet. I tried SSH'ing into my Pi as normal but the connection hangs.

I've confirmed my Pi's IP address with ifconfig wlan0 which is 198.123.52.xx. When I try through terminal to SSH using sudo ssh [email protected] -v I get the following;

OpenSSH_7.9p1, LibreSSL 2.7.3 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Connecting to 198.123.52.xx [198.123.52.xx] port 22.

The connection just hangs there.

  • I've tried reinstalling SSH-server with sudo apt-get purge ssh-server then sudo apt-get install ssh-server.
  • I've tried adding IPQoS cs0 cs0 to the end of my /etc/ssh/sshd_config file.
  • I've # commented out the static ip changes I made.
  • I've run sudo apt-get update and sudo apt-get upgrade - All packages are installed and updated.

Do I need to remove a hostkey or flush something?

I'm not sure what else to do.

9
  • Can you ping the Pi? Setting an incomplete/wrong static address is one of the common problems, but as you haven't told us what you did who knows? Purging and re-installing files just makes things worse. PS there is ABSOLUTELY no point in trying to obscure a Private IP address but using a NASA IP range is unlikely to work.
    – Milliways
    Commented Jul 26, 2019 at 0:23
  • Always better to setup the static IP address in the router. Not on the device itself. That way you won't hit your toe again.
    – kuzeyron
    Commented Jul 26, 2019 at 11:05
  • You gave a static ip address to the wired interface eth0. Then you wrote "my personal laptop which is on a wireless network (same as Pi)". Do you connect the RasPi one time wired, the other time wireless? Please address me with @Ingo, otherwise I won't see your reply.
    – Ingo
    Commented Jul 26, 2019 at 15:41
  • What is the output of traceroute PIADDRESS on the mac ?
    – Craig
    Commented Jul 26, 2019 at 16:16
  • @Ingo Yeah, I'm working on a wireless network connected to the internet, but set up the static eth0 ip address on a separate network that is not connected to the internet where the Pi is tethered.
    – Daniel
    Commented Jul 29, 2019 at 17:25

1 Answer 1

1

I think your choice of address -- 198.123.52.xx is the problem. That is a valid routable IP address that is assigned to NASA. This could work as long as you are not connected to internet.

However, if your mac is connected to internet then it will likely try to contact that IP by routing to the internet not your local network.

You need to select a netblock reserved for private networks (see RFC1918).

  • 10.0.0.0 - 10.255.255.255 (10/8 prefix)
  • 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
  • 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) List item

Your Answer

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

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