Avoiding natd overhead

Chris Bowman daiyon.fbsd at gmail.com
Sat Oct 21 13:38:27 UTC 2006


 I see this question come up now and then on the lists, so, I'll share what
I've learned about natd and performance!  First, if your running natd on a
processor which supports more functions than just a standard 386,  ie a
Pentium, Athlon, etc.  Then I've found compiling natd with make flags for
that processor, and with O3 optimizations will make your jaw drop in
comparison to the default installed version of natd.  You can find if you
have the sources downloaded for FreeBSD the natd source in
/usr/src/sbin/natd , just recompile natd itself, copy the new binary you
compile to wherever your current natd binary is installed, /sbin/natd
likely.  just recompile natd itself, or when you re-build world for your
system, make sure you have make flags set in make.conf so everything will
rebuild with optimized flags, however I don't recomend O3 at all for a build
world, will almost definately break something, for natd itself, it works
fine.  Just to note, make sure if you only recompile natd itself, and don't
rebuild world, that you download sources for the version which you are
currently running, nothing newer.


 That's about it! Very simple, but I think it's often overlooked, and of
course there are a few  variables with NAT and performance, number of hosts,
number of connections each host is using simulataneously (Torrents *cough).
You don't want to overload NATd itself, 65535 TCP, UDP ports, keep that in
mind.  If your doing nat for a large number of hosts, break down your ip
range into sections and run natd multiple times to help balance the load.
Thanks!

Chris Bowman


More information about the freebsd-net mailing list