当前位置:网站首页>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 )
边栏推荐
- Emoji icons supported by markdown
- 微信公众号第三方平台开发,零基础入门。想学我教你啊
- Summary of common pytoch APIs
- MIME类型大全
- 基于Svelte3.x桌面端UI组件库Svelte UI
- 云服务器上部署仿牛客网项目
- C# ListBox如何获取选中的内容(搜了很多无效的文章)
- Redis design and Implementation (I) | data structure & object
- Common tools installation, configuration, compilation, link, etc
- 【NVMe2.0b 14-5】Firmware Download/Commit command
猜你喜欢

Tidb 6.0: making Tso more efficient tidb Book rush

Flink Exception -- No ExecutorFactory found to execute the application

Sword finger offer II 075 Array relative sort (custom sort, count sort)

Sword finger offer II 076 The kth largest number in the array (use heap to solve TOPK problem)

Sword finger offer II 074 Merge interval (sort, array)

Detectron2 source code reading 3-- encapsulating dataset with mapper

A troubleshooting of CPU bottom falling

从0开始构建一个瀚高数据库Docker镜像

Swagger use

How can we get a satisfactory salary? These routines still need to be mastered
随机推荐
Flink sql -- No factory implements ‘org.apache.flink.table.delegation.ExecutorFactory‘.
2021-02-19
[nvme2.0b 14-7] set features (Part 1)
【NVMe2.0b 14-7】Set Features(上篇)
JS中的this指向
Map,String,Json之間轉換
[untitled]
Wikimedia Foundation announces the first customers of its new commercial product "Wikimedia enterprise"
我们如何拿到自己满意的薪资呢?这些套路还是需要掌握的
Flink SQL custom connector
示波器探头对测量电容负荷有影响吗?
2021-02-18
MIME type Encyclopedia
vite项目require语法兼容问题解决require is not defined
MIME类型大全
Enhance the add / delete operation of for loop & iterator delete collection elements
End-to-end 3D Point Cloud Instance Segmentation without Detection
Redis design and Implementation (VI) | cluster (sharding)
维基媒体基金会公布新商业产品“维基媒体企业”首批客户
Gilbert Strang's course notes on linear algebra - Lesson 2