로컬 호스트 연결에 연결할 수 없습니다

최신 업데이트로 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

시간이 초과됩니다.

텔넷과 동일하며 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

행운없이 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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> 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 경로 쇼 테이블 로컬

# 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

핑 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가 서버를 재부팅 한 후에 발생합니다. 유용 할 수있는 것은 재부팅없이 서버가 자주 업데이트되었다는 것입니다.



답변

당신이 묘사 한 것과 똑같은 문제가있었습니다. 로컬에서 호스트의 청취 포트에 연결할 수 없지만 원격에 연결할 수 있습니다.

나를위한 해결책은 어떤 이유로 다운되고 부팅시 나타나지 않는 lo 인터페이스를 백업하는 것입니다.

ifconfig lo up

인터페이스를 다시 불러 와서 인터페이스를 볼 수 있는지 확인한 후 lo

ifconfig -a

나는 내 하루를 탈 수 있었다 … 🙂

나는 그것을 실행할 때 ip alo : 인터페이스에 127.0.0.1이 할당되지 않은 것을 보았습니다. 이것이 인터페이스를 실행해야한다는 사실에 나를 미치게 한 것입니다 …


답변

ifconfig게시 한 출력 에 따르면 127.0.0.1두 인터페이스에 루프백 주소가 설정되어 있습니다.

시험

ip addr del 127.0.0.1/32 dev venet0

루프백 액세스가 복원되었는지 확인하십시오.


답변

Flup이 올바르게 대답했지만 다른 이유가있는이 질문을 찾았습니다. 대체 답변이 필요하다고 생각합니다. 서버, 나는 IPv6 소켓에 바인딩하기 시작했고 다음과 같이 연결하기 위해 다른 주소를 사용해야합니다.

nc ::1 8080

또는

curl http://[::1]:8080/


답변