无法使用其他设备的 IP 访问 MAC 上的本地主机服务器

无法使用其他设备的 IP 访问 MAC 上的本地主机服务器

我已将默认的 localhost 服务器设置为在我的 MAC 上运行,并使用默认设置的 apache。我可以使用 localhost 和服务器本身的 IP 访问本地服务器,但无法使用连接到同一 WIFI 网络的另一台 PC 上的 IP 和简单的路由器进行访问。我已禁用 Mac 上的防火墙,但没有任何效果。这是我的 /etc/hosts 文件:

127.0.0.1   localhost
255.255.255.255   broadcasthost 
::1             localhost 

wifi上的mac IP是192.168.10.102,另一台PC IP是192.168.10.105 Apache设置为监听80端口,http.conf

Listen 80

sudo tcpdump -i en0结果:

15:35:28.384152 IP 192.168.10.105.63630 > 192.168.10.102.http: Flags [S], seq 2700046236, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
15:35:28.674606 IP 192.168.10.105.63631 > 192.168.10.102.http: Flags [S], seq 3459374519, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
15:35:29.335909 IP 192.168.10.102.51270 > 192.168.10.1.domain: 50623+ PTR? 103.10.168.192.in-addr.arpa. (45)
15:35:29.343300 IP 192.168.10.1.domain > 192.168.10.102.51270: 50623 NXDomain* 0/1/0 (95)
15:35:29.593550 IP 192.168.10.105.netbios-dgm > 192.168.10.255.netbios-dgm: NBT UDP PACKET(138)
15:35:30.345378 IP 192.168.10.102.58188 > 192.168.10.1.domain: 60091+ PTR? 255.10.168.192.in-addr.arpa. (45)
15:35:30.352597 IP 192.168.10.1.domain > 192.168.10.102.58188: 60091 NXDomain* 0/1/0 (95)
15:35:31.337113 ARP, Request who-has 192.168.10.102 tell 192.168.10.1, length 28

笔记 重新启动 MAC 电脑几秒钟后,我就能够从另一台电脑使用 IP 访问本地主机服务器...有什么想法吗?

答案1

在浪费了将近一天半的时间后,我发现 Symantec 的 Endpoint Security 阻止了传入连接。我偶然发现了这个脚本,它拯救了我(禁用服务):

https://gist.github.com/phoob/671e65332c86682d5674

这也是有效的:

https://gist.github.com/bubenkoff/4043130

希望能够帮助到其他人。

相关内容