连接 0.0.0.0/32 发生了什么

根据RFC 3330, 1700 的描述, 0.0.0.0/32 可以用作当前网络的源地址。

0.0.0.0/8 - Addresses in this block refer to source hosts on "this" network.
Address 0.0.0.0/32 may be used as a source address for this host on this network;
other addresses within 0.0.0.0/8 may be used to refer to specified hosts on this network.
[RFC1700, page 4].

0.0.0.0/32 作为目标地址使用时,与127.0.0.1含义一样。
但是0.0.0.0还有更多的含义,如下

IP address numbers in Internet Protocol (IP) version 4 (IPv4) range from 0.0.0.0 up to 255.255.255.255. The IP address 0.0.0.0 has several special meanings on computer networks. It cannot be used as a general-purpose device address, however.

IPv6 networks have a similar concept of an all-zeros network address.

0.0.0.0 on Clients

PCs and other client devices normally show an address of 0.0.0.0 when they are not connected to a TCP/IP network. A device may give itself this address by default whenever they are offline. It may also be automatically assigned by DHCP in case of address assignment failures.  When set with this address, a device cannot communicate with any other devices on that network over IP.

0.0.0.0 can also theoretically set as a device's network (subnet) mask rather than its IP address. However, a subnet mask with this value has no practical purpose. Both the IP address and network maskare typically assigned as 0.0.0.0 on a client together.  

Software Application and Server Uses of 0.0.0.0
Some devices, particularly network servers, possess more than one IP network interface. TCP/IP software applications use 0.0.0.0 as a programming technique to monitor network traffic across all of the IP addresses currently assigned to the interfaces on that multi-homed device.

While connected computers do not use this address, messages carried over IP sometimes include 0.0.0.0 inside the protocol header when the source of the message is unknown.

The Use of 0.0.0.0 vs. 127.0.0.1 on Local Networks

Students of computer networks sometimes confuse the usages of 0.0.0.0 and 127.0.0.1 on IP networks. Whereas 0.0.0.0 has several defined uses as described above, 127.0.0.1 has the one very specific purpose of allowing a device to send messages to itself.

Troubleshooting IP Address Problems with 0.0.0.0

If a computer is properly configured for TCP/IP networking yet still shows 0.0.0.0 for an address, try the following to troubleshoot this problem and obtain a valid address:

On networks with dynamic address asssignment support, release and renew the computer's IP address. Failures with DHCP assignment can be intermittent or persistent. If the failures persist, troubleshoot the DHCP server configuration: Common causes of failure include having no available addresses in the DHCP pool.
For networks that require static IP addressing, configure a valid IP address on the computer.

0.0.0.0/32 可以用来表示当前网络,与0.0.0.0建立连接,实际上是与回环地址建立连接。

如下

# ping 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.018 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.033 ms

如果把回环地址shutdown,连接0.0.0.0会不行.

# ifdown lo

$ psql -h 0.0.0.0
psql: could not connect to server: Connection timed out
        Is the server running on host "0.0.0.0" and accepting
        TCP/IP connections on port 1921?

# ping 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
^C
--- 0.0.0.0 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

所以连接0.0.0.0匹配的PostgreSQL服务端的pg_hba.conf条目是127.0.0.1/32。而不是0.0.0.0/0 。

pg_hba.conf
host all all 127.0.0.1/32  trust

参考
https://www.rfc-editor.org/rfc/rfc1700.txt
https://www.rfc-editor.org/rfc/rfc3330.txt
http://compnetworking.about.com/od/workingwithipaddresses/g/0_0_0_0_ip-address.htm

时间: 2024-10-26 05:42:35

连接 0.0.0.0/32 发生了什么的相关文章

MSSQL通过端口1433连接到主机127.0.0.1的TCP/IP连接失败

环境:SQLServer 2008 R2 + MyEclipse 6.5 + JDK 1.6.24 问题: Java通过JDBC连接 SQLServer 2008,出现如下问题:通过端口 1433 连接到主机 127.0.0.1 的 TCP/IP 连接失败.错误: "connect timed out.请验证连接属性,并检查 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接. 解决: 1. 打开 SQLServer 配

开发环境-在WINDOESXP上用的VC6.0怎么在WINDS7 32位的系统上正常使用

问题描述 在WINDOESXP上用的VC6.0怎么在WINDS7 32位的系统上正常使用 为什么VC6.0在WINDOWS7 32位的系统上安装了不能用,怎么改兼容性才能正常使用

图像处理-一台电脑如何同时连接2台kinect2.0?

问题描述 一台电脑如何同时连接2台kinect2.0? 想在电脑里面的vs2013同时打开2个视频窗口(由2台kinect 2.0分别实时拍摄),安装的sdk是Kinect for WindowsSDK 2.0 Language Packs(如果需要安装版本的sdk也可以,只要找得到)

通过端口1433连接到主机127.0.0.1的 TCP/IP 连接失败,错误:“connect timed out”的解决方法_java

我们在连接数据库时总会出现一些问题,今天给大家分享遇到通过端口1433连接到主机127.0.0.1的 TCP/IP 连接失败.错误:"connect timed out的解决办法. 环境:SQLServer 2008 R2 + MyEclipse 6.5 + JDK 1.6.24  问题:Java通过JDBC连接SQLServer 2008,出现如下问题:通过端口1433 连接到主机127.0.0.1 的TCP/IP 连接失败.错误:"connect timed out.请验证连接属性

Serv-U 无法连接到服务器127.0.0.1,端口43958 之解决办法_FTP服务器

Serv-U"无法连接到服务器127.0.0.1,端口43958"的原因 始终搞不明白问题出在哪里,后上网查了资料,大概原因如下: 43958,这是Serv-U的本地管理端口,只允许127.0.0.1连接,这个端口不能连接,是因为: 1. 权限错.(本人再将system加进,且赋予默认权限,问题解决.) 2. 可能软件本身问题,也禁止了127.0.0.1的连接: 3. 黑客攻击也有可能出现这个问题. Serv-U"无法连接到服务器127.0.0.1,端口43958"

PostgreSQL 9.5.0 PK Oracle 12.0.1.2.0 TPC-C性能极限

Oracle 12c TPC-C 测试请参考: http://blog.163.com/digoal@126/blog/static/1638770402015112344924835/ 文件系统为XFS,优化手段如下: http://blog.163.com/digoal@126/blog/static/16387704020160695427218/ 本文在同样的硬件测试环境下对比PostgreSQL 9.5.0. 我们看看1月7号发布的PostgreSQL 新版本性能咋样? benchma

从流量到形式,萌芽期的1.0和2.0时代

根据行业第三方调研机构发布的2014年互联网广告行业的实力分布数据显示,BAT三家占据了互联网广告的绝对领先地位,毫无疑问,这是一个数据决定一切的时代.如同人类从农耕时代发展到互联网时代,互联网广告的演化过程同样一波三折.每一个时代,都包含了太多的风雨沉浮.在对未来进行美好愿景之前,我们需要记住的,只是那些导致事物演化的关键因素. 从流量到形式,萌芽期的1.0和2.0时代 1.0时代的互联网广告受限于网速,表现形式相对单一,主要由文字和图片构成,其核心价值是广告位.好的广告位流量大.点击率高,在

常用headers以及Server变量的列表,目前适用于IE3.0、4.0,请高手加入5.0

server|变量 Server变量的列表.下列解释几个最为常用的:  HTTP_REFERER.当某人通过链接到达当前页时,HTTP_REFERER header就保存了这个用户的来源,例如,如果你想知道用户有多少是从yahoo中访问这个站点,就可以利用HTTP_REFERER来获取这样的信息.HTTP_USER_AGENT. 这个Header指示了用户访问站点所用的网络浏览器的类型,当你需要了解网站主要客户群使用何种浏览器,就可以利用这个Header中进行了解.Remote_Addr.

蓝牙4.0和3.0的区别

  蓝牙,是一种支持设备短距离通信(一般10m内)的无线电技术,经过近几年的发展,我们对它已不再陌生,它也是目前数码产品中不可或缺的模块.蓝牙技术的出现让我们在连接各种设备的时候不再被繁多的数据线所束缚,比如音响.电脑.鼠标.键盘,甚至是汽车.这技术是在两个设备间进行无线短距离通信的最简单.最便捷的方法,也能够简化设备与因特网Internet之间的通信,从而数据传输变得更加迅速高效. 近日,蓝牙技术联盟(Bluetooth SIG)公布蓝牙4.2核心技术标准,据悉,新技术可以增强隐私保护,加快数