dnsmasqでホストを一元管理
以前LDAPでやりましたがLDAPはクライアントの設定*1が必要でめんどくさい。
dnsmasq使えばルータで設定すればクライアントの設定無しでできる。
手順
dnsmasq(8) 便利かも - flatlineの日記
を参考に。
- /etc/hostsに設定書く
- dnsmasqインストール
- ルータにプライマリDNSサーバとしてdnsmasqを動かしているサーバを指定
注意点
dnsmasqを動かしてるサーバのhostsで
127.0.0.1 localhost hoge
みたいに自分のhostnameを指定してると
ssh hogeすると127.0.0.1につながることになるので注意...
127.0.0.1 localhost
だけにしましょう。
追記: fc2の画像が表示されない
キャッシュが有効だと表示されないっぽい。
デフォルトでは有効なので/etc/dnsmasq.confをいじって無効にしておく。
- c, --cache-size=
Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching.
Man page of DNSMASQ
--- /etc/dnsmasq.conf.bak 2011-09-05 05:33:25.719776181 +0000 +++ /etc/dnsmasq.conf 2011-09-05 05:33:12.361983425 +0000 @@ -447,6 +447,7 @@ # Set the cachesize here. #cache-size=150 +cache-size=0 # If you want to disable negative caching, uncomment this. #no-negcache
原因はなんだろ...
画像のリファラのIPがキャッシュされてるものと違ってたり?
自分にはそれぐらいしか考えられない...