ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

云路由vyatta的体验报告(六):防火墙功能

2014-1-4 22:59| 发布者: admin| 查看: 665| 评论: 0

摘要: vyatta提供了强大的基于iptables的高级防火墙功能。 如果你没有定义防火墙,vyatta默认策略会禁止所有入站端口,放行所有出站。 vyatta的防火墙使用规则是这样的: 1、定义好规则模板。 2、将规则置于网卡之 ...

vyatta提供了强大的基于iptables的高级防火墙功能。

如果你没有定义防火墙,vyatta默认策略会禁止所有入站端口,放行所有出站。

vyatta的防火墙使用规则是这样的:

1、定义好规则模板。

2、将规则置于网卡之上生效。

比如开放http端口到公网:

  1. set firewall name LAN-IN rule 10 action accept 
  2. set firewall name LAN-IN rule 10 description "allow http access from public" 
  3. set firewall name LAN-IN rule 10 protocol tcp 
  4. set firewall name LAN-IN rule 10 destination port http 
  5.  
  6. 这样就放行了所有对公网的web访问 

 

再比如要限制公网的ssh访问:

  1. set firewall name LAN-IN rule 20 action accept  
  2. set firewall name LAN-IN rule 20 description "allow ssh access from some IP"  
  3. set firewall name LAN-IN rule 20 protocol tcp  
  4. set firewall name LAN-IN rule 20 destination port ssh 
  5. set firewall name LAN-IN rule 20 source address 202.96.134.133  

再比如限制对内某台机器的访问,譬如邮件服务器:

  1. set firewall name LAN-IN rule 30 action accept  
  2. set firewall name LAN-IN rule 30 description "allow smtp access from public to mail server"  
  3. set firewall name LAN-IN rule 30 protocol tcp  
  4. set firewall name LAN-IN rule 30 destination port smtp  
  5. set firewall name LAN-IN rule 30 destination address 10.0.0.8 

状态防火墙:

  1. set firewall name STATE-RULE description "Filter traffic statefully" 
  2. set firewall name STATE-RULE rule 1 action accept 
  3. set firewall name STATE-RULE rule 1 state established enable 
  4. set firewall name STATE-RULE rule 1 state related enable 
  5.  
  6. set firewall name STATE-RULE rule 2 action drop 
  7. set firewall name STATE-RULE rule 2 state invalid enable 
  8. set firewall name STATE-RULE rule 2 log enable 
  9.  
  10. commit 

将上面的策略放在公网网卡上:

  1. set interfaces ethernet eth1 firewall in name LAN-IN  
  2. set interfaces ethernet eth1 firewall in name STATE-RULE 

注意上面的in,在vyatta的防火墙中有三条通道:

in 指的是入站。

out 指的是出站。

local 指的是防火墙本机 。

vyatta的防火墙还有基于其他策略的高级规则链,这里略过,详情参考官网文档。

( 作者:紫色葡萄 )

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2024-5-19 04:57 , Processed in 0.079673 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部