CentOS7将firewalld换成iptables
2015-09-09 14:51
681 查看
CentOS7中用firewalld替代了iptables,默认情况下iptables是没有安装的,如果习惯使用iptables可以将firewalld关掉换成iptables。
1.首先关闭firewalld服务
2.安装iptables
3.配置iptables规则
3.开启iptables服务
4.保存
5.开机启动
1.首先关闭firewalld服务
systemctl stop firewalld systemctl mask firewalld systemctl disable firewalld
2.安装iptables
yum -y install iptables
3.配置iptables规则
# Generated by iptables-save v1.4.21 on Thu Sep 10 02:27:20 2015 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m tcp --dport 20 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT -A INPUT -p udp -m udp --dport 161 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-port-unreachable -A FORWARD -j REJECT --reject-with icmp-port-unreachable -A OUTPUT -j ACCEPT COMMIT # Completed on Thu Sep 10 02:27:20 2015
3.开启iptables服务
systemctl enable iptables systemctl start iptables
4.保存
service iptables save service iptables restart
5.开机启动
chkconfig iptables on
相关文章推荐
- linux用date更改时间还原
- Linux的内核态与用户态切换
- linux平常出现的一些故障
- linux sed 命令
- Linux GPIO 注册和应用
- CentOS6.6下bind搭建DNS服务器
- 29-学习linux其他知识补充
- 修改linux字符界面分辨率
- Linux中能ping通ip 不能ping通域名
- Centos默认的python2.6.6升级到python2.7.10全过程(包含setuptools/pip/django/yum设置)
- CentOS增加swap分区大小
- linux setsid 是什么东东
- linux 安装配置 postfix+pop3+sasl
- linux下的apue.3e安装[Unix环境高级编程]
- Linux战地日记——复制、删除和移动文件的命令
- 在CentOS 7系统上架设DNS服务
- 如何在CentOS的单用户模式下修改root的密码
- HowTo: Linux Server Change OR Setup The Timezone
- [NFS mount Error] System Error: No route to host.
- Linux下文件的压缩与打包