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

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 '^]'.

来自本地主机 (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)

尝试了几个选项,一直停留在“尝试连接”

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

没有IP表

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.

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

答案1

看来你的环回接口没有启动。环回接口(IPv4 127.0.0.1/8、IPv6 ::1/128)对于从一台主机到同一主机的通信是必需的。

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

auto lo
iface lo inet loopback

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

相关内容