ubuntu18.04 局域网无法访问的问题

2019-03-26 15:11:18 +08:00
 ClancyH
在测试一个 java 服务的时候,发现局域网下别的机器无法访问,服务架在自己电脑,系统是 ubuntu18.04,本机访问都正常,别的机器也能 ping 通,服务器机器的防火墙也开启了对应端口,不过还是连接不了。
4692 次点击
所在节点    Linux
28 条回复
aaaaasam
2019-03-27 10:52:21 +08:00
@ClancyH 你是什么系统?
ClancyH
2019-03-27 10:52:29 +08:00
另外在另外一台机器 nmap 扫描是能够扫描到端口而且端口是 open 的
ClancyH
2019-03-27 10:53:10 +08:00
@aaaaasam ubuntu18.04 ,标题有
aaaaasam
2019-03-27 10:54:09 +08:00
可以大概的贴一下内网的网段,然后你服务器绑定的网段么 另外打印一下 iptables -L -n -v
ClancyH
2019-03-27 10:56:51 +08:00
@aaaaasam 内网网段是 192.168.1.0
服务绑定( netstat -ano|grep 9008 )
tcp6 0 0 192.168.1.159:9008 :::* LISTEN off (0.00/0/0)
iptables -L -n -v
Chain INPUT (policy ACCEPT 107K packets, 145M bytes)
pkts bytes target prot opt in out source destination
1050K 1400M ufw-before-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
1050K 1400M ufw-before-input all -- * * 0.0.0.0/0 0.0.0.0/0
140K 147M ufw-after-input all -- * * 0.0.0.0/0 0.0.0.0/0
139K 147M ufw-after-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
139K 147M ufw-reject-input all -- * * 0.0.0.0/0 0.0.0.0/0
139K 147M ufw-track-input all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 192.168.1.0/24 0.0.0.0/0 state NEW tcp dpt:9008

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ufw-before-logging-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-before-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-after-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-after-logging-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-reject-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-track-forward all -- * * 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT 103K packets, 74M bytes)
pkts bytes target prot opt in out source destination
988K 681M ufw-before-logging-output all -- * * 0.0.0.0/0 0.0.0.0/0
988K 681M ufw-before-output all -- * * 0.0.0.0/0 0.0.0.0/0
111K 75M ufw-after-output all -- * * 0.0.0.0/0 0.0.0.0/0
111K 75M ufw-after-logging-output all -- * * 0.0.0.0/0 0.0.0.0/0
111K 75M ufw-reject-output all -- * * 0.0.0.0/0 0.0.0.0/0
111K 75M ufw-track-output all -- * * 0.0.0.0/0 0.0.0.0/0

Chain ufw-after-forward (1 references)
pkts bytes target prot opt in out source destination

Chain ufw-after-input (1 references)
pkts bytes target prot opt in out source destination

Chain ufw-after-logging-forward (1 references)
pkts bytes target prot opt in out source destination

Chain ufw-after-logging-input (1 references)
pkts bytes target prot opt in out source destination
aaaaasam
2019-03-27 11:09:27 +08:00
看不出来什么问题,给两条建议:
1、关掉防火墙,看看是否还有问题,如果有,就是你网络的问题,如果没有就是防火墙的问题;
2、如果是网络问题,可以通过 traceroute 去跟踪数据包试试;
tomychen
2019-03-27 12:31:11 +08:00
fw 规则有问题,只有 input 链,没有 output 没做

所以在没有办法确定是不是 fw 的问题的前提就是先 backup 一下 fw rule,先禁用再说。

能 ping 通,说明链路已经通了,至于连接不行,那就是协议层的事。
ClancyH
2019-03-27 14:17:43 +08:00
解决了,前端的机器开了代理服务,三次握手失败

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/548745

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX