centos - 连接被拒绝 telnet localhost 8080

标签 centos telnet

我正在运行 CentOS 7 机器,当我尝试 telnet localhost 8080 时,我收到以下消息

Trying ::1...
Telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Telnet: conenct to address 127.0.0.1: Connection refused

我已经在IP表中添加了8080/tcp并打开了端口。知道是什么阻止了它吗?

最佳答案

很简单:端口 8080 没有打开,就像@Esse 告诉你的。

您还可以使用 echo 检查连接:

echo OK > /dev/tcp/localhost/8080
echo $?

您可以使用 netstat 列出打开的端口:

netstat -tulpn | grep 8080

编辑:

可以通过尝试自己打开端口来测试端口没有打开:

# open port 8080 using netcat
nc -l 8080 &
# check connection
netstat -tulpn | grep 8080
telnet localhost 8080
echo OK > /dev/tcp/$(hostname -f)/8080
nc 127.0.0.1 8080

关于centos - 连接被拒绝 telnet localhost 8080,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34205607/

相关文章:

ssh - telnet/SSH 连接到底发生了什么?

java - 通过 telnet 高效地运行文本图形

docker - Centos 服务已启动但仍处于禁用状态

docker - 为什么docker会立即关闭tcp连接?

centos - OpenStack:重启后 Keystone 和 nova-network 不活动

sql-server - 在 Linux/CentOS 上生成从 MS SQL 数据库查询数据的报告?

Python 从 Telnet 读取直到空字符

session - PuTTY 以及如何保持 telnet session 事件

php - 如何在CentOs中安装php-xml

apache2 - httpd : could not open error log file/etc/httpd/logs/error_log. 无法打开日志