Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Work-around for long delays in SSH connections Network
This is the result of a few hours worth of digging around, chasing after a loooong setup delay on SSH connections with (if I recall correctly) both the 2.3 SSH in 10.0.1 and the 2.5 SSH available from Scott Anguish.

If any of you have been experiencing long (dozens of seconds) waits in starting up SSH connections, it looks like 'arp' is being called with a parameter order that Apple's arp utility isn't handling as expected (Apple's utility wants 'arp -n -a' when SSH is using 'arp -a -n'). [Found this out by running ssh -v -v, after a bit of packet sniffing and DNS experimentation.]

Read the rest of this article if you'd like a workaround to speed up your SSH connections!


If you have references in your arp table that won't look up quickly (the -n is supposed to prevent symbolic lookup), that appears to be what imposes the delay. Whether these weird ARP cache entries are coming in through AirPort or System Prefs or a bug in some code, I know not.

Quick and Dirty solution is to flush out arp cache entries (which should be harmless) using 'sudo arp -d _____' for each numerical address in the 'arp -n -a' list that bogs down 'arp -a'.

Long term solution, I suspect, is to make the offending piece of code call the arp utility with the right parameter order, fix the arp utility itself to accept the different ordering, and/or find out where these entries are coming from.

I use the following Q&D script ('farp') to flush my ARP cache after waking up my machine
#!/bin/sh
BLEH=$(arp -n -a | cut -d '(' -f 2 | cut -d ')' -f 1)
echo $BLEH
for addr in $BLEH; do
sudo arp -d $addr
done
YMMV.
    •    
  • Currently 3.33 / 5
  You rated: 3 / 5 (3 votes cast)
 
[7,871 views]  

Work-around for long delays in SSH connections | 4 comments | Create New Account
Click here to return to the 'Work-around for long delays in SSH connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
ssh calls arp for entropy
Authored by: blb on Apr 24, '01 11:25:57PM

What you're seeing is ssh's built-in generation of random numbers. If you look at /etc/ssh_prng_cmds, you'll see that arp is called exactly as 'arp -a -n'. Try changing it here to '-n -a' and see if things are better.



[ Reply to This | # ]
ssh should use faster util for entropy
Authored by: Anonymous on Apr 25, '01 10:12:28PM

Better yet, it should get it from a good source - either egd (Entropy Gathering Daemon), available freely, or /dev/random, which does not yet exist, but should definitely be added by Apple.



[ Reply to This | # ]
Works Perfectly! (10.0.4)
Authored by: MuCow24 on Jul 05, '01 10:25:17PM

Worked wonders on 10.0.4... ssh is actually *faster* than telnet now!



[ Reply to This | # ]
Another way?
Authored by: robg on May 30, '01 12:34:44PM
This was submitted by "anonymous", and appears to be another way to remove the SSH delay. I have not tested this myself.

-----

The SSH delay is due to the fact that SSH runs arp with the flags "-an", which tickles an arp bug. Arp works fine if you call it with the flags in reverse order.

The simplest solution to this problem is to rename /usr/sbin/arp to /usr/sbin/arp.hack, then put the following text in the file /usr/sbin/arp:
#!/bin/sh 
/usr/sbin/arp.hack -n $@
Finally, run chmod +x /usr/sbin/arp. Now, SSH won't hang anymore.

[ Reply to This | # ]