linux localhost不识别,linux – 无法连接到任何localhost连接

我正在使用带有最新更新的Centos 6.5.

我的问题是,每当我尝试连接到某些本地服务时,它就会挂起,例如:

wget的

wget 127.0.0.1

--2014-03-11 12:43:42-- http://127.0.0.1/

Connecting to 127.0.0.1:80...

After a while timeout...

SSH

# ssh 127.0.0.1 -p 6060 -v

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: Applying options for *

debug1: Connecting to 127.0.0.1 [127.0.0.1] port 6060.

debug1: connect to address 127.0.0.1 port 6060: Connection timed out

ssh: connect to host 127.0.0.1 port 6060: Connection timed out

它会挂起来超时.

与telnet相同,与连接到irc服务器相同.外部连接正常运行…

netstat -tpln

# netstat -tpln

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 589/sendmail

tcp 0 0 127.0.0.1:6060 0.0.0.0:* LISTEN 520/sshd

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 619/nginx

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 478/sshd

tcp 0 0 ::1:6060 :::* LISTEN 520/sshd

tcp 0 0 :::22 :::* LISTEN 478/sshd

netstat -rn

# netstat -rn

Kernel IP routing table

Destination Gateway Genmask Flags MSS Window irtt Iface

169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 venet0

0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 venet0

iptables的

我arleady冲出iptables,没有运气.输出表格iptables:

# iptables -nvL

Chain INPUT (policy ACCEPT 634 packets, 49819 bytes)

pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)

pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 517 packets, 47027 bytes)

pkts bytes target prot opt in out source destination

环回配置

# ip a

1: lo: mtu 16436 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: venet0: mtu 1500 qdisc noqueue state UNKNOWN

link/void

inet 127.0.0.1/32 scope host venet0

inet 176.122.224.115/32 brd 176.122.224.115 scope global venet0:0

SELinux的转变并没有改善它.

ip route show table local

# ip route show table local

local 176.122.224.115 dev venet0 proto kernel scope host src 176.122.224.115

broadcast 176.122.224.115 dev venet0 proto kernel scope link src 176.122.224.115

broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1

broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1

local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1

local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1

跟踪路由

# traceroute 127.0.0.1

traceroute to 127.0.0.1 (127.0.0.1), 30 hops max, 60 byte packets

1 localhost.localdomain (127.0.0.1) 0.029 ms 0.014 ms 0.012 ms

ping 127.0.0.1

工作正常

# ping 127.0.0.1

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.

64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms

64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.036 ms

关于它的最奇怪的事情是,我可以从外部地址(例如我的ssh’ing的计算机)连接到ssh,nginx服务器而没有问题.

ISP重启我的服务器后会发生这种情况.可能有用的是,服务器经常更新而不重新启动.

解决方法:

根据您发布的ifconfig输出,您在两个接口上设置了环回地址127.0.0.1.

尝试

ip addr del 127.0.0.1/32 dev venet0

并查看您的环回访问是否已恢复.

标签:linux,networking,centos

来源: https://codeday.me/bug/20190809/1629898.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值