今天早些时候,我的 MBP 在强制重启(崩溃)后开始遇到运行 High Sierra 的困难。我的问题基本上归结为:
重启后,我无法与 lo0 接口(localhost、127.0.0.1、::1)上的任何内容建立连接。除 之外的所有请求都
ping
将无限期挂起和/或超时。http、tcp、traceroute 等都会发生这种情况。在安全模式下启动时,问题不会发生,我能够在 localhost 和 127.0.0.1 上启动一个简单的 http 服务器和 curl / wget。我已重新启动到正常模式并禁用了我的用户的所有登录项,但问题仍然存在。防火墙已禁用。
知道发生了什么吗?我现在很困惑。
127.0.0.1 可路由
sw14111@OF060VL39VHTD6D:~$ scutil -r 127.0.0.1
Reachable,Local Address,Directly Reachable Address
Ping 工作正常
sw14111@OF060VL39VHTD6D:~$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.063 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.117 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.073 ms
卷曲失败示例
sw14111@OF060VL39VHTD6D:~$ curl -v -x "" localhost:8000
* Rebuilt URL to: localhost:8000/
* Trying ::1...
* TCP_NODELAY set
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8000 failed: Operation timed out
* Trying fe80::1...
* TCP_NODELAY set
* Connection failed
* connect to 127.0.0.1 port 8000 failed: Operation timed out
* Connection failed
* connect to fe80::1 port 8000 failed: Operation timed out
* Failed to connect to localhost port 8000: Operation timed out
* Closing connection 0
curl: (7) Failed to connect to localhost port 8000: Operation timed out
跟踪路由超时
traceroute to 127.0.0.1 (127.0.0.1), 64 hops max, 52 byte packets
1 * * *
2 * * *
3 * * *
SYN_SENT
当请求正在进行时总是停留在状态。
sw14111@OF060VL39VHTD6D:~$ netstat -an | grep 127.0.0.1
tcp4 0 0 127.0.0.1.49679 127.0.0.1.8000 SYN_SENT
/etc/hosts
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
lo0
界面
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
lsof
简单服务器的输出
sw14111@OF060VL39VHTD6D:~$ python -m SimpleHTTPServer 18080
Serving HTTP on 0.0.0.0 port 18080 ...
# another terminal
sw14111@OF060VL39VHTD6D:~$ sudo lsof -a -i -sTCP:LISTEN
Python 2245 sw14111 3u IPv4 0x8d80c2958887276d 0t0 TCP *:18080 (LISTEN)