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
thensudo 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
andsudo 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.
1 Answer 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
traceroute PIADDRESS
on the mac ?