转:db2 iptables相关用法(1)
Chain INPUT (policy ACCEPT)
target prot opt source destination
target prot opt source destination
target prot opt source destination
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:25
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
可以看出我在安装linux时,选择了有防火墙,并且开放了22,80,25端口.
Chain INPUT (policy ACCEPT)
target prot opt source destination
target prot opt source destination
target prot opt source destination
[root@tp ~]# iptables -X 清除预设表filter中使用者自定链中的规则
Chain INPUT (policy ACCEPT)
target prot opt source destination
target prot opt source destination
target prot opt source destination
上面的意思是,当超出了IPTABLES里filter表里的两个链规则(INPUT,FORWARD)时,不在这两个规则里的数据包怎么处理呢,那就是DROP(放弃).应该说这样配置是很安全的.我们要控制流入数据包
如果做了邮件服务器,开启25,110端口.
[root@tp ~]# iptables -A INPUT -p tcp --dport 25 -j ACCEPT
如果做了FTP服务器,开启21端口
IPTABLES -A OUTPUT -o lo -p all -j ACCEPT(如果是OUTPUT DROP)
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
target prot opt source destination
SNAT all -- 192.168.0.0/24 anywhere to:211.101.46.235
target prot opt source destination
[root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 172.16.0.0/12 -j DROP
[root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 192.168.0.0/16 -j DROP
如果我们想,比如阻止MSN,QQ,BT等的话,需要找到它们所用的端口或者IP,(个人认为没有太大必要)
[root@tp ~]# iptables -t nat -A PREROUTING -d 211.101.46.253 -j DROP
[root@tp ~]# iptables -A INPUT -m state --state INVALID -j DROP
[root@tp ~]# iptables -A OUTPUT -m state --state INVALID -j DROP
[root@tp ~]# iptables-A FORWARD -m state --state INVALID -j DROP
允许所有已经建立的和相关的连接
[root@tp ~]# iptables-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@tp ~]# iptables-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@tp ~]# /etc/rc.d/init.d/iptables save
这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用.
[root@tp ~]# service iptables restart
别忘了保存,不行就写一部保存一次.你可以一边保存,一边做实验,看看是否达到你的要求,
转:db2 iptables相关用法(1)的更多相关文章
- 转:db2 iptables相关用法(2)
Centos 6 iptables 配置 Ben 2011/12/24 [root@localhost ben.liu]# service iptables status Table: filter ...
- linux中iptables的用法
iptables基本操作笔记 一.基本操作 #启动防火墙 service iptables start #停止防火墙 service iptables stop #重启防火墙 service ipta ...
- slf4j log4j logback关系详解和相关用法
slf4j log4j logback关系详解和相关用法 写java也有一段时间了,一直都有用slf4j log4j输出日志的习惯.但是始终都是抱着"拿来主义"的态度,复制粘贴下配 ...
- $.ajax等相关用法
下面是jquery一些方法的相关用法: $.ajax: $.ajax({ type: "GET", url: "url", data: {username:$( ...
- oradmin相关用法
[转]oradmin相关用法 创建例程: -NEW -SID sid | -SRVC 服务 [-INTPWD 口令] [-MAXUSERS 数量] [-STARTMODE a|m] [-PFILE 文 ...
- #ifdef预编译相关用法
#ifdef预编译相关用法主要有:(1)#ifdef XXX executing the corresponding xxx code #endif(2)#ifdef XXX executing th ...
- Java中Date各种相关用法
Java中Date各种相关用法(一) 1.计算某一月份的最大天数 Java代码 Calendar time=Calendar.getInstance(); time.clear(); time.set ...
- Js相关用法个人总结
Js相关用法个人总结 js中将数组元素添加到对象中var obj = {}; var pushArr = [11,22,33,44,55,66]; for(var i=0;i<pushArr. ...
- Css相关用法个人总结
Css相关用法个人总结
随机推荐
- 获取css style值
var obj=document.getElementById("btn");var currentStyle=null;if(obj.currentStyle){ current ...
- Linux-VLAN
Why Vlan? VLAN是为解决以太网的广播问题和安全性而提出的一种协议,它在以太网帧的基础上增加了VLAN头,用VLAN ID把用户划分为更小的工作组,限制不同工作组间的用户二层互访,每个工作组 ...
- [转]powerDesigner生成excel版本的数据库文件
powerDesigner生成excel版本的数据库文件 出处:http://ray-allen.iteye.com/blog/1893347 脚本 excel 今天收到一个需求,要把数据库设计给一 ...
- Css杂谈
CSS是Cascading Style Sheets(级联样式表)的缩写. CSS涉及字体.颜色.边距.高度.宽度.背景图像.高级定位等方面. HTML可以用于为网站添加布局效果,但有可能被误用.而C ...
- 【转发】linux文件系统变为只读的修复
详细解决方法:http://smartmontools.sourceforge.net/badblockhowto.html 相关问题,更换硬盘:http://blog.chinaunix.net/u ...
- HDFS的可靠性
HDFS的可靠性 1.冗余副本策略 2.机架策略 3.心跳机制 4.安全模式 5.校验和 6.回收站 7.元数据保护 8.快照机制 1.冗余副本策 ...
- 最好的Java IDE之争:Eclipse PK IntelliJ IDEA
话说,好马配好鞍,一个好的工匠,必定要有一套好的工具才能打造出最好的工艺给大家.之前,Plumbr团队里的所有成员都使用Eclipse编辑器,而如今,大家都成为IntelliJ IDEA用户.那么,到 ...
- ODI 12.1.3发布,提升支持大数据的能力
此次发布的ODI新版本,目的是更好的支持当前市场上的大数据平台. 大数据基因在不改变ODI工作效率的情况下,ODI增加了越来越多的数据源集成能力.ODI是在Oracle平台上标准的E-LT工具,事实上 ...
- iOS 中 #import同@class之间的区别
很多刚开始学习iOS开发的同学可能在看别人的代码的时候会发现有部分#import操作写在m文件中,而h文件仅仅使用@class进行声明,不禁纳闷起来,为什么不直接把#import放到h文件中呢? 这是 ...
- hdu 2089
PS:额...暴力打表...今天学到的新名词..记得把数组开到100W.. 代码: #include "stdio.h" ]; int cal(int a); int main() ...