Editing the /etc/sysctl.conf file

I want to change this variables and make them permanent across reboots:
sysctl -w net.inet.tcp.sendspace=4000000
sysctl -w net.inet.tcp.recvspace=4000000

How do I edit the /etc/sysctl.conf file?

Posted on Oct 8, 2005 12:47 PM

Reply
11 replies

Oct 8, 2005 5:01 PM in response to Miguel Santa

Just use a plaintext editor like vi, emacs or pico (pico's probably the easiest to figure out) and put variable=value, one per line like:

net.inet.tcp.sendspace=4000000
net.inet.tcp.recvspace=4000000

CAUTION: make SURE that those values work OK before putting them in this file, otherwise the machine may not boot!

Roger

Oct 9, 2005 3:12 AM in response to Miguel Santa

You get an Idea of how the structure of a startup script is made by looking into:
/System/Library/StartupItems

copy one of the simpler script from there to /Library/StartupItems and edit the names of the directories and files and the content.

Here is documentation availible:
http://developer.apple.com/cgi-bin/search.pl?q=StartupItems&site=default_collect ion

Oct 9, 2005 7:09 AM in response to nobody loopback

I dont think, there is a sysctl.conf file in OSX.
What works, is to make a startupscript in /Library/StartupItems.
hello nobody,

I don't think that a StartupItem is necessary.
take a look at /etc/rc around line 50-60:

51 if [ -f /etc/sysctl-macosxserver.conf ]; then

52 awk '{ if (!index($1, "#") && index($1, "=")) print $1 }' < /etc/sysctl-macosx server.conf | while read

53 do

54 sysctl -w ${REPLY}

55 done

56 fi

57 if [ -f /etc/sysctl.conf ]; then

58 awk '{ if (!index($1, "#") && index($1, "=")) print $1 }' < /etc/sysctl.conf | while read

59 do

60 sysctl -w ${REPLY}

61 done

62 fi


Best regards
Martin

Nov 1, 2005 8:48 AM in response to Miguel Santa

I have been using TextEdit to edit the sysctl.conf, and it works fine.

Mind you, I am still in the process of working out the TCP parameters, and by no means am I an expert. Having said that, here is what works for me so far:

net.inet.tcp.delayed_ack=1
kern.ipc.maxsockbuf=2097152
kern.maxvnodes=17408
net.inet.ip.portrange.first=40000
net.inet.ip.portrange.hifirst=45000
net.inet.ip.portrange.hilast=65532
net.inet.ip.portrange.lowfirst=1022
net.inet.ip.portrange.lowlast=400
net.inet.tcp.recvspace=1048756
net.inet.tcp.sendspace=1048576
net.inet.tcp.rfc1323=0
net.inet.udp.maxdgram=57344
net.inet.udp.recvspace=84160
net.local.stream.recvspace=16000
net.local.stream.sendspace=16000

One of my help sources was www.speedguide.net

I also used www.speakeasy.net/speedtest/ to help check the connection as I tweaked the settings.

Some of the values seem ridiculously high, but they appear to work!

To make your sysctl file (if it isn't already there):

- paste the above settings into a plain text file
- save a copy to your account. Then (with admin access):
- place it in the invisible /private/etc folder which
resides in the HD's root directory

I hope this helps!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Editing the /etc/sysctl.conf file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.