Google: Difference between revisions

Content added Content deleted
Line 120: Line 120:


== SSH to remote server ==
== SSH to remote server ==
;GCP VM SSH Connection Timed out
GCP VM
SSH Packets are reaching Destination? TCPDump on Destination. If not check:
Timed out
- IP Correct
- DNS Correct
- Port Correct
If yes check:
- Reply packets going or not? if going, check Router reverse routes.
- IPTables Rejecting packets (Flush IPTabeles -F)
- Packets received on correct interface? (SSH might be listening on wrong port - ListenAddress )


Any traffic reaching Server? If not check:
SSH Config File:
- Networking Config
- Interface check? correct ip on correct interface?

If Yes check:
- Firewall blocking traffic for port 22?
- Firewall blocking all external traffic?


;SSH Config File:
/etc/ssh/sshd_config # sshd server configuration file
/etc/ssh/sshd_config # sshd server configuration file
Port 22
Port 22
Line 138: Line 154:
/etc/ssh/sshd_config # ssh client configuration file
/etc/ssh/sshd_config # ssh client configuration file


Restart SSHD:
;Restart SSHD:
sudo systemctl restart sshd.service
sudo systemctl restart sshd.service
sudo systemctl status sshd.service
sudo systemctl status sshd.service


Wrong IP:
;Wrong IP:
ssh: connect to host 192.168.1.51 port 22: No route to host
ssh: connect to host 192.168.1.51 port 22: No route to host


Wrong Port:
;Wrong Port:
ssh: connect to host 192.168.1.50 port 2222: Connection refused
ssh: connect to host 192.168.1.50 port 2222: Connection refused


Netstat:
;Netstat:
netstat -ant | grep 22
netstat -ant | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN


Journalctl:
;Journalctl:
journalctl -xe
journalctl -xe