Il problema potrebbe essere che ssh sta tentando di connettersi a tutti i i diversi IP a cui corrisponde lo www.google.com
. Ad esempio sulla mia macchina:
# ssh -v -o ConnectTimeout=1 -o ConnectionAttempts=1 www.google.com
OpenSSH_5.9p1, OpenSSL 0.9.8t 18 Jan 2012
debug1: Connecting to www.google.com [173.194.43.20] port 22.
debug1: connect to address 173.194.43.20 port 22: Connection timed out
debug1: Connecting to www.google.com [173.194.43.19] port 22.
debug1: connect to address 173.194.43.19 port 22: Connection timed out
debug1: Connecting to www.google.com [173.194.43.18] port 22.
debug1: connect to address 173.194.43.18 port 22: Connection timed out
debug1: Connecting to www.google.com [173.194.43.17] port 22.
debug1: connect to address 173.194.43.17 port 22: Connection timed out
debug1: Connecting to www.google.com [173.194.43.16] port 22.
debug1: connect to address 173.194.43.16 port 22: Connection timed out
ssh: connect to host www.google.com port 22: Connection timed out
Se lo eseguo con un IP specifico, restituisce molto più veloce.
EDIT: ho cronometrato (con time
) ed i risultati sono:
- www.google.com - 5.086 secondi
- 173.94.43.16 - 1,054 secondi
da ssh docs: "Utilizzare questo per specificare il timeout (in secondi) utilizzato durante la connessione al server SSH, anziché utilizzare il timeout TCP di sistema predefinito. Questo valore viene utilizzato solo quando la destinazione è inattiva o realmente irraggiungibile, non quando rifiuta la connessione. " – Adi