linux关闭防火墙及开放端口
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off 2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop 需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。
开放端口的方法:
方法一:命令行方式
1. 开放端口命令: /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
2.保存:/etc/rc.d/init.d/iptables save
3.重启服务:/etc/init.d/iptables restart
4.查看端口是否开放:/sbin/iptables -L -n
方法二:直接编辑/etc/sysconfig/iptables文件
1.编辑/etc/sysconfig/iptables文件:vi /etc/sysconfig/iptables
加入内容并保存:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
2.重启服务:/etc/init.d/iptables restart
3.查看端口是否开放:/sbin/iptables -L -n
但是我用方法一一直保存不上,查阅网上发现直接修改文件不需要iptables save,重启下iptables
重新加载下配置。iptables save
是将当前的iptables写入到/etc/sysconfig/iptables。我不save直接restart也不行,所以还是方法二吧
查询端口是否有进程守护用如下命令grep对应端口,如80为端口号
例:netstat -nalp|grep 80
linux关闭防火墙及开放端口的更多相关文章
- [Linux] 关闭防火墙以及开放端口
一. service iptables stop 临时关闭, chkconfig iptables off完全关闭 service iptables status状态, service iptable ...
- Linux关闭防火墙,开放端口
Centos/redhat系统: 开启防火墙 #systemctl start firewalld.service 停止firewall #systemctl stop firewalld.servi ...
- LINUX关闭防火墙、开放特定端口等常用操作
1. 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2. 即时生效,重启后失效: 开启:service iptables s ...
- Linux关闭防火墙、设置端口
关闭防火墙 1)重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 验证防火墙是否关闭:chkconfig --list |grep ...
- linux关闭防火墙
查看防火墙状态: sudo service iptables status linux关闭防火墙命令: sudo service iptables stop linux启动防火墙命令: sudo se ...
- Linux关闭防火墙、SELinux
使用root权限: Linux关闭防火墙: 1. chkconfig –list|grep iptables 2. chkconfig iptables off 永久关闭防火墙 3. chkconfi ...
- Win10系统如何在防火墙里开放端口
Win10系统如何在防火墙里开放端口(下面傻瓜式教学) 然后怎么做呢?????? 下一步.下一步.下一步.下一步.下一步.下一步.下一步.下一步.下一步.下一步......... 随便起个名字 KO
- Linux 防火墙iptables开放端口
Iptabels是与Linux内核集成的包过滤防火墙系统,几乎所有的linux发行版本都会包含Iptables的功能.如果 Linux 系统连接到因特网或 LAN.服务器或连接 LAN 和因特网的代理 ...
- LINUX关闭防火墙(转载)
(1) 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off (2) 即时生效,重启后失效: 开启:service iptables ...
随机推荐
- 【bfs】迷宫问题
[题目描述] 定义一个二维数组: int maze[5][5] = { 0,1,0,0,0, 0,1,0,1,0, 0,0,0,0,0, 0,1,1,1,0, 0,0,0,1,0, }; 它表示一个迷 ...
- [HEOI2014]平衡(整数划分数)
下课了,露露.花花和萱萱在课桌上用正三棱柱教具和尺子摆起了一个“跷跷板”. 这个“跷跷板”的结构是这样的:底部是一个侧面平行于地平面的正三棱柱教具,上面 摆着一个尺子,尺子上摆着若干个相同的橡皮.尺子 ...
- 项目部署之nginx实现PC端和移动端自动跳转
假设PC端域名为 www.abc.com 移动端域名为m.abc.com PC端nginx配置文件server中加入如下代码: if ($http_host !~ "^www.abc ...
- goroutine与调度器
29 November 2013 by skoo 我们都知道Go语言是原生支持语言级并发的,这个并发的最小逻辑单元就是goroutine.goroutine就是Go语言提供的一种用户态线程,当然这种用 ...
- Vim常用插件安装及配置方法
Vundle 安装 git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 配置 vimrc首部添 ...
- bzoj2007 NOI2010 海拔(对偶图)
80分(最小割)思路 先考虑如果没有题目中东南角为\(1\)那个限制的话会怎样. 那么只要让每个点的海拔都是\(0\)就行了.这样不论怎样走,最后的答案都是0. 然后再考虑那个东南角为\(1\)的限制 ...
- Unable to load script from assets 'index.android.bundle'.make sure you bundle is packaged correctly
解决此问题 以下方法每次都需要执行命令2才能更新 1.创建assets目录 mkdir android/app/src/main/assets 2.执行命令 react-native bundle - ...
- bash 4
1)获取字符串长度: str="jwwjww" #str=‘jwwjww’//单引号双引号都一样 echo ${#str} 结果:6 2)提取子字符串 echo ${#str:1: ...
- 100.Same Tree(E)
100. same tree 100. Same Tree Given two binary trees, write a function to check if they are the same ...
- Tensorflow object detection API 搭建物体识别模型(四)
四.模型测试 1)下载文件 在已经阅读并且实践过前3篇文章的情况下,读者会有一些文件夹.因为每个读者的实际操作不同,则文件夹中的内容不同.为了保持本篇文章的独立性,制作了可以独立运行的文件夹目标检测. ...