linux防火墙开启端口
1.使用命令查看端口开启情况(下图为安装时未选择开启防火墙)
[root@fullstack ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination Chain FORWARD (policy ACCEPT)
target prot opt source destination Chain OUTPUT (policy ACCEPT)
target prot opt source destination
2.清除防火墙规则(已有规则可以不进行)
[root@fullstack ~]# iptables -F #清除预设表filter中的所有规则链的规则
[root@fullstack ~]# iptables -X #清除预设表filter中使用者自定链中的规则
[root@fullstack~]# /etc/rc.d/init.d/iptables save #保存以后下次重启才会开启
[root@fullstack ~]# service iptables restart #重启一下防火墙
3.设置防火墙规则
[root@fullstack ~]# iptables -p INPUT DROP
[root@fullstack ~]# iptables -p OUTPUT ACCEPT
[root@fullstack ~]# iptables -p FORWARD DROP
这样定义是指明超出iptables的两个链规则(INPUT和FORWARD)规则的所有请求被抛弃,超出OUTPUT规则的请求可以接受,即控制输入,随意输出。
4.添加规则
[root@fullstack ~]# iptables -A INPUT -p tcp --dport -j ACCEPT
[root@fullstack ~]# iptables -A OUTPUT -p tcp --dport -j ACCEPT
[root@fullstack ~]# /etc/rc.d/init.d/iptables save
这样就给INPUT和OUTPUT添加了80端口的tcp连接,最后别忘了保存一下
linux防火墙开启端口的更多相关文章
- centos7 防火墙 开启端口 并测试
1.防火墙 CentOS升级到7之后,发现无法使用iptables控制Linuxs的端口,google之后发现Centos 7使用firewalld代替了原来的iptables.下面记录如何使用fir ...
- linux 防火墙打开端口/屏蔽IP等
开启/禁用 sudo ufw allow|deny [service] 打开或关闭某个端口,例如: sudo ufw allow smtp 允许所有的外部IP访问本机的25/tcp (smtp)端口 ...
- linux防火墙开启-关闭
1.永久性生效,重启后不会复原 开启: chkconfig iptables on 关闭: chkconfig iptables off 2. 即时生效,重启后复原 开启: service iptab ...
- Linux防火墙开启关闭查询
1.centos7防火墙 命令含义: –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 服务与端口的启 ...
- linux 防火墙开启80端口永久保存
经常使用CentOS的朋友,可能会遇到和我一样的问题.开启了防火墙导致80端口无法访问,刚开始学习centos的朋友可以参考下.经常使用CentOS的朋友,可能会遇到和我一样的问题.最近在Linux ...
- Linux Centos7配置防火墙开启端口
在使用centos7安装完mysql.tomcat.nginx后,都需要配置防火墙才能正常访问. 下面系统的学习一下防火墙的配置. centos7默认使用firewall,需要关闭,然后使用iptab ...
- Linux 防火墙开放端口(有时不生效可能是没有保存、重启导致)
原创 Centos7--防火墙(Firewall)开启常见端口命令 2018-05-22 20:19:51 午夜阳光psb 阅读数 7396更多 分类专栏: Linux 版权声明:本文为博主原创文章, ...
- Centos防火墙开启端口
linux系统对外开放80.8080等端口,防火墙设置 我们很多时候在liunx系统上安装了web服务应用后(如tomcat.apache等),需要让其它电脑能访问到该应用,而Linux系统(cent ...
- linux防火墙添加端口
防火墙配置文件: /etc/sysconfig/iptables 1.使用命令查看端口开启情况(下图为安装时未选择开启防火墙) [root@fullstack ~]# iptables -L -n ...
随机推荐
- 通过XShell链接虚拟机的CentOS
今天在Win7环境通过XShell链接VirtualBox的CentOS;始终链接不上,原来是因为虚拟机选择网络链接方式不对[推荐连接方式:Host-only Adapter(主机模式). 知识提要: ...
- Leetcode 99: Recovery binary search tree 总算明白了算法, 把代码写清楚, 让错误无处可藏.
想写点什么, 因为这道题花了我好几个小时, 在周日, 除了在球场上跑了二个小时, 就泡在这道题上面. read blogs: http://www.lifeincode.net/programming ...
- Oracle 判断某個字段的值是不是数字
转:https://my.oschina.net/bairrfhoinn/blog/207835 摘要: 壹共有三种方法,分别是使用 to_number().regexp_like() 和 trans ...
- mac下openresty安装
//openresty安装 http://openresty.org/ brew updatebrew install pcre openssl ./configure --prefix=/usr/l ...
- [原]CentOS7部署PostGis
转载请注明原作者(think8848)和出处(http://think8848.cnblogs.com) 本文参考了<An almost idiot's guide to install Pos ...
- [LeetCode] Invert Binary Tree 翻转二叉树
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem wa ...
- [LeetCode] Gas Station 加油站问题
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...
- FineUI(专业版)公测版发布(这速度,真TM快!)
经过近一年的筹备.编码和测试,FineUI(专业版)公测版终于和大家见面了!现在就来体验一下专业版飞一般的速度吧:http://fineui.com/demo_pro/FineUI(专业版)首页:ht ...
- [转]extjs组件添加事件监听的三种方式
原文地址:http://blog.csdn.net/y6300023290/article/details/18989635 1.在定义组件配置的时候设置 xtype : 'textarea', na ...
- PHP 之道
http://wulijun.github.io/php-the-right-way/