现在的位置: 首页 > 综合 > 正文

linux 禁止某个IP访问本机

2013年03月01日 ⁄ 综合 ⁄ 共 195字 ⁄ 字号 评论关闭

#!/bin/bash

if [ $# -ne 1 ];then
        echo "usage : $0 ip "
        exit 0
fi
DENY_IP="$1"
iptables -I INPUT -s $DENY_IP -j DROP
if [ $? -eq 0 ];then
        echo "$DENY_IP" >> deny_ip_list
fi
/etc/rc.d/init.d/iptables save
~                               

抱歉!评论已关闭.