]
トップ «前の日記(2008-08-14) 最新 次の日記(2008-08-16)» 編集

Yukiharu YABUKI の tDiary



このtDiaryを検索します。

2008-08-15 [長年日記]

_ netfilter/iptables --- ulog は obsolute で NFNETLINK が使われる。

Debian GNU/Linux Etch の menuconfig 画面より。
  │ CONFIG_NETFILTER_NETLINK_LOG:
  │                              
  │ If this option is enabled, the kernel will include support
  │ for logging packets via NFNETLINK.                        
  │                                                           
  │ This obsoletes the existing ipt_ULOG and ebg_ulog mechanisms,
  │ and is also scheduled to replace the old syslog-based ipt_LOG
  │ and ip6t_LOG modules.                                        
  │                                                              
  │ Symbol: NETFILTER_NETLINK_LOG [=m]                           
  │ Prompt: Netfilter LOG over NFNETLINK interface               
  │   Defined at net/netfilter/Kconfig:17                        
  │   Depends on: NET && NETFILTER && NETFILTER_NETLINK          
  │   Location:                                                  
  │     -> Networking                                            
  │       -> Networking support (NET [=y])                       
  │         -> Networking options                                
  │           -> Network packet filtering (replaces ipchains) (NETFILTER [=y])
  │             -> Core Netfilter Configuration                               
  │               -> Netfilter netlink interface (NETFILTER_NETLINK [=m])     

Iptablesチュートリアル 1.2.2 - Chapter 11. iptablesのターゲットとジャンプ - 11.27. ULOGターゲット(http://www.asahi-net.or.jp/~aa4t-nngk/ipttut/output/ulogtarget.html) を読むと、これまでは ulog がユーザ空間での logging を 提供していた。でも、少なくとも 2.6.18 のカーネルでは、NFNETLINK がその部分の機能を置き換えるようだ。こいつを使うと、ユーザー空間で動いている MySQL などにログを書き込む事ができる。

でも、iptables の -j LOG で、syslog にログを出す場合も多いだろう。11.10. LOGターゲット(http://www.asahi-net.or.jp/~aa4t-nngk/ipttut/output/ipttut_all.html#LOGTARGET)

_ netfilter/iptables --- table と chain の図

netfilter/iptables の filter, nat, mangle とそれぞれのprerouting, input, forward, output, postrouting 評価順番の明快な図を探して、Unix Magazine の DVD の中で、2002年10月号の"Linux 2.4 の netfilter"という記事や、関根さんと吉田さんが書かれた、Linuxスーパーユーザハンドブック Technical Handbook (Technical Handbook Series)(吉田 智彦/関根 達夫)にも、この関連図が載っているぐらいで、私が調べた中では他の本でここまで言及している本が少ない。雑誌の記事などでもっと良い記事があったのかもしれないが。

調べてみると思った以上に、この通り iptables を設定しなさいという、結果だけ教えるタイプの本ばかりでびっくりした。"Give a man a fish, and he'll eat for a day." の記事が多いって事は一定の需要もあるのだろう。でも、"Teach a man to fish, and he'll eat forever." な要求を満たすのは、Chapter 6. テーブルとチェーンの道のり(http://www.asahi-net.or.jp/~aa4t-nngk/ipttut/output/ipttut_all.html#TRAVERSINGOFTABLES) が非常に詳しくて、参考になっている。