CentOS 7 防火墙和端口配置
centos 7 防火墙和端口配置
--解决 RHEL 7/ CentOS 7/Fedora 出现Unit iptables.service failed to load # 第一步,关闭firewall:
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
# 第二步,安装iptables-services:
yum install iptables-services
# 第三步,启用iptables-services:
root@vm-xiluhua ~# systemctl enable iptables #启用
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
root@vm-xiluhua ~# service iptables status #查看状态
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: inactive (dead)
root@vm-xiluhua ~# service iptables start #启动
Redirecting to /bin/systemctl start iptables.service
root@vm-xiluhua ~# service iptables status
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: active (exited) since 一 -- :: CST; 8s ago
Process: ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=/SUCCESS)
Main PID: (code=exited, status=/SUCCESS) 10月 :: vm-xiluhua systemd[]: Starting IPv4 firewall with iptables...
10月 :: vm-xiluhua iptables.init[]: iptables: Applying firewall rules: [ 确定 ]
10月 :: vm-xiluhua systemd[]: Started IPv4 firewall with iptables.
# 第4步,执行iptables命令开启或关闭端口
# 开启
iptables -A INPUT -p tcp --dport 3690 -j ACCEPT;
# 关闭
iptables -A INPUT -p tcp --dport 3690 -j DROP
# 查看是否有端口3690的配置,并显示行号
iptables -L -n --line-number | grep 3690
# 按行号删除,开启或关闭
iptables -D INPUT 1 #保存规则到iptables,重启配置依然有效
root@vm-xiluhua ~# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ 确定 ]
CentOS 7 防火墙和端口配置的更多相关文章
- CentOS 7防火墙开放端口快速方法
这篇文章主要为大家详细介绍了Centos7.1防火墙开放端口的快速方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 例如安装Nagios后,要开放5666端口与服务器连接,命令如下: [ro ...
- Centos7和Centos6防火墙开放端口配置方法(避坑教学)
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...
- centos 6 防火墙开启端口无效问题
昨天尝试redis在centos的安装,配置文件都检查了,外网就是不能访问 #添加端口开启 $ iptables -A INPUT -p tcp --dport 6379 -j ACCEPT #保存配 ...
- CentOS 7 防火墙,端口开启命令
1. 查看已打开的端口 # netstat -anp 2. 查看想开的端口是否已开 # firewall-cmd --query-port=8003/tcp 若此提示 FirewallD is ...
- Linux CentOS 7 防火墙与端口设置操作
CentOS升级到7之后用firewall代替了iptables来设置Linux端口, 下面是具体的设置方法: []:选填 <>:必填 [<zone>]:作用域(block.d ...
- CentOS设置防火墙开放端口
1. iptables是linux下的防火墙,同时也是服务的名称. service iptables status service iptables start service iptables st ...
- Linux:CentOS7防火墙 开放端口配置
查看已开放的端口 firewall-cmd --list-ports 开放端口(开放后需要要重启防火墙才生效) firewall-cmd --zone=public --add-port=3338/t ...
- CentOS 7 防火墙端口配置
CentOS 7 防火墙端口配置查看防火墙是否开启systemctl status firewalld 若没有开启则开启systemctl start firewalld 查看所有开启的端口firew ...
- CentOS防火墙iptables的配置方法详解
CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助. iptables是与Linux ...
随机推荐
- [LintCode] Valid Parentheses 验证括号
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the inpu ...
- Some useful links
Integrating the FlyCapture SDK for use with OpenCV CStereoGrabber_Bumblebee.h OpenCV with PGR Flycap ...
- c# 基础部分 (基本数据类型-- 表达式)
一 基础部分 1.常用的基本数据类型 int longing(长整) shortint(短整) string(文本型) char(字符型) bool (布尔型) false true 2.常量于变量 ...
- HttpClient模拟http请求
Http协议的重要性相信不用我多说了,HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性(具体区别,日后我们再讨论),它不仅是客户端发送Http请求变得容易,而且 ...
- Empire C:Basic 2
作为人与计算机沟通的媒介,C语言给我们呈现了:printf.scanf.以及缓冲区. 1.printf("%d",a) %d:d是decimal base(十进制)的开头字母,意思 ...
- 解决thrift: ···No such file or directory问题
感谢Anker分享:error while loading shared libraries: xxx.so.x" 错误的原因和解决办法 今天在装thrift的时候遇到一个这样的问题: ro ...
- Go-Agent原理分析及FQ介绍
作为一个程序员,相信大家是极度依赖google/stackoverflow/github的,可是国内有强大的GFW存在,以至于编程少了很多乐趣. 最近闹GFW狂潮,很多Chrome插件被封,连Shad ...
- Ignoring Extra Elements in mongoDB C# Driver
MongoDB删除字段后会报错: Element ... does not match any field or property of class Customer. 需要在实体类增加 [BsonI ...
- 解决git .ignore文件无效
在用 Git 进行代码管理的时候,我们会用 .gitignore 文件来描述哪些文件是不需要进行版本管理的,也就是被忽略掉. 如果我们在第一次提交的时候,忘记添加 .gitignore 文件或者在首次 ...
- Java 创建过滤器 解析xml文件
今天写了一个过滤器demo,现在是解析actions.xml文件,得到action中的业务规则:不需要导入任何jar包 ActionFilter过滤器类: package accp.com.xh.ut ...