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 ...
随机推荐
- QTabWidget 使用方法
QTabWidget是Qt中的标签类,由于可切换到标签存在,大大的提高了软件可容纳的控件的数量,通过增加标签,我们几乎有用之不尽的空间,那么我们来看看这个类的一些基本用法: 声明控件: QTabWid ...
- [LintCode] Divide Two Integers 两数相除
Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...
- [LintCode] Copy Books 复印书籍
Given an array A of integer with size of n( means n books and number of pages of each book) and k pe ...
- 关于JS的算法
一.快速排序 function qSort(arr) { if(arr.length === 0) { return []; } var left = []; var right = []; var ...
- winform连接ACCESS数据库
1.先建立一个名叫text.mdb的access数据库 2.他它复制到access中文件下. 3.在App_Code文件夹下建好封装语句,查询方法,连接语句,其中studentDA中的代码为: pri ...
- shodan:黑客搜索引擎
Shodan是msfconsole创始人与几个爱好技术的黑客开发的一款黑客搜索引擎,被称为可怕的搜索引擎,详细介绍见百度百科 网站地址:www.shodan.io 免费注册一账号,无账号的话,默认只显 ...
- c#...的类型初始值设定项引发异常。
今天一直遇到这个问题
- CSS,bootstrap表格控制当td内容过长时用省略号表示,以及在不使用bootstrap时过长也用省略号表示
首先需要在table中设置table-layout:fixed; <table style="table-layout:fixed"></table> 然后 ...
- Android课程---进度条及菜单的学习
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- 一道打印M的面试题
public class Demo { /** * 平面图形题(二维数组) */ public static void main(String[] args) { int num = 25; int ...