#!/bin/sh # # Kernel tuning for MacOS X.3 # Paul Day, paul ( at ) bur.st # # Either run this as root each time you reboot, or # add it into /etc/sysctl.conf as "variable = value" # IPC max number of incoming connections in queue sysctl -w kern.ipc.somaxconn=1024 # IPC max buffering sysctl -w kern.ipc.maxsockbuf=523288 # IPC max number of sockets sysctl -w kern.ipc.maxsockets=2048 # And nmb clusters sysctl -w kern.ipc.nmbclusters=16384 # Set max number of processes sysctl -w kern.maxproc=2048 # Set max number of vnodes sysctl -w kern.maxvnodes=20784 # Set max number of files sysctl -w kern.maxfiles=15000 # Time out dead NFS connections a little quicker. # Put this up for 10.3 as it handles them well itself. sysctl -w vfs.generic.nfs.client.initialdowndelay=15 sysctl -w vfs.generic.nfs.client.nextdowndelay=15 # Tune IP port ranges sysctl -w net.inet.ip.portrange.first=40000 sysctl -w net.inet.ip.portrange.hifirst=45000 sysctl -w net.inet.ip.portrange.hilast=65532 sysctl -w net.inet.ip.portrange.last=65535 sysctl -w net.inet.ip.portrange.lowfirst=1022 sysctl -w net.inet.ip.portrange.lowlast=400 # Other network buffering sysctl -w net.local.stream.recvspace=16000 sysctl -w net.local.stream.sendspace=16000 sysctl -w net.local.dgram.recvspace=8000 # keep the following at 24k for decent ssh, even while still downloading # Up to 65535 for faster downloads when you have decent latency-free bandwidth # (ie, _not_ DSL which dies badly as it saturates) sysctl -w net.inet.tcp.sendspace=24000 sysctl -w net.inet.tcp.recvspace=24000 sysctl -w net.inet.udp.recvspace=41600 sysctl -w net.inet.raw.recvspace=8192 sysctl -w net.local.dgram.maxdgram=4196 # Turn off RFC1323 TCP large windows. sysctl -w net.inet.tcp.rfc1323=0 # Enable Path MTU discovery sysctl -w net.inet.tcp.path_mtu_discovery=1 # ICMP limit sysctl -w net.inet.icmp.icmplim=1024 # Stop redirects sysctl -w net.inet.icmp.drop_redirect=1 sysctl -w net.inet.icmp.log_redirect=1 sysctl -w net.inet.ip.redirect=0 # Stop source routing sysctl -w net.inet.ip.sourceroute=0 sysctl -w net.inet.ip.accept_sourceroute=0 # Stop broadcast ECHO response sysctl -w net.inet.icmp.bmcastecho=0 # Stop other broadcast probes sysctl -w net.inet.icmp.maskrepl=0 # TCP delayed ack off sysctl -w net.inet.tcp.delayed_ack=0 # Turn off forwarding sysctl -w net.inet.ip.forwarding=0 # Turn on strong TCP sequencing sysctl -w net.inet.tcp.strict_rfc1948=1 # Make ipfw debugging verbose sysctl -w net.inet.ip.fw.verbose=1 sysctl -w net.inet.ip.fw.verbose_limit=65535 # Make Safari time-out smaller defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25