CentOS7.2 切换成iptables规则
关闭firewall
service firewalld stop
systemctl disable firewalld.service #禁止firewall开机启动
安装iptables规则:
yum install iptables-services #安装
打开/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 -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
修改成:
# 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 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
添加了80,8080
service iptables start #开启
systemctl enable iptables.service #设置防火墙开机启动
基本操作:
service iptables status #查看iptables状态
service iptables restart #iptables服务重启
service iptables stop #iptables服务禁用
http://blog.csdn.net/xlgen157387/article/details/52672988
CentOS7.2 切换成iptables规则的更多相关文章
- iptables规则进阶
iptables规则进阶 1.实验环境搭建: 在进行试验之前,先要进行实验环境的搭建,要求如下: 1.对于三台主机,分别设置IP地址 2.设置10.0.1.22为内网主机 3.设置中间主机有两个网卡, ...
- CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙
官方文档介绍地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Gui ...
- CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙--转载
最近在linux(这里用到的是Centos7的64位版本)安装nginx时,在开放80端口时用iptables设置端口 和重启服务发现提示未找到文件,在网络上收集查找后发现在Centos7中iptab ...
- 设置主机防火墙规则(iptables规则设置及其与firewalld的生死纠葛)
一.什么是firewalld防火墙? firewalld防火墙在Linux主机里其实就是一道隔离工具,它只对进出主机的请求做判断处理.也就是说它只管进出,至于你进来后做了什么,就不在firewalld ...
- Iptables 规则 一些简单实例和详细介绍
设定规则 iptables -p INPUT DROP iptables -p OUTPUT ACCEPT iptables -p FORWARD DROP 1.防止外网用内网IP欺骗 iptable ...
- linux iptables规则介绍
今天又学习了一下iptables,做一点总结来方便以后查阅. Netfilter(网络过滤器)是Linux操作系统核心层内部的一个数据包处理模块,主要负责数据包的拦截和转发,而iptables是Net ...
- linux系统中查看己设置iptables规则
1.iptables -L 查看filter表的iptables规则,包括所有的链.filter表包含INPUT.OUTPUT.FORWARD三个规则链. 说明:-L是--list的简写,作用是列出规 ...
- centos7【防火墙】常用规则
1.防火墙常用规则 systemctl start iptables systemctl stop iptables systemctl restart iptablesiptables -nvL 1 ...
- iptables规则备份和恢复 firewalld的9个zone firewalld关于zone的操作 firewalld关于service的操作
iptables规则备份和恢复 保存和备份iptables规则Service iptables save //会把规则保存到/etc/sysconfig/iptables把iptables规则备份到m ...
随机推荐
- Intellij debug模式使用
1.这里以一个web工程为例,点击图中按钮开始运行web工程. 2.设置断点 3.使用postman发送http请求 4.请求发送之后会自动跳到断点处,并且在断点之前会有数据结果显示 5.按F8 在 ...
- JS-匀速运动-运动停止
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 真机远程页面调试工具spy-debugger 3.x:集成weinre+AnyProxy,页面调试+抓包。调试生产HTTPS页面。
.页面调试+抓包 2.操作简单 3.支持HTTPS. 4.spy-debugger内部集成了weinre.node-mitmproxy.AnyProxy. 5.自动忽略原生App发起的https请求, ...
- Android中Log机制详解
Android中Log的输出有如下几种: Log.v(String tag, String msg); //VERBOSELog.d(String tag, String msg); ...
- shell脚本关闭tomcat
使用shell脚本快速关闭tomcat,就是获取tomcat进程后,一起kill掉: #!/bin/sh #kill tomcat pid name=tomcat-emall pidlist=`ps ...
- 百度地图api添加自定义控件
官网栗子:http://lbsyun.baidu.com/jsdemo.htm#b0_6 <!DOCTYPE html><html><head> <meta ...
- 爬虫实战【3】Python-如何将html转化为pdf(PdfKit)
前言 前面我们对博客园的文章进行了爬取,结果比较令人满意,可以一下子下载某个博主的所有文章了.但是,我们获取的只有文章中的文本内容,并且是没有排版的,看起来也比较费劲... 咋么办的?一个比较好的方法 ...
- Oracle数据库误删文件导致rman备份报错RMAN-06169解决办法
Oracle数据库误删文件导致rman备份报错RMAN-06169解决办法 可能是误删文件导致在使用rman备份时候出现以下提示 RMAN-06169: could not read file hea ...
- CSU 1808 地铁 (Dijkstra)
Description Bobo 居住在大城市 ICPCCamp. ICPCCamp 有 n 个地铁站,用 1,2,-,n 编号. m 段双向的地铁线路连接 n 个地铁站,其中第 i 段地铁属于 ci ...
- ubuntu16安装使用chrome
1. sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt/sources.list.d/ 将下载源加入到系统的源 ...