- 论坛徽章:
- 0
|
求救,一个进程占用资源太多的问题,如下
现在我已经按照楼上大侠提供的文档处理了,可还是那样。
我原来的处理没有这么严格,只是作了ip地址的转发和端口映射,现在把所有的外部请求全部禁掉,可是还是有问题。
现在我用tcpdump看,还是好多无关的ip来请求,我不知道怎么处理。
现在感觉非常的郁闷,不行又的拔网线。这个是小弟的fw.sh文件,请直角,谢谢!!
#!/bin/sh
EXT_IF="eth0"
INT_IF="eth1"
EXT_IP="*.*.*.*"
INT_IP="100.*.*.1"
LAN="100.*.*.0/24"
# load any special modules
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe ip_nat_irc
modprobe ip_conntrack_irc
# turn off ip forwarding
echo "0" >; /proc/sys/net/ipv4/ip_forward
# delete any existing chains
iptables -F -t filter
iptables -X -t filter
iptables -Z -t filter
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
# setting up default policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
#---------------------- filter ---------------------
# allow ping from internet
iptables -A INPUT -i $EXT_IF -p icmp -j ACCEPT
# enable local traffic
iptables -N allowed
iptables -A allowed ! -i $EXT_IF -m state --state NEW -j ACCEPT
iptables -A allowed -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -j allowed
iptables -A FORWARD -j allowed
iptables -A FORWARD ! -i eth0 -m state --state NEW -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT ! -i eth0 -m state --state NEW -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A PREROUTING -i $INT_IF -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -A POSTROUTING -t nat -s *.*.*.0/24 -o eth0 -j SNAT --to-source 211.*.*.*
#------------------------------------------------------------------------
# turn on ip forwarding
echo "1" >; /proc/sys/net/ipv4/ip_forward
# setting up ip spoofing protection
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo 1 >; $f
done
#文件结束
# allow ping from internet
iptables -A INPUT -i $EXT_IF -p icmp -j ACCEPT
这一句我不知道有没有必要?
现在机器的情况:
61 processes: 57 sleeping, 4 running, 0 zombie, 0 stopped
CPU0 states: 0.0% user, 97.4% system, 0.0% nice, 2.1% idle
CPU1 states: 0.0% user, 97.1% system, 0.0% nice, 2.4% idle
Mem: 2058788K av, 258868K used, 1799920K free, 928K shrd, 31800K buff
Swap: 2096472K av, 0K used, 2096472K free 106392K cached
ò
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
5 root 39 19 0 0 0 RWN 60.7 0.0 138:58 ksoftirqd_CPU1
4 root 39 19 0 0 0 RWN 58.9 0.0 142:48 ksoftirqd_CPU0
1853 squid 20 0 11904 11M 1304 R 42.1 0.5 19:54 squid
2161 root 17 0 1128 1128 896 R 9.0 0.0 0:38 top
1615 root 16 0 812 812 668 S 8.4 0.0 1:05 in.telnetd
1394 root 15 0 2964 2964 2396 S 2.2 0.1 3:04 magicdev
1390 root 15 0 9204 9204 6804 S 0.9 0.4 1:02 nautilus
20 root 16 0 0 0 0 SW 0.6 0.0 0:13 kjournald
868 root 15 0 496 496 424 S 0.3 0.0 0:41 gpm
2160 root 15 0 972 972 756 S 0.3 0.0 0:43 top
1860 root 15 0 4260 4260 3388 S 0.1 0.2 0:07 gnome-terminal
1 root 15 0 512 512 444 S 0.0 0.0 0:12 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 keventd
谢谢各位了!!! |
|