fedora的firewall配置
fedora中iptables与firewall的关系

iptables用法

妙音 posted @ 2014年3月13日 15:44 in linux with tags 防火墙 , 2239 阅读
iptables过滤网络包. 属于网络层防火墙.
 
命令行设置
  • 启用端口
iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
 
  • 保存配置
sudo serivce iptables save
 
  • 重启iptables,使配置生效
sudo serivce iptables restart
 
配置文件
  • 永久生效
修改/etc/sysconfig/iptables文件
-A INPUT -p tcp --dport 8080 -j ACCEPT
注意要加在最后一个COMMIT前
 
否则会出现错误
Redirecting to /bin/systemctl restart  iptables.service
Job for iptables.service failed. See 'systemctl status iptables.service' and 'journalctl -xn' for details.
 
 
基本用法
  •  查看本机iptables设置
iptables -L -n
 
  •  启用端口
iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
 
  •  禁用端口
iptables -A INPUT -p tcp --dport 8000 -j REJECT
 
  •  清除规则
iptables -F   清除filter中的所有规则链的规则
iptables -X   清除filter中使用者自定链中的规则
 

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter