Avoiding natd overhead

Chris Bowman chrishome at austin.rr.com
Sat Oct 21 14:24:12 UTC 2006


First, sorry for the double post, received a message saying the first
one was rejected by a spam filter, however I now see it's on the
list! ;)

Of course you may ask for more help!  First, take advantage of what's
out there, people have written some absolutely great documentation,
including the FreeBSD handbook, a reference which I have out near 24/7.
Specifically for the problem at hand though, read up on the following :
FreeBSD Handbook chapter 21, man make.conf , man make , and
http://pages.silverwraith.com/papers/6/ .  

If you have the correct sources synced, refer to chapter 21 in the
handbook again if not sure.   Then take the following out for a test
drive.

cd /usr/src/sbin/natd

make -DCPUTYPE=pentium4  <== I happen to have a p4, insert your correct
cpu type.

Now, make a backup of your existing natd binary, cp /usr/sbin/natd to
the location of your choice maybe /home/username/

from /usr/src/sbin/natd now type  make install

do a ls -lah /usr/sbin/natd   you should see a new natd binary with the
date / time you compiled it, ie recent.  

Restart natd, or start it if it's not, and see how it goes!

If something goes wrong, you can always copy your backup
to /sbin/natd . 


This should get you started, theres some more optimizing you can do, but
I figure start here without adding to many variables to the mix.  And
just adding the CPU type to the make flags as shown above, seems to be
the single largest factor in making natd run as you would expect.  

Thanks!

Chris Bowman







On Sat, 2006-10-21 at 14:41 +0100, Spadge wrote:
> Chris Bowman wrote:
> >  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, 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.
> 
> This is pretty interesting stuff, and something I'm going to have to 
> look into.
> 
> Could I be incredibly presumptious and ask you for some more info to get 
> me started on my way?
> 
> Where would I start looking for info on what make flags are available 
> for natd and my CPUs? I'm not seeing anything helpful in the README and 
> my Makefile is very short.
> 
> Thanks for any help.
> 
> 



More information about the freebsd-net mailing list