Debian 无法从 localhost 连接到本地守护进程

Pee*_*eeS 2 debian

长话短说。

Apache2 在 0.0.0.0:80 上运行

mysqld 运行在 0.0.0.0:3306

无法从本地主机访问这些端口,但可以从远程主机访问它们。

从远程主机(笔记本电脑)

MacBook-Pro:~ codemaster$ telnet 192.168.0.10 3306
Trying 192.168.0.10...
Connected to 192.168.0.10.
Escape character is '^]'.
T
5.5.40-0+wheezy1/QmQ,%uA?0b|m+.BDn|G*mysql_native_password^CConnection closed by foreign host.
MacBook-Pro:~ codemaster$ telnet 192.168.0.10 80
Trying 192.168.0.10...
Connected to 192.168.0.10.
Escape character is '^]'.
Run Code Online (Sandbox Code Playgroud)

来自本地主机 (192.168.0.10)

root@udoo-debian-hfp:/# uname -a
Linux udoo-debian-hfp 3.0.35 #1 SMP PREEMPT Mon Mar 3 15:17:07 CET 2014 armv7l GNU/Linux
root@udoo-debian-hfp:/# netstat -a -n -p|grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      21469/mysqld    
root@udoo-debian-hfp:/# netstat -a -n -p|grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3614/apache2    
unix  3      [ ]         STREAM     CONNECTED     3880     3763/dbus-daemon    

root@udoo-debian-hfp:/# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:c0:08:88:a1:1c  
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6781 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4389 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:956650 (934.2 KiB)  TX bytes:644410 (629.3 KiB)

usb0      Link encap:Ethernet  HWaddr 7e:82:37:77:b9:01  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 7c:dd:90:3a:4a:a6  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
Run Code Online (Sandbox Code Playgroud)

尝试了几个选项,挂在“尝试连接”上

root@udoo-debian-hfp:/# telnet 192.168.0.10 80
Trying 192.168.0.10...
^C
root@udoo-debian-hfp:/# telnet 192.168.0.10 3306
Trying 192.168.0.10...
^C
root@udoo-debian-hfp:/# telnet 127.0.0.1 3306
Trying 127.0.0.1...
^C
root@udoo-debian-hfp:/# telnet 127.0.0.1 80
Trying 127.0.0.1...
^C
Run Code Online (Sandbox Code Playgroud)

没有IPTABLES

root@udoo-debian-hfp:/# iptables -L
FATAL: Module ip_tables not found.
iptables v1.4.14: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
Run Code Online (Sandbox Code Playgroud)

以前从未遇到过这样的事情......要么是 iptables 阻塞,要么是绑定到本地接口的守护进程......但本地到本地?

Cel*_*ada 6

您的环回接口似乎未启动。环回接口(IPv4 127.0.0.1/8、IPv6 ::1/128)是从一台主机到同一台主机的通信所必需的。

在 Debian 上,环回接口通常在启动时使用以下配置打开/etc/network/interfaces

auto lo
iface lo inet loopback
Run Code Online (Sandbox Code Playgroud)

我不知道为什么您的环回接口没有正确出现,但请尝试ifup lo(托管、首选)或ip link set lo up(非托管)并确保上述行出现在/etc/network/interfaces.