linux开放关闭防火墙端口
原文:http://blog.csdn.net/fengspg/article/details/21337617
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off 2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop 查看iptables文件
vim /etc/sysconfig/iptables
redhat部分-----------
1:端口开放
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
2:保存修改
/etc/rc.d/init.d/iptables save
3: 重启服务
/etc/rc.d/init.d/iptables restart
4:查看端口状态
/etc/init.d/iptables status
结果如下
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2181
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6379
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
5 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
8 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
5:删除端口(2表示上面的num列)
- /sbin/iptables -D INPUT 2
centos7部分-----------
开启端口
- firewall-cmd --zone=public --add-port=80/tcp --permanent
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
重新加载防火墙
- firewall-cmd --reload
检查修改是否生效
- firewall-cmd --zone= public --query-port=80/tcp
删除某端口
firewall-cmd --zone= public --remove-port=80/tcp
firewall-cmd --zone=public --remove-service=http
linux开放关闭防火墙端口的更多相关文章
- Linux系统关闭防火墙端口
1. 打开防火墙端口 # iptables -I INPUT -p tcp --dport -j ACCEPT # iptables -I INPUT -p tcp --dport -j ACCEPT ...
- Linux 7.x 防火墙&端口
Linux 7.x 防火墙&端口 查看当前防火墙的状态: # firewall-cmd --state 也可以使用指令:systemctl status firewall.service 启动 ...
- Linux系统 开通防火墙端口
Redhat 7内核 Linux系统 开通防火墙端口 使用systemctl 1.查看防火墙状态,root用户登录,执行命令systemctl status firewalld 2.开启防火墙:sy ...
- linux下关闭防火墙命令
今天使用linux虚拟机搭建jenkins,但是在虚拟机内部使用浏览器可以访问jenkins主页,在物理机上却无法访问jenkins主页,查找原因后是因为linux虚拟机没有关闭防火墙,关闭防火墙后, ...
- centos7 开放/关闭防火墙和端口
--------------------------------------------------------------防火墙----------------------------------- ...
- Linux如何关闭防火墙和查看防火墙的具体情况
1.Linux下关闭和开启防火墙 1) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后失效 开启: ser ...
- 我用过的Linux命令--关闭防火墙
关闭防火墙: 防火墙的弄能是限制某一些端口的使用,可以通过linux命令关系它,相应的指令: 查看防火墙信息: #service iptables status 就能看到防火墙的状态: 关闭防火墙: ...
- Linux 开启关闭防火墙
开放防火墙端口添加需要监听的端口 /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT/sbin/iptables -I INPUT -p tcp ...
- RedHat Enterprise Linux 7关闭防火墙方法
systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起 在之前的版本中关闭防火墙等服务的命令是 service iptables stop ...
随机推荐
- acm专题---最短路
spfa的时间复杂度是0(e) 题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1874 Problem Description 某省自从实行了很多年的畅 ...
- php 高并发解决方案(用于抢购) 转载
最近在做一个团购项目,遇到个问题,就是在抢购.秒杀.抽奖等活动时,库存数量有限,但是同时下单人数超过了库存数量,就会导致商品超售问题.那么我们怎么来解决这个问题呢,我的思路如下: sql1:查询商品库 ...
- Delphi 通过字符串实例化类
通过字符串创建窗体类对象 1.需要在程序初始化的时候将类注册,注册到对象 RegGroups:(TRegGroups)中,以便查找. 注册类使用的函数:RegisterClass ,窗体初始化操作放在 ...
- apache Apache winnt_accept: Asynchronous AcceptEx failed 错误的解决
httpd配置文件中添加: AcceptFilter http noneAcceptFilter https none apache优化: http://blog.csdn.net/hytfly/ar ...
- DotNetOpenAuth实践之WCF资源服务器配置
系列目录: DotNetOpenAuth实践系列(源码在这里) 上一篇我们写了一个OAuth2的认证服务器,我们也获取到access_token,那么这个token怎么使用呢,我们现在就来揭开 一般获 ...
- bzoj 1818 主席树
思路:主席树搞一搞. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #de ...
- Codeforces Round #278 (Div. 1) B - Strip dp+st表+单调队列
B - Strip 思路:简单dp,用st表+单调队列维护一下. #include<bits/stdc++.h> #define LL long long #define fi first ...
- 什么是泛型 转载自http://www.blogjava.net/Jack2007/archive/2008/05/05/198566.html
我们在编写程序时,经常遇到两个模块的功能非常相似,只是一个是处理int数据,另一个是处理string数据,或者其他自定义的数据类型,但我们没有办法,只能分别写多个方法处理每个数据类型,因为方法的参数类 ...
- .htaccess文件
前言 看了几篇文章,发现自己对于如何维护普通的服务器安全完全不会,先从简单的.htaccess来研究吧 .htaccess文件的作用,就是更改httpd.ini文件中的配置,但作用范围仅限当前文件夹 ...
- freemarker${}包含${}
${}包含${} freemarker还是比较只能的,只是你自己复杂化了 比如有两个集合 books跟users 你可以这么取值吗,索引是有关联关系的 <#list users as user& ...