当前位置:网站首页>127.0.0.1, 0.0.0.0 and localhost
127.0.0.1, 0.0.0.0 and localhost
2022-06-30 08:38:00 【Attacking brother pea】
Reproduced in :https://zhuanlan.zhihu.com/p/439510282
Let's take a look at what we have in common :
- All belong to special address .
- All belong to A Class address .
- All are IPV4 Address .
Next, let's look at the three addresses respectively :
0.0.0.0
First ,0.0.0.0 Can't be ping common .0.0.0.0 be called “unspecified”, I.e. not specified ( Is invalid , Meaningless ) Address . functionally , Generally used in some programs / It is inconvenient to use in the network protocol ip In special circumstances ( To put it bluntly, it is a case for some comparison pits “ Place holder ”), such as DHCP The client has not obtained ip It is stipulated to use 0.0.0.0 do “ source address ”, Or in the server ,0.0.0.0 Not a real IP Address , It represents all... In this machine IPV4 Address . When the server does not specify which network card to listen on , Also used 0.0.0.0, At this time, listen to all in this machine IP The port of .
purpose
- Used as a server , Any on this machine IPV4 Address .
127.0.0.1
First of all, we need to know a concept , All with 127 At the beginning IP Address , It's all loopback addresses (Loop back address), The loopback interface is generally understood as a virtual network card , Not a real router interface .
The so-called loopback address , Generally speaking , That is, we send it to... On the host 127 At the beginning IP The address packet will be received by the sending host itself , It doesn't get out at all , The external device cannot access the local device through the loopback address .
Last 127.0.0.1 Belong to {127,} One of the sets , And all network numbers are 127 The addresses of are called loopback addresses , So the return address !=127.0.0.1, They are containment relationships , That is, the loopback address contains 127.0.0.1.
purpose
- Loop back test , By using ping 127.0.0.1 Test a network device on a machine , Operating system or TCP/IP Whether the implementation works normally .
- DDos Attack defense : Website received DDos After the attack , Domain name A It was recorded that 127.0.0.1, Let the attacker attack himself .
- Most of the Web The native address of the binding when the container is tested .
localhost
comparison 127.0.0.1,localhost Have more meaning .localhost It's a domain name , Instead of a ip Address . The reason why we often put localhost And 127.0.0.1 I think it's the same because most of the computers we use say localhost Yes 127.0.0.1 This address .
however localhost The meaning of is not limited to 127.0.0.1.
localhost Is a domain name , Used to refer to this computer perhaps this host, It can be used to obtain network services running on the local machine .
In most systems ,localhost Was pointed to IPV4 Of 127.0.0.1 and IPV6 Of ::1.
127.0.0.1 localhost
::1 localhost
therefore , Pay attention to confirm when using IPV4 still IPV6
summary
127.0.0.1 It's a loopback address . It doesn't mean “ This machine ”.0.0.0.0 That's what it really means “ Local machine in this network ”.
in application , In general, when Binding ports on the server, we can choose to bind to 0.0.0.0, So that my service visitors can go through my multiple ip Address access to my services .
For example, I have a server , An external address A, An intranet address B, If the port I bind specifies 0.0.0.0, Then I can access my application through intranet address or Internet address . But if I bind an intranet address , Then you can't access it through the Internet address . So if binding 0.0.0.0, There are also some hidden dangers , For services that only need intranet access , You can only bind the intranet address .
(127.0.0.1 Only to the kernel protocol stack ,0000 I have to go to the network card , The network card is interrupted )
边栏推荐
- Wikimedia Foundation announces the first customers of its new commercial product "Wikimedia enterprise"
- QT event cycle
- 2021-05-06
- mysql基础入门 动力节点[老杜]课堂作业
- Self made GIF dynamic graph -gifcam
- A troubleshooting of CPU bottom falling
- Flink Sql -- toAppendStream doesn‘t support consuming update and delete changes which
- [untitled]
- C# ListBox如何获取选中的内容(搜了很多无效的文章)
- Redis design and Implementation (II) | database (deletion strategy & expiration elimination strategy)
猜你喜欢

维基媒体基金会公布新商业产品“维基媒体企业”首批客户

swagger使用

Graffiti Wi Fi & ble SoC development slide strip

自制GIF动态图-gifcam

How can we get a satisfactory salary? These routines still need to be mastered

云服务器上部署仿牛客网项目

技术管理进阶——管理者如何进行梯队设计及建设

涂鸦Wi-Fi&BLE SoC开发幻彩灯带

【NVMe2.0b 14-1】Abort、Asynchronous Event Request、Capacity Management command

Gilbert Strang's course notes on linear algebra - Lesson 3
随机推荐
Self made GIF dynamic graph -gifcam
How can we get a satisfactory salary? These routines still need to be mastered
[untitled]
Detailed explanation of pytoch's scatter function
云服务器上部署仿牛客网项目
增强for循环的增删操作 & 迭代器删除集合元素
Is the reverse repurchase of treasury bonds absolutely safe? How to open an account online
【NVMe2.0b 14】NVMe Admin Command Set
Comparaison de deux façons d'accéder à la base de données SQL Server (sqldatareader vs sqldataadapter)
127.0.0.1、0.0.0.0和localhost
Summary of common pytoch APIs
[untitled]
Codeworks 5 questions per day (1700 for each) - the third day
【NVMe2.0b 14-4】Directive Send/Receive command
1. Problems related to OpenGL window and environment configuration
Tidb v6.0.0 (DMR): initial test of cache table - tidb Book rush
Unity basic lighting model
Unity简单shader
Introduction to MySQL foundation power node [Lao Du] class assignment
Build a docker image of Henkel database from 0