linux firewalls pdf,linux 配置防火墙(Linux configuring firewalls).doc

linux 配置防火墙(Linux configuring firewalls)

linux 配置防火墙(Linux configuring firewalls)

1。首先查看防火墙规则iptables - L - N

链输入(策略接受)

目标利润来源地的选择

链转发(策略接受)

目标利润来源地的选择

链式输出(策略接受)

目标利润来源地的选择

表示什么规则都没有

2。

iptables -F清除预设表滤波器中的所有规则链的规则

iptables的X清除预设表滤波器中使用者自定链中的规则

3.service iptables保存可以保存或者/ etc / rc.d/init.d/iptables保存

在本文的最下面有个天气网的防火墙实例,可以照着对/ etc / sysconfig / iptables做相应改动也可以执行下面的命令

4重启iptables。

重启防火墙

注意如果是用SSH远程的先执行下面的把22改成SSH配置端口,如果本机操作可以后面配置

iptables -输入-p tcp -运动22 -j ACCEPT

5。设定预设规则

才的那一句

iptables -P输出接受

iptables -P正向压降

上面的意思是,当超出了iptables里滤波器表里的两个链规则(输入,前锋)时,不在这两个规则里的数据包怎么处理呢,那就是滴(放弃)。应该说这样配置是很安全的。我们要控制流入数据包

6。添加链路

如果前面的规则输出设置的也是滴所有需要向外输出数据的都有加上iptables -输出-p tcp --体育22 -j ACCEPT

如果做了Web服务器,开启80端口。

iptables -输入-p tcp -运动80 -j ACCEPT

如果做了邮件服务器,开启25110端口。

iptables -输入-p tcp -运动110 -j ACCEPT

iptables -输入-p tcp -运动25 -j ACCEPT

如果做了FTP服务器,开启21端口

iptables -输入-p tcp -运动21 -j ACCEPT

7。允许ICMP包通过,也就是允许平,

iptables -输出- P ICMP -j ACCEPT(输出设置成滴的话)

iptables -输入P ICMP -j ACCEPT(输入设置成滴的话)

8允许回环!(不然会导致DNS无法正常关闭等问题)

iptables -输入-我罗- P - J接受(如果是输入滴)

iptables -输出-罗- P J接受(如果是产出下降)

9。如:我们只允许09的机器进行SSH连接

iptables -输入的09 -p tcp -运动22 -j ACCEPT

如果要允许,或限制一段IP地址可用/24表示-255端的所有IP

24 indicates the subnet mask number, but remember to delete this line from the /etc/sysconfig/iptables

-A INPUT -p TCP -m TCP --dport 22 -j ACCEPT, because it means all addresses can be landed

After you execute the above command, be sure to save service iptables save to save or /etc/rc.d/init.d/iptables save

10. below is the FORWARD chain, and the default rule for the FORWARD chain is DROP, so we write the chain that needs ACCETP (through) to monitor the forwarding chain

Turn on the forwarding function (when you do NAT, when the FORWARD default rule is DROP, you have to do it)

Iptables, -A, FORWARD, -i, eth0, -o, eth1, -m, state, --state, RELATED, ESTABLISHED, -j, ACCEPT

Iptables, -A, FORWARD, -i, eth1, -o, eh0, -j, ACCEPT

Discard bad TCP packages

Iptables, -A, FORWARD, TCP, --syn, -m, state, -p, --state, NEW, -j, DROP

Handling IP fragmentation to prevent attacks,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值