IPFW NATD, dhcpd mysql high cpu usage

Ok, I'm stumped. I've built tons of these routers over the years, pretty much same configuration. When I access a site, the site calls the MySQL database, and using nload I see a ton of traffic. When I run top, dhcpd is using a ton of CPU. Should MySQL be running through natd? How do I prevent this?

ipfw.rules file I call: (the commented out line fixes my problem, but dhcpd will not give out addresses then!)
Code:
ipfw -f flush

#/sbin/ipfw add divert natd all from 10.0.0.0/0 to any via em0
/sbin/ipfw add divert natd all from any to any via em0


#ipfw add 00099 pass udp from any 67 to any 68 in recv re0
ipfw add 00101 check-state

natd.conf

Code:
interface em0
use_sockets yes
same_ports yes
dynamic yes
redirect_port tcp 10.0.0.12:23 23
#redirect_port tcp 10.0.0.102:21 21
redirect_port tcp 10.0.0.100:80 8080
#redirect_port tcp 10.0.0.81:5900 8081
redirect_port tcp 10.0.0.57:80 90

rc.conf:
Code:
hostname="rtr"
ifconfig_em0="DHCP"
ifconfig_re0="inet 10.0.0.1 netmask 255.255.255.0"


sshd_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
dhcpd_enable="YES"
mysql_enable="YES"
cupsd_enable="YES"
#snmpd_enable="YES"
apache22_enable="YES"
mpd_enable="YES"
mpd_flags="-b -s mpd5"
#ntop_flags="-d --use-syslog=daemon -A -4"

ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntpd_config="/etc/ntp.conf"

Code:
last pid:  1640;  load averages:  0.86,   0.40,  0.29                                                                                            up 0+02:13:06  21:43:45
44 processes:  3 running, 41 sleeping
CPU 0: 13.3% user,  0.0% nice, 45.3% system, 16.4% interrupt, 25.0% idle
CPU 1:  4.7% user,  0.0% nice, 51.6% system, 10.2% interrupt, 33.6% idle
Mem: 47M Active, 211M Inact, 76M Wired, 45M Buf, 1596M Free
Swap: 4096M Total, 4096M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
 1459 root          1  97    0 28908K  2340K RUN     0   1:04  80.37% natd
  813 dhcpd         1   4    0 24360K 12884K RUN     1   3:49  41.70% dhcpd

I don't understand why dhcpd spikes when I load the webpage???
 
Ok, well hmm.. I decided in an ill attempt to stop this from driving me crazy, but I switched the interface around and it seems to work? Any light on the subject please?
 
I'm speculating that since dhcpd uses the raw bpf() device for listening for packets, it incurs some overhead ignoring unrelated traffic. Are you using CURRENT by any chance? I saw something along the lines of this but for dhclient rather than dhcpd server. You may be able to alleviate it by not listening on all interfaces like shown below.

Code:
dhcpd_ifaces="re0"
 
Back
Top