您的位置:首页 > 运维架构 > Linux

本地环回接口lo The Loopback Network Interface lo--用Enki学Linux系列(2)

2017-01-11 12:27 591 查看
当你执行ifconfig命令时会看到一个名为lo的接口,似乎它没有与任何物理设备通信:
If you run the ifconfig command you’ll see an interface designated lo that doesn’t appear to correspond to any physical device:
$ ifconfig
lo
Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:31 errors:0 dropped:0
overruns:0 frame:0
TX packets:31 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2240 (2.2 KB)
TX bytes:2240 (2.2 KB)
$
lo接口(lo代替“loopback”)是一个特别的,虚拟的网络接口,它的所有流量(上行或下行)不用任何处理或修改,自动发送给接口本身。它被配置了127.0.0.1这个不能公开使用,永远指设备本身的特殊IP。
The lo interface (lo stands for “loopback”) is a special, virtual network interface in which all traffic (up or down) is automatically sent back to the interface itself without any processing or modification. It is assigned the IP address 127.0.0.1, which is a special IP address that can’t ever be used publicly and always refers to the machine itself.
把本地环回接口和IP127.0.0.1想象成一个反身代词:它永远是“这个设备本身”的意思。“localhost”经常被用来表示同样的意思。
Think of the loopback interface and the 127.0.0.1 IP as a reflexive pronoun: it always means “this machine itself”. The term “localhost” is often used to mean the same thing in this context.
环回接口用来查错和运行本机内部的网络服务。比如,我们可能需要运行一个web应用的开发版本,但不希望将它连接到整个互联网。我们可以将它配置成仅通过环回接口发送接收数据,然后通过http://127.0.0.1访问。
The loopback interface is used for debugging and running machine-internal network services. For example, we might have a development version of a web application running and don’t want it available to the internet at large. We could configure it to only send/receive traffic over the loopback interface and then access it at http://127.0.0.1.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux