关闭SELINUX

##查看SELINUX状态
/usr/sbin/sestatus -v
getenforce #修改config配置文件,重启后即可
vi /etc/selinux/config #SELINUX=enforcing改为SELINUX=disabled #临时关闭(不用重启机器):
setenforce ##设置SELinux 成为permissive模式,
##setenforce 1 设置SELinux 即可成为enforcing模式

CentOS7防火墙

firewall-cmd --state    #显示状态
firewall-cmd --zone=public --list-ports #查看所有打开的端口
firewall-cmd --reload #更新防火墙规则
firewall-cmd --get-active-zones #查看区域信息
firewall-cmd --get-zone-of-interface=eth0 #查看指定接口所属区域
firewall-cmd --panic-on #拒绝所有包
firewall-cmd --panic-off #取消拒绝状 态
firewall-cmd --query-panic #查看是否拒绝 #添加
firewall-cmd --zone=public --add-port=/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
#重新载入
firewall-cmd --reload
#查看
firewall-cmd --zone= public --query-port=/tcp
#删除
firewall-cmd --zone= public --remove-port=/tcp --permanent
systemctl start firewalld    #启动
systemctl status firewalld #查看状态
systemctl disable firewalld #停止
systemctl stop firewalld #禁用
systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
systemctl start firewalld.service    #启动一个服务
systemctl stop firewalld.service #关闭一个服务
systemctl restart firewalld.service #重启一个服务
systemctl status firewalld.service #显示一个服务的状态 systemctl enable firewalld.service #在开机时启用一个服务
systemctl disable firewalld.service #在开机时禁用一个服务
systemctl is-enabled firewalld.service #查看服务是否开机启动 systemctl list-unit-files|grep enabled #查看已启动的服务列表
systemctl --failed #查看启动失败的服务列表

CentOS6

修改文件/etc/sysconfig/iptables

    #su vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 8066 -j ACCEPT
# service iptables restart
Linux下开启/关闭防火墙命令
#1) 永久性生效,重启后不会复原
#开启: chkconfig iptables on
#关闭: chkconfig iptables off #2) 即时生效,重启后复原
#开启: service iptables start
#关闭: service iptables stop

测试

1.确定服务是否启动,端口是否正在被监听

ps -ef|grep mycat

2.netstat测试是否在被监听

netstat -an|grep 8066

打开端口

关闭端口

步骤:

  1. 安装好虚拟机配置好网络 ping 通主机。
  2. 关闭SELINUX。
    vi /etc/selinux/config    #SELINUX=enforcing改为SELINUX=disabled
    reboot #重启
  3. 开防火墙端口,或者这接关闭(不建议)。
    注意:开了端口后一定要有服务监听(例如Tomcat一定要启动,否则是telnet不通的)!!!也就是说开了端口一定要起服务才能telnet通。
  4. telnet IP port。

CentOS开端口问题的更多相关文章

  1. Centos查看端口占用情况和开启端口命令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例)方法一: /sbin/i ...

  2. CentOS查看端口是否被占用

    CentOS查看端口是否被占用 本文介绍了linux中查看某一端口是否被占用的方法,有关netstat命令的使用技巧,感兴趣的朋友可以参考下. 使用命令: netstat -tunlp 会显示所有端口 ...

  3. Centos查看端口占用和开启端口命令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例) 方法一: /sbin/ ...

  4. [转]Centos 查看端口占用情况和开启端口命令

    http://www.cnblogs.com/xqzt/p/4919191.html 1.Centos 查看端口占用 比如查看 80 端口占用情况使用如下命令: lsof -i tcp:80 2.列出 ...

  5. Centos查看端口占用和关闭端口

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令:   lsof -i tcp:80   列出所有端口   netstat -ntlp   1.开启端口(以80端口为例)     ...

  6. Centos查看端口占用令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例) 方法一: /sbin/ ...

  7. Centos查看端口占用情况

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令:   lsof -i tcp:80   列出所有端口   netstat -ntlp   结束进程: kill 进程代码

  8. centOS 开启端口

    生产环境禁止关闭防火墙,只能开端口 [root@BetaD home]# firewall-cmd --add-port=/tcp --permanent [root@BetaD home]# fir ...

  9. CentOS 7.0 开端口

    >>>  CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下1.直接关闭防火墙systemctl stop firewalld.serv ...

随机推荐

  1. centos7 vim显示行号

    CentOS7下可能有n个账户,让vim显示行号有两种方法:仅让当前用户显示行号和让所有用户显示行号   一.仅让当前用户显示行号 输入命令:vim ~/.vimrc 写入:set nu 保存:wq ...

  2. Java基础知识陷阱(四)

    本文发表于本人博客. 今天我们来说说关于java继承以及反射有关的问题,大家先看下下面代码,试问可以编译通过不,为什么具体说说原因? public class Test{ public static ...

  3. Leetcode 357

    没用过Leetcode刷题,只能按照自己的想法随便写写了 思路:1.第一位数有9种(除了0)可能,第二位数有9种(除了第一位)可能,第三位数有8种(除了前两位)可能,以此类推...9*8*7*...( ...

  4. ruby中的作用域

    作用域(scope)指的是变量的可达性或可见性.不同类型的变量有不同的作用域规则.与self类似,作用域在程序的执行过程中也在不断的变化,也可以根据上下文推断出"谁在什么作用域中" ...

  5. Connecting to a Remote Serial Port over TCP/IP

    https://www.acmesystems.it/socat This article illustrates how to realize a lan to serial gateway Rem ...

  6. sublime 安装插件报错

    sublime  安装插件报错,大部分原因是本地防火墙开启了,关闭本地防火墙

  7. a=b=c 连等赋值的分析

    首先 先抛出两个例子,大家想想结果是什么? eg1: var a = 1; var b = a; a.x = a = 3; 问 a = ?  |  b = ?  |  a.x = ? eg2: var ...

  8. Ubuntu16 安装Jira

    参见:https://segmentfault.com/a/1190000008194333 https://www.ilanni.com/?p=12119烂泥:jira7.3/7.2安装.中文及破解 ...

  9. 国光大力推荐(安利)Deepin15.4

    简介 深度操作系统15.4 Beta(deepin15.4)相比deepin15.3来看,外观上要更加优雅.现在还在内测中,相信不就官网就会发布正式版.小子昨天下午删了我的windows10,特意来尝 ...

  10. clientWidth offsetWidth scrollWidth

    网页可见区域宽: document.body.clientWidth;网页可见区域高: document.body.clientHeight;网页可见区域宽: document.body.offset ...