系統管理
1822520 會員
2537 線上
109642 解決方案
發表新文章

關於localhost一問

 
watermelonyu
教授

關於localhost一問

/etc/hosts 裡面有一行

127.0.0.1 localhost

請問這個localhost存在有特殊意義嗎

在哪個地方用的到

如果被刪除有影響嗎
6則回覆 6
watermelonyu
教授

關於localhost一問

127.0.0.1 is a special IP address that is

referred to as "loopback" with various aliases

such as "localhost" and "lb". Essentially when

the IP subsystem sees this address, it loops

back to itself without making a physical

network connection. It provides a mechanism for

a box to always be able to talk to itself and

can be very useful to see, for example, if the

network is configured correctly eventhough the

underlying NIC's may not yet be properly

configured or connected.



if you remove the localhost setting from

the /etc/hosts, I don't think the application

such as oracle listener will work, and

others .... just like above words, it's special

IP address, so can't be remove.
watermelonyu
教授

關於localhost一問

Joey,



127.0.0.1 is what you need for the loopback (lo or localhost) interface. Your own local machine needs to be able to do a lot of things without having to have a working network (eht0, wlan0, etc) or internet interface. That's what 127.0.0.1 is used for. In most cases, if you remove the 127.0.0.1, your computer will have many problems.



However, if you have a test environment, you can try to do that. Than you will see what's happened after deleting the 127.0.0.1. ^^



Rgds,



Eric
watermelonyu
教授

關於localhost一問

lookback 是一個特殊的位址, 且一定要存在於 /etc/hosts. 而lookback 位址定義為127.0.0.1, 還有一個意義, 即可用來檢測網卡是否正常. 而如果它不存在於 /etc/hosts, 一些跟網路相關的 services 可能會出現一些狀況.

watermelonyu
教授

關於localhost一問

如果是跟網路無關的 service, 也許不會有問題...
watermelonyu
教授

關於localhost一問

我有多張網卡的話

那檢測網卡,是會檢查哪一張呢?
watermelonyu
教授

關於localhost一問

檢測網卡是用linkloop指令, 透過mac address檢測, so, 就看你要檢測的網卡mac address的值了. try linkloop, and lanscan兩個指令.