|
双光纤1g的网关服务器 流量上了600M 就扛不住了掉包严重,该怎么优化
出现很多下面的信息
- avahi-daemon[5619]: wide-area.c: Ignoring invalid response for wide area datagram.
- syslog-ng[5410]: last message repeated 5 times
- avahi-daemon[5619]: wide-area.c: Ignoring invalid response for wide area datagram.
- kernel: printk: 11 messages suppressed.
- kernel: UDP: bad checksum. From xxx.xxx.xxx.xxx:18369 to xxx.xxx.xxx.xxx:64771 ulen 1069
- avahi-daemon[5619]: wide-area.c: Ignoring invalid response for wide area datagram.
复制代码
snat代码是
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- anywhere anywhere to:xxx.xxx.xxx.1-xxx.xxx.xxx.254
服务器是两个4核 2G的CPU 4G内存
系统是 Linux linux-NAT 2.6.22.19-0.3-bigsmp #1 SMP 2009-05-27 10:35:34 +0200 i686 i686 i386 GNU/Linux
内存还很空
# free
total used free shared buffers cached
Mem: 4148208 2049220 2098988 0 126008 1528504
-/+ buffers/cache: 394708 3753500
Swap: 2103480 0 2103480
vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
3 0 0 2099764 126088 1528516 0 0 3 17 36 58 11 17 72 1
5 0 0 2098576 126088 1528516 0 0 0 0 0 33710 16 30 53 0
4 0 0 2099448 126088 1528516 0 0 0 0 0 33512 17 31 53 0
3 1 0 2098480 126092 1528512 0 0 0 148 7 33325 16 30 52 1
4 1 0 2098996 126096 1528516 0 0 0 32 7 32348 15 30 50 5
4 0 0 2099272 126096 1528520 0 0 0 0 2 33821 15 31 53 1
4 0 0 2099696 126096 1528520 0 0 0 0 0 33726 15 31 53 0
5 0 0 2099640 126096 1528520 0 0 0 0 0 33887 16 31 52 0
3 1 0 2099956 126096 1528520 0 0 0 104 25 33596 15 31 53 1
4 1 0 2099556 126096 1528520 0 0 0 32 7 33329 15 30 50 5
4 0 0 2099592 126096 1528520 0 0 0 0 2 34066 15 31 53 0
4 0 0 2099500 126096 1528520 0 0 0 100 6 33541 17 30 51 2
4 0 0 2099420 126096 1528520 0 0 0 0 0 33474 16 31 53 0
2 1 0 2100996 126096 1528520 0 0 0 124 10 33655 16 31 49 4
4 1 0 2099764 126096 1528520 0 0 0 132 12 33813 17 30 44 8
4 0 0 2100208 126096 1528520 0 0 0 4 3 33498 17 31 52 0
4 0 0 2099828 126096 1528520 0 0 0 0 0 33850 16 31 53 0
3 0 0 2100376 126096 1528520 0 0 0 0 0 34126 17 30 53 0
top 里面
top - 10:05:49 up 15:24, 4 users, load average: 4.37, 4.23, 4.19
Tasks: 128 total, 4 running, 122 sleeping, 2 stopped, 0 zombie
Cpu(s): 15.3%us, 6.0%sy, 0.0%ni, 52.1%id, 1.7%wa, 0.0%hi, 25.0%si, 0.0%st
Mem: 4148208k total, 2048140k used, 2100068k free, 126124k buffers
Swap: 2103480k total, 0k used, 2103480k free, 1528512k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6 root 39 19 0 0 0 R 100 0.0 25:23.91 ksoftirqd/1
18 root 39 19 0 0 0 R 100 0.0 25:28.52 ksoftirqd/7
3273 ulogd 15 0 6000 688 292 S 72 0.0 389:24.25 ulogd
5946 mysql 15 0 102m 15m 4356 S 8 0.4 63:52.65 mysqld
脚本里面有
ulimit 0
ulimit -f 10240000000
modprobe ip_conntrack hashsize=1048576
echo 3600 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established
echo 1048576 > /proc/sys/net/netfilter/nf_conntrack_count
echo "1024 65000" > /proc/sys/net/ipv4/ip_local_port_range
echo "100 1200 128 512 15 5000 500 1884 2">/proc/sys/vm/bdflush
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo "1048576" > /proc/sys/net/netfilter/nf_conntrack_max
echo "1048576" > /proc/sys/net/ipv4/tcp_max_tw_buckets
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "268435456" >/proc/sys/kernel/shmall
echo "536870912" >/proc/sys/kernel/shmmax
echo "1024" > /proc/sys/net/ipv4/neigh/default/gc_thresh1
echo "2048" > /proc/sys/net/ipv4/neigh/default/gc_thresh2
echo "4096" > /proc/sys/net/ipv4/neigh/default/gc_thresh3
echo "52428800" > /proc/sys/net/ipv4/route/max_size
echo "1" > /proc/sys/net/ipv4/conf/all/proxy_arp
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
iptables -A INPUT -p tcp --dport 3306 -j DROP
iptables -A INPUT -p tcp --dport 111 -j DROP
iptables -A INPUT -p tcp --dport 631 -j DROP
iptables -A INPUT -p tcp --dport 6010 -j DROP
iptables -A INPUT -p tcp --dport 6011 -j DROP
iptables -A INPUT -p tcp --dport 6012 -j DROP
iptables -A INPUT -p udp --dport 111 -j DROP
iptables -A INPUT -p udp --dport 631 -j DROP
#echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
iptables -A INPUT -p udp -j DROP
iptables -A INPUT -p tcp --dport ! 22 -j DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT |
|