前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux端口不通检查

Linux端口不通检查

作者头像
林万程
发布2021-06-09 22:15:09
7.5K0
发布2021-06-09 22:15:09
举报
文章被收录于专栏:IT开发技术与工作效率
代码语言:javascript
复制
# Windows 检查端口
telnet ip port

# Linux telnet 检查端口
telnet ip port
## 若报命令不存在时安装
sudo yum install telnet
## 成功
Trying 161.63.104.193...
Connected to 161.63.104.193.
Escape character is '^]'.
## 端口通但服务没启动
Trying 29.34.5.11...
telnet: connect to address 29.34.5.11: Connection refused
## 失败卡住
Trying 29.34.5.11...


# Linux crul 检查端口
curl localhost:port
## 成功是网页代码
## 端口通但服务没启动
curl: (7) Failed connect to localhost:port; Connection refused
## 失败卡住

# Linux ssh 检查端口
ssh -v -p port root@localhost
## 成功返回的是网页代码(一堆debug)
## 端口通但服务没启动
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to localhost [localhost] port port .
debug1: connect to address localhost port port : Connection refused
ssh: connect to host localhost port port : Connection refused
## 失败卡住
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to localhost [localhost] port port.


# 查看端口(参数说明:tcp udp 端口num LISTEN pid)
netstat -tunlp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      19897/mongod        
tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      29589/java          
tcp6       0      0 :::3306                 :::*                    LISTEN      22248/mysqld
0.0.0.0 是对外开放 :::是IPV6版
127.0.0.1 是仅本机访问

# 查看系统发行版本
cat /etc/redhat-release

# CentOS 7 系统防火墙是否开启 (Active 是 dead 还是 run)
systemctl status firewalld.service

● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档