IP地址无法访问

IP地址无法访问

我的 Linux 机器无法通过 IP 地址访问,仅如

    http://127.0.0.1:8080/projectname

或 localhost 在浏览器上工作,但是

    http://10.1.5.5:8080/projectname

不是(这里 10.1.5.5 是我通过ifconfig在终端中输入找到的 IP 地址)。

我使用的是 Fedora 16。

编辑:输出iptables -L -n

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
INPUT_direct  all  --  0.0.0.0/0            0.0.0.0/0           
INPUT_ZONES  all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
FORWARD_direct  all  --  0.0.0.0/0            0.0.0.0/0           
FORWARD_ZONES  all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
OUTPUT_direct  all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD_ZONES (1 references)
target     prot opt source               destination         
FWDO_ZONE_public  all  --  0.0.0.0/0            0.0.0.0/0           
FWDI_ZONE_public  all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD_direct (1 references)
target     prot opt source               destination         

Chain FWDI_ZONE_public (1 references)
target     prot opt source               destination         
FWDI_ZONE_public_deny  all  --  0.0.0.0/0            0.0.0.0/0           
FWDI_ZONE_public_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain FWDI_ZONE_public_allow (1 references)
target     prot opt source               destination         

Chain FWDI_ZONE_public_deny (1 references)
target     prot opt source               destination         

Chain FWDO_ZONE_external (0 references)
target     prot opt source               destination         
FWDO_ZONE_external_deny  all  --  0.0.0.0/0            0.0.0.0/0           
FWDO_ZONE_external_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain FWDO_ZONE_external_allow (1 references)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FWDO_ZONE_external_deny (1 references)
target     prot opt source               destination         

Chain FWDO_ZONE_public (1 references)
target     prot opt source               destination         
FWDO_ZONE_public_deny  all  --  0.0.0.0/0            0.0.0.0/0           
FWDO_ZONE_public_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain FWDO_ZONE_public_allow (1 references)
target     prot opt source               destination         

Chain FWDO_ZONE_public_deny (1 references)
target     prot opt source               destination         

Chain INPUT_ZONES (1 references)
target     prot opt source               destination         
IN_ZONE_public  all  --  0.0.0.0/0            0.0.0.0/0           

Chain INPUT_direct (1 references)
target     prot opt source               destination         

Chain IN_ZONE_dmz (0 references)
target     prot opt source               destination         
IN_ZONE_dmz_deny  all  --  0.0.0.0/0            0.0.0.0/0           
IN_ZONE_dmz_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain IN_ZONE_dmz_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW

Chain IN_ZONE_dmz_deny (1 references)
target     prot opt source               destination         

Chain IN_ZONE_external (0 references)
target     prot opt source               destination         
IN_ZONE_external_deny  all  --  0.0.0.0/0            0.0.0.0/0           
IN_ZONE_external_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain IN_ZONE_external_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8080 ctstate NEW

Chain IN_ZONE_external_deny (1 references)
target     prot opt source               destination         

Chain IN_ZONE_home (0 references)
target     prot opt source               destination         
IN_ZONE_home_deny  all  --  0.0.0.0/0            0.0.0.0/0           
IN_ZONE_home_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain IN_ZONE_home_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:631 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251          udp dpt:5353 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:137 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:138 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8080 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 ctstate NEW

Chain IN_ZONE_home_deny (1 references)
target     prot opt source               destination         

Chain IN_ZONE_internal (0 references)
target     prot opt source               destination         
IN_ZONE_internal_deny  all  --  0.0.0.0/0            0.0.0.0/0           
IN_ZONE_internal_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain IN_ZONE_internal_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:631 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251          udp dpt:5353 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:137 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:138 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8080 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 ctstate NEW

Chain IN_ZONE_internal_deny (1 references)
target     prot opt source               destination         

Chain IN_ZONE_public (1 references)
target     prot opt source               destination         
IN_ZONE_public_deny  all  --  0.0.0.0/0            0.0.0.0/0           
IN_ZONE_public_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain IN_ZONE_public_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251          udp dpt:5353 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 ctstate NEW
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8080 ctstate NEW

Chain IN_ZONE_public_deny (1 references)
target     prot opt source               destination         

Chain IN_ZONE_work (0 references)
target     prot opt source               destination         
IN_ZONE_work_deny  all  --  0.0.0.0/0            0.0.0.0/0           
IN_ZONE_work_allow  all  --  0.0.0.0/0            0.0.0.0/0           

Chain IN_ZONE_work_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251          udp dpt:5353 ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:631 ctstate NEW

Chain IN_ZONE_work_deny (1 references)
target     prot opt source               destination         

Chain OUTPUT_direct (1 references)
target     prot opt source               destination  

编辑:输出netstat -an | grep '^tcp'

[root@localhost etc]# netstat -an | grep '^tcp'
tcp        0      0 127.0.0.1:9999          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:4447          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:9990          0.0.0.0:*               LISTEN     
tcp        0      0 10.1.5.4:42019          203.190.124.28:80       TIME_WAIT  
tcp        0      0 10.1.5.4:59036          198.252.206.25:80       ESTABLISHED
tcp        0      0 10.1.5.4:40731          74.125.236.111:443      ESTABLISHED
tcp        0      0 10.1.5.4:43896          74.125.236.33:80        ESTABLISHED
tcp        0      0 10.1.5.4:57049          74.125.236.160:80       ESTABLISHED
tcp        0      0 10.1.5.4:52908          74.125.236.162:443      ESTABLISHED
tcp        0      0 10.1.5.4:48313          204.154.94.81:443       ESTABLISHED
tcp        0      0 10.1.5.4:59059          198.252.206.25:80       ESTABLISHED
tcp        0      0 10.1.5.4:50342          74.125.236.161:80       ESTABLISHED
tcp        0      0 10.1.5.4:42020          203.190.124.28:80       TIME_WAIT  
tcp        0      0 10.1.5.4:48398          74.125.135.95:80        TIME_WAIT  
tcp        0      0 10.1.5.4:42036          68.232.44.121:80        TIME_WAIT  
tcp        0      0 10.1.5.4:42132          141.101.114.59:80       TIME_WAIT  
tcp        0      0 10.1.5.4:40183          96.17.182.57:80         TIME_WAIT  
tcp        0      0 10.1.5.4:57117          203.190.124.17:80       TIME_WAIT  
tcp        0      0 10.1.5.4:50606          198.252.206.16:80       ESTABLISHED
tcp        0      0 10.1.5.4:45892          74.125.236.40:80        ESTABLISHED
tcp        0      0 10.1.5.4:42133          141.101.114.59:80       TIME_WAIT  
tcp        0      0 10.1.5.4:42037          68.232.44.121:80        TIME_WAIT  
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::6000                 :::*                    LISTEN     
tcp6       0      0 :::5298                 :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 :::9278                 :::*                    LISTEN     

答案1

您的盒子有多个接口。每个接口可以有多个IP 地址。 (其中,lo 上有 127.0.0.1,eth0 上有 10.1.5.5,或类似的东西。 - 请参阅ip addr获取详细信息。)

现在,您已经在那个盒子上运行了某种 Web 服务器。要让其他人可以访问它,它必须绑定到某些接口或 IP 地址。

在 Web 服务器的配置文件中的某个位置,您应该找到一个“监听”或“绑定”选项,指定服务器绑定的地址。

目前它似乎只绑定到127.0.0.1,即只能通过环回接口从您自己的盒子访问它。 (netstat -tpln详情请参阅。)

如果您想让它可以从任何地方进行更改,通常可以将其绑定到“*”或“0.0.0.0”。 - 查看您的配置文档。

相关内容