centos7 使用iptables配置防火墙
来源:互联网 发布:网络协议对应层次 编辑:程序博客网 时间:2024/06/05 18:34
centos7 默认是FirewallD 提供支持网络/防火墙区域(zone)定义网络链接以及接口安全等级的动态防火墙管理工具,利用FirewallD开启80端口操作上一篇已经介绍了,接下来介绍使用iptables来配置防火墙规则:
yum install iptables-servicessystemctl mask firewalld.servicesystemctl enable iptables.servicesystemctl enable ip6tables.service
静态防火墙规则配置文件是 /etc/sysconfig/iptables 以及 /etc/sysconfig/ip6tables .
注: iptables 与 iptables-services 软件包不提供与服务配套使用的防火墙规则. 这些服务是用来保障兼容性以及供想使用自己防火墙规则的人使用的. 你可以安装并使用 system-config-firewall 来创建上述服务需要的规则. 为了能使用 system-config-firewall, 你必须停止 firewalld.
为服务创建规则并停用 firewalld 后,就可以启用 iptables 与 ip6tables 服务了:
systemctl stop firewalld.servicesystemctl start iptables.servicesystemctl start ip6tables.service
打开防火墙添加端口:
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
重启防火墙:
service iptables restart
接下来就可以通过端口来远程访问了。
0 0
- centos7 使用iptables配置防火墙
- CentOS7下iptables防火墙配置
- centOS7 iptables防火墙配置脚本
- CentOS7使用iptables防火墙开放端口
- centos7下iptables防火墙的使用
- centos7 安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- CentOS7安装iptables防火墙
- C语言 程序 简单二进制题目
- 作为一个项目管理者要不要懂技术
- Ibus(pinyin)输入法输入错误
- CSDN爬虫(三)——网络爬虫模拟登陆两种策略
- hdu5572An Easy Physics Problem+计算几何
- centos7 使用iptables配置防火墙
- 安装过程出现错误: E: Package ‘vim’ has no installation candiate
- [LeetCode]223. Rectangle Area
- #include int inc(int a) { return(++a); } int multi(int*a,int*b,int*c) { return(*c=*a**b); }
- Android studio 2.2 NDK 开发
- 字符串与二维数组
- c语言中int什么意思以及什么是无符号和有符号整型
- java枚举 -- 基本使用
- 青头小白 win10下装mongodb,配置环境,随机启动