Add these to /etc/sysctl.conf and reboot.
kern.ipc.maxsockbuf=16777216
net.inet.tcp.rfc1323=1
FreeBSD 7.0 added TCP send and receive buffer autotuning. There are some additional settings to modify.
(The default for these is 256 KB, which is too small):
net.inet.tcp.sendbuf_max=16777216
net.inet.tcp.recvbuf_max=16777216
Here are the new TCP Autotuning settings in 7.0 to know about. Defaults for these should be fine for 100BT hosts,
but recvbuf_inc in particular should be increased for 1 or 10 Gbps hosts. Here are the recommended settings:
net.inet.tcp.sendbuf_auto=1 # Send buffer autotuning enabled by default
net.inet.tcp.sendbuf_inc=16384 # step size
net.inet.tcp.recvbuf_auto=1 # enabled
net.inet.tcp.recvbuf_inc=524288 # step size
FreeBSD's TCP has something called
inflight limiting turned on by default. This is good
for modem connections, but can be detrimental to TCP throughput in some high-speed situations.
If you want "normal" TCP Reno-like behavior, set this:
net.inet.tcp.inflight.enable=0
By default, FreeBSD caches connection details such as
the slow start threshold and the congestion windows size from the previous connection
to the same host for 1 hour. While this is a good idea for a web server, it makes it hard to do
network throughput testing, as 1 large congestion event will throttle performance
for the next hour. To reduce this effect, set this:
net.inet.tcp.hostcache.expire=1
This will still cache values for 5 minutes, for reasons described in
this
article from the Centre for Advanced Internet Architectures (CAIA) at Swinburne University
in Autralia. This article has a lot of other good tuning information for FreeBSD too. They also have a
H-TCP patch for FreeBSD that
looks useful.
Some additional information on NetBSD tuning can be found
here.
Note: FreeBSD versions before 4.10 don't have SACK implemented, which limits
its throughput considerably compared to other operating systems.
You should upgrade to 4.10 or higher.