CentOS7中使用iptables
来源:互联网 发布:网络共享盘出现问题 编辑:程序博客网 时间:2024/06/08 13:46
CentOS7中使用iptables
转载自 http://blog.csdn.net/u012486840/article/details/53161555
1、关闭firewall:
systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动
2、安装iptables防火墙
#安装yum install iptables-services
编辑防火墙配置文件
vi /etc/sysconfig/iptables
# sample configuration for iptables service# you can edit this manually or use system-config-firewall# please do not ask us to add additional ports/services to this default configuration*filter:INPUT ACCEPT [0:0]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [0:0]-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT-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-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibitedCOMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效systemctl enable iptables.service #设置防火墙开机启动
3、关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉#SELINUXTYPE=targeted #注释掉SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效
阅读全文
0 0
- CentOS7中使用iptables
- CentOS7中使用iptables
- CentOS7下使用iptables
- 在centos7中使用service iptables stop 显示not loaded
- centOS7中关闭firewall,并使用iptables管理防火墙
- 解决centos7中使用service iptables stop 显示not loaded
- 解决centos7中使用service iptables stop 显示not loaded
- centos7中iptables启动失败
- centos7 使用iptables配置防火墙
- CENTOS7使用iptables端口转发
- centos7 在iptables中增加通行端口
- CentOS7使用iptables防火墙开放端口
- centos7下iptables防火墙的使用
- CentOS7使用firewalld控制防火墙,以及使用iptables设置
- 【原创】Centos7.0 中的中iptables、firewall和SELINUX
- Centos7.0 中的中iptables、firewall和SELINUX
- Centos7使用systemctl start iptables.service不起作用解决方法
- openstack中iptables的使用
- 使用百度地图API实现地图生成、标记以及标注
- Android Studio 导出Apk出现 Error "XXXX" is not translated in "XXXX"
- 一些疑问与记录
- vux中插件之踩坑
- c++类的函数重载、重写示例
- CentOS7中使用iptables
- 欢迎使用CSDN-markdown编辑器
- android studio导入项目出现的问题:expected reference but got (raw string) @+android:style/Animation.Translucen
- 编写SQL Server函数统计两日期间的工作日天数
- 五子棋实现(拖延症患者)
- Mysql 学习 (一) limit
- 171129之Java高效读取大文件
- HDOJ 2502 月之数
- HTML 图像