 |
 |
TCP Keepalive
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Location: Utah
Status:
Offline
|
|
My cablemodem's NAT reaps "idle" connections quite rapidly. How can I change the keepalive settings for TCP under OSX, so that my router doesn't close them? I've found websites for how to do it with Windows and Linux; but can't seem to figure out where it's at in system ten.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Toronto
Status:
Offline
|
|
Using the command "sysctl -a" under Terminal it lists a "net.inet.tcp.always_keepalive: 0" for me... I don't know if that's what you need though, but it sounds like it!
To change the value the syntax should be like this (and then obviously you can run "sysctl -a" again to check if it made the change)
sudo sysctl -w net.inet.tcp.always_keepalive=xx
Hope this helps!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Location: Utah
Status:
Offline
|
|
Originally posted by tRr:
Using the command "sysctl -a" under Terminal it lists a "net.inet.tcp.always_keepalive: 0" for me... I don't know if that's what you need though, but it sounds like it!
To change the value the syntax should be like this (and then obviously you can run "sysctl -a" again to check if it made the change)
Hope this helps!
Perfect!
It works like a charm. I also had to tweak the net.inet.tcp.keepidle parameter as well (down to 60 seconds; which is fine for my desktop -- but I'd never do that on a busy machine/server!).
Is there a cannonical listing of all the kernel paramaters? I just used the Linux documentation because the names happened to match up to the proc filesystem more or less. Also, is this persistent across reboots, or do I have to put it in some initialization file for every time OSX comes back up?
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Toronto
Status:
Offline
|
|
It isn't persistent across reboots to my knowledge. If you want to hold your changes across reboots, the easiest way I know would be to download this program (and it'll be more or less done for you).
http://www.enigmarelle.com/sw/BroadbandOptimizer/
I always use the manual installation (just drop the folder into /Library/StartupItems/). Then just edit the file called "BroadbandOptimizer", and you should probably see what's it's trying to do right away if we have gone this far.
I wish I could help you with your other question (it sounds cool enough), but I'm suprised what I have told you so far has held together!!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Location: Utah
Status:
Offline
|
|
Great; I just added the commands so that /Library/StartupItems/BroadbandOptimizer/BroadbandOptimizer looks like this now (for anyone who finds this thread in the future):
#!/bin/sh
##
# Broadband Optimizer
# optimize networking for broadband connection
##
. /etc/rc.common
#CheckForNetwork
StartService ()
{
ConsoleMessage "Starting Broadband Optimizer"
/usr/sbin/sysctl -w net.inet.tcp.sendspace=65536 > /dev/null
/usr/sbin/sysctl -w net.inet.tcp.recvspace=65536 > /dev/null
/usr/sbin/sysctl -w kern.ipc.maxsockbuf=524288 > /dev/null
/usr/sbin/sysctl -w net.inet.tcp.delayed_ack=0 > /dev/null
/usr/sbin/sysctl -w net.inet.udp.recvspace=73728 > /dev/null
/usr/sbin/sysctl -w net.inet.tcp.always_keepalive=1 > /dev/null
/usr/sbin/sysctl -w net.inet.tcp.keepidle=60 > /dev/null
/usr/sbin/sysctl -w net.inet.tcp.keepintvl=30 > /dev/null
/usr/sbin/sysctl -w net.inet.tcp.keepinit=60 > /dev/null
ConsoleMessage -S
}
StopService ()
{
return 0
}
RestartService ()
{
return 0
}
RunService "$1"
Thanks again for the pointers.  I wonder how hard it would be to create a general-purpose kernel parameter tweaker for the System Preferences...
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |