升级一下iptables

不知道为啥最近服务器总是爆内存死掉
多方求助下东哥给了一段流弊的解决方案:

iptables -A INPUT -p tcp --dport 80 --tcp-flags FIN,SYN,RST,ACK SYN -m connlimit --connlimit-above 10 --connlimit-mask 32 --connlimit-saddr -j REJECT --reject-with tcp-reset

iptables-save >/etc/sysconfig/iptables

但是我在运行的时候却提示 connlimit-saddr 有问题.

查了一番估计可能是iptables版本过低,赶紧升级一下:

yum update 
rpm -e --nodeps iptables-1.4.7-9.el6.i686
rpm -e --nodeps iptables-ipv6-1.4.7-9.el6.i686
yum groupinstall 'Development Tools'
wget http://www.netfilter.org/projects/iptables/files/iptables-1.4.19.tar.bz2
tar jxvf iptables-1.4.19.tar.bz2
cd iptables-1.4.19
LDFLAGS="-L$PWD/libiptc/.libs" ./configure --prefix=/usr --exec-prefix= --bindir=/usr/bin --with-xtlibdir=/lib/xtables --with-pkgconfigdir=/usr/lib/pkgconfig --enable-libipq --enable-devel
make
make install

不幸的是折腾一番后问题还是未解决...
明天继续吧.悲囧

linode关于爆内存重启的解决办法:
https://www.linode.com/wiki/index.php/Rebooting_on_OOM

Rebooting on OOM

In some situations, it may be beneficial to have your Linode automatically reboot if it runs out of memory. You can leverage a couple kernel settings and Lassie to make this happen.
NOTE: This is an inherently unclean reboot. You will encounter disk corruption or other tragedies if this occurs at a bad time. Additionally, if you end up in a situation where you run out of memory right after boot, you'll enter an unclean reboot loop which will increase your chances of having a tragic day. The most important rule is to always ensure you have up-to-date, available, off-site backups of your Linode's data. In the event non-backed-up data is lost, please send a self-addressed, stamped envelope to World's Smallest Violin Giveaway, Box 17821, Pound Ridge Station.

Enable Lassie

Lassie, the Linode Autonomous System Shutdown Intelligent rEbooter, will issue a boot command should it find your kernel not running. You can ensure this is enabled from the Dashboard at Settings & Utilities -> Shutdown Watchdog.

Edit /etc/sysctl.conf

Adding the following two lines to your /etc/sysctl.conf will cause it to reboot after running out of memory:

vm.panic_on_oom=1
kernel.panic=10

The vm.panic_on_oom=1 line enables panic on OOM; the kernel.panic=10 line tells the kernel to reboot ten seconds after panicking.
[edit]Make the change live

You can make the change live now (vs. on a reboot) with:

echo 1 > /proc/sys/vm/panic_on_oom
echo 10 > /proc/sys/kernel/panic

小 虾

哦也,我是小虾

暂无评论

发表评论

您的电子邮件地址不会被公开,必填项已用*标注。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

相关推荐

Ubuntu 安装 GUI 及远程桌面 Xrdp

最近节点总是出问题, 为了以防万一, 给服务器装个图形界面, 应急处理广告投放数据使用. Ubuntu 的桌面环境有很多, 默认的是 Gnome, 另外一个选项就是安装 xfce. 它是快速, 稳定, 并且轻量的桌面环境, 使得它成为远程 ...

macOS 下 GoAccess 踩坑

安装好 GoAccess 后, 即便设置好日志时间格式, 还是会报错. 经过查找后发现是 Mac 用户需要声明 LANG 命令参考: LANG="en_US.UTF-8" goaccess --no-global-config --log-format='%h - %^ [%d:%t %^] "%m %U %H" %s % ...

ServerStatus 感觉不错, 记录一下配置过程

最近服务器有点多, 于是打算搞个探针监控一下, hostloc上看到ServerStatus的讨论比较多, 那就选它了! 安装有2种方法, 由于已经先安装了宝塔, 就选择手动安装了. 跟着教程来【克隆代码】: git clone https://github.c ...