Linux hostid 的演算步驟:
1. 用 $HOSTNAME 反查,查看 /etc/hosts 的記錄,來得到 IP
2. IP 四個數字轉 Hex
3. 再做 2143 順位的轉換
範例:
在 /etc/hosts 內的第一行記錄是
127.0.0.1 hostname localhost.localdomain localhost
1. 用$HOSTNAME 反查得知 IP 為 127.0.0.1
2. 127.0.0.1 轉成 Hex 為 7F000001
3. 再做 2143 順位的轉換,得到 007F0100
說明:這也說明了,為什麼 linux 查到的 hostid 都是 7f0100 這個答案了 ^ ^
參考網址:
http://pank.org/blog/2005/10/linux-hostid.html
沒有留言:
張貼留言