关闭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. PHP用"字符串和变量"组成变量

    理论很简单,将字符串和变量组合在一起形成对另一个变量的操作.同样也可以是数组 例:   $FFabcd = '组合变量'; $a = 'abcd'; $ay = array('FF','abcd'); ...

  2. springboot使用tomcat apr模式

    因需项目对并发要求比较高.提高Tomcat效率.使用tomcat apr模式.今天在这记录下使用过程.apr全称为apache portable runtime.这里套用下wiki对apr的解释. T ...

  3. Java队列存储结构及实现

    一.队列(Queue) 队列是一种特殊的线性表,它只允许在表的前段(front)进行删除操作,只允许在表的后端(rear)进行插入操作.进行插入操作的端称为队尾,进行删除操作的端称为队头. 对于一个队 ...

  4. JAVA集合详解(Collection和Map接口)

    原文地址http://blog.csdn.net/lioncode/article/details/8673391 在JAVA的util包中有两个所有集合的父接口Collection和Map,它们的父 ...

  5. codeblocks opengl的配置

    codeblocks opengl的配置 GLUT 3.7 下载地址:http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip ...

  6. 最值得阅读学习的 10 个 C 语言开源项目代码

    1. Webbench Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连 ...

  7. Spring-1-F Dice(HDU 5012)解题报告及测试数据

    Dice Time Limit:1000MS     Memory Limit:65536KB Description There are 2 special dices on the table. ...

  8. 关于http响应状态码

    http状态返回代码 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. http状态返回代码 代码   说明 100   (继续) 请求者应当继续提出请求. 服务器返回此代码表示已 ...

  9. Linux查看本机登陆用户信息(w、who、last和lastlog命令)

    w 命令 查看 Linux 服务器上目前已经登录的用户信息 [root@localhost ~]# w :: up :, users, load average:0.00, 0.00, 0.00 US ...

  10. javaee加密部署,tomcat使用自己的classloader解密

    http://www.2cto.com/kf/201312/264455.html [起因] 公司需要对一个web项目进行加密之后出售, 大家都知道的,class很好反编译, 所以需要对class文件 ...