The difference between 127.0.0.1 and localhost and IP
May 18, 2014
localhost
No networking
Do not use network cards and are not restricted by firewalls and network cards
Native access
General use 本地套接字文件AF_UNIX
of the application general conventions are used localhost
to prioritize local socket connections. mysqlclient and MySQLserver are such conventions
127.0.0.1
No networking
Network card transmission, restricted by firewalls and network cards
Native access
127.0.0.1 is the IP address inside the host IP stack: The windows/unix
IP address that is found inside the IP stack is 127.0.0.l
immediately returned to the application layer.
192.168.*.*
Networking
Network card transmission, restricted by firewalls and network cards
Native or local area network access
Native IP
Networking
Network card transmission, restricted by firewalls and network cards
Native or local area network or external access
Why localhost does not use a network card but the hosts have records.
When parsing is convenient, pointing to applications that need to resolve to IP will still use/etc/hosts to resolve to 127.0.0.1 such as Ping
For example, when accessing http://localhost
a browser because of protocol-based tcp/ip
, you need to look up the host
table
And we used to mysql
specify by default is locaLhost
that this uses /tmp/mysql.sock
the本地套接字文件AF_UNIX
This article is from: Http://i.joymvp.com, the original address: http://i.joymvp.com/%E6%8A%80%E6%9C%AF/routing-traffic-localhost.html, thank the original author to share.
The difference between 127.0.0.1 and localhost and IP