当前位置:首页 » 专业资讯
开发技术指南» 文章正文
    引言: 一、链的基本操作 1、清除所有的规则。
 

 

 ·#计算某日前若干天日期    »显示摘要«
    摘要:#计算某日前若干天日期 #date=yyyymmdd #usage:command date day get_before_days() { str= days= yy=`echo $str|cut -c 1-4` mm=`echo $str|cut -c 5-6` dd=`echo $str|cut -c 7-8` sav_dd=$days days=`expr $days - $dd` while [ $days -ge 0 ] do mm=`expr......
 ·常用的 bash 比较运算符    »显示摘要«
    摘要:下表列出最常用的 bash 比较运算符。同时还有如何正确使用每一选项的示例。示例要跟在 "if" 之后。例如if [ -z "$myvar" ]then echo "myvar is not defined"fi运算符描述示例文件比较运算符-e filename 如果 filename 存在,则为真[ -e /var/log/syslog ]-d filename 如果 filename 为目录,......


iptables 基本命令详解
iptables

iptables 基本命令使用举例

【相关文章:基于反相代理的Web缓存加速(下)

【扩展阅读:Linux防火墙上的Apache反向代理

1、清除所有的规则。 【扩展信息:基于反相代理的Web缓存加速(上)

一、链的基本操作

1)清除预设表filter中所有规则链中的规则。

# iptables -f

2)清除预设表filter中使用者自定链中的规则。

#iptables -x

#iptables -z

2、设置链的默认策略。一般有两种方法。

1)首先允许所有的包,然后再禁止有危险的包通过放火墙。

#iptables -p input accept

#iptables -p output accept

#iptables -p forward accept

2)首先禁止所有的包,然后根据需要的服务允许特定的包通过防火墙。

#iptables -p input drop

#iptables -p output drop

#iptables -p forward drop

3、列出表/链中的所有规则。默认只列出filter表。

#iptables -l

4、向链中添加规则。下面的语句用于开放网络接口:

#iptables -a input -i lo -j accept

#iptables -a output -o lo -j accept

#iptables -a input -i eth0 -j acept

#iptables -a output -o eth1 -j accept

#iptables -a forward -i eth1 -j accept

#iptables -a forward -0 eth1 -j accept

注意:由于本地进程不会经过forward链,因此回环接口lo只在input与output两个链上作用。

5、使用者自定义链。

#iptables -n custom

#iptables -a custom -s 0/0 -d 0/0 -p icmp -j drop

#iptables -a input -s 0/0 -d 0/0 -j drop

二、设置基本的规则匹配

1、指定协议匹配。

1)匹配指定协议。

#iptables -a input -p tcp

2)匹配指定协议之外的所有协议。

#iptables -a input -p !tcp

2、指定地址匹配。

1)指定匹配的主机。

#iptables -a input -s 192.168.0.18

2)指定匹配的网络。


...   下一页
 ·apache 补充    »显示摘要«
    摘要:1。关于出错页面的小结include conf.d/*.conf 所有在conf.d下的以.conf结尾的文件作为补充配置文件。在el3中有conf.d/welcome.conf内容<locationmatch "^/$> options -indexes errordocument 403 /error/noindex.html</locationmatch>作用是当 目录下无index文件时,自动转到/error/no......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE