EC2虚拟服务器接收请求但无法访问其他主机

时间:2014-05-09 11:57:08

标签: amazon-ec2

我在Amazon AWS Ubuntu中有一个虚拟机,我甚至安装了Apache2,PHP5和MySql。

一切运行良好,配置良好,我的网站运行良好。

直到突然停止虚拟机访问其他主机。每次请求都会发生这种情况

当PHP脚本开始出现错误'连接超时时,我发现了这一点。使用file_get_contents()函数时

<?php echo file_get_contents('http://example.com'); ?>

我通过SSH访问了服务器的命令行,并尝试ping外部主机ping google.com而没有。 我尝试使用apt-get来更新系统apt-get update,但也没有连接。

即我的EC2服务器没有连接任何外部服务器。

有趣的是,如果我尝试访问该网站,服务器通常会收到请求并将网站返回给浏览器。即,互联网连接在那里。

秋天的细节是,我尝试做的这个访问文件的if_get_contents()也在同一个网站上,而不是在外部网站上,但是超时了。

这是netstat -lnp命令的结果:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      957/sshd        
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1098/mysqld     
tcp6       0      0 :::22                   :::*                    LISTEN      957/sshd        
tcp6       0      0 :::443                  :::*                    LISTEN      1145/apache2    
tcp6       0      0 :::80                   :::*                    LISTEN      1145/apache2    
udp        0      0 0.0.0.0:68              0.0.0.0:*                           560/dhclient    
udp        0      0 0.0.0.0:18032           0.0.0.0:*                           560/dhclient    
udp6       0      0 :::60689                :::*                                560/dhclient    
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     8236     785/dbus-daemon     /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     6500     1/init              @/com/ubuntu/upstart
unix  2      [ ACC ]     STREAM     LISTENING     8549     965/acpid           /var/run/acpid.socket
unix  2      [ ACC ]     SEQPACKET  LISTENING     6797     324/systemd-udevd   /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     8919     1098/mysqld         /var/run/mysqld/mysqld.sock

这里吃iptables-L的结果:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

可能会发生什么?

0 个答案:

没有答案
相关问题