(06 June, 2023 - 02:05 PM)NothingToSeeHereYK Wrote: Show MoreFrom my knowledge, it can be one of three things:
1. Port 2000 is in use or blocked on the destination VPS.
2. Incorrect IP addresses or ports used in the script.
3. Firewall rules blocking the connection.
For the first theory, Use `netstat -tuln` to check if the port is in use. If so, stop the process or choose a different port.
For the second theory, Verify the IP addresses and port numbers in the script.
For the third theory, Check and update firewall rules using `iptables` or similar commands depending on the firewall system.
Check logs or error messages during script execution for more details.
Test connectivity between the source and destination VPS on specified ports using `nc` (netcat) or similar tools.
1. Port is open in ufw firewall rules and configured in the ssh_config file
2. Ip Address and port for the destination are correct (i changed it in the paste as i dont want to share the real ip)
3. As mentioned in step 1, firewall has the port open and it happen on different systems (home pc, work pc, external linux server)
I used nc command already and it shows me that the port is open (when i remove it from ssh config so it dont run the ssh process on that port but then, it give connection refused error.
When i use online port scanners, specifally
this one, it shows that only port 22 is open even tho i opened others (and as mentioned above, nc command show that the port is open too.
nc -z -v -w 1 "$DEST_IP" "$DEST_PORT"
Warning: forward host lookup failed for vm233219.example.cloud: Unknown host
vm233219.example.cloud [
32.321.321.321]
2223 (?) open
root@sourcevps-974513-1:~/scripts# nc -z -v -w 1 "
32.321.321.321" "
2222"
Warning: forward host lookup failed for vm233219.example.cloud: Unknown host
vm233219.example.cloud [
32.321.321.321]
2222 (?) : Connection timed out
root@sourcevps-974513-1:~/scripts# nc -z -v -w 1 "localhost" "2222"
localhost [
127.0.0.1]
2222 (?) open
root@sourcevps-974513-1:~/scripts# nc -z -v -w 1 "
localhost" "
2223"
localhost [
127.0.0.1]
2223 (?) open
Note that i opend port 2222 on localhost (
12.123.123.123) and opend port
2223 on the destination host (
32.321.321.321)
I then try to connect to ssh like so:
ssh 12.123.123.123 -p 2222 which then should redirect it to the destination host on port
2223 which however causes the timeout error.