博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
连接 0.0.0.0/32 发生了什么
阅读量:7102 次
发布时间:2019-06-28

本文共 3478 字,大约阅读时间需要 11 分钟。

根据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 ClientsPCs 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.0Some 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 NetworksStudents 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.0If 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.0PING 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 ms64 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.0psql: 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.0PING 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.confhost all all 127.0.0.1/32  trust

参考

转载地址:http://vurql.baihongyu.com/

你可能感兴趣的文章
C#中yield用法
查看>>
常用的Linux操作
查看>>
风电场向管理要效益
查看>>
进程监控及管理常用命令
查看>>
echo
查看>>
Myeclise下tomcat启动报错,启动超时
查看>>
Map接口、静态导入、Collections集合工具类
查看>>
Http组件的介绍
查看>>
HDU1043、3567八数码 bfs+康托展开
查看>>
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
查看>>
蓦然回首
查看>>
[转] Meida视频加密二-Blob对象
查看>>
JavaScript 变量、函数与原型链
查看>>
saltstack Key管理工具-salt-key
查看>>
WWDC19 -224-iOS 13 Presentations 适配
查看>>
Mybatis异常There is no getter for property named 'XXX' in 'class java.lang.String'
查看>>
jQuery初始化
查看>>
[转载]Linux内存高,触发oom-killer问题解决
查看>>
帮助小白快速理解多线程
查看>>
Android系统移植与驱动开发概述
查看>>