概覽能夠分析與過濾進入管理的封包資料,就可以稱為防火牆。而防火牆又可以分為硬體防火牆及軟體防火牆。例如,iptables與TCP Wrappers都可以稱為軟體防火牆。類別 除了軟體及硬體防火牆,也可以封包的抵擋機制來進行分類,分別是代理伺服器及IP Filter。目的 防火牆是一種非常有效的網路安全模型,通過它可以隔離Internet與局域網的連接,並通過監控進出網路的通信量,僅讓安全、核准了的資訊進入,從而實現對內部網路的保護。Netfilter/Iptables 的關係 Linux的封包防火牆機制,由兩個元件netfilter和iptables組成的 netfilter組件是內核的一部分:由一些包過濾表組成 iptables元件是一種工具:它是用戶空間的一部分,它用來維護包過濾表中的規則,包括包過濾規則的插入、修改和刪除
實現Netfilter(iptables),要從兩方面著手:1.Kernel支持netfilter2.User Mode支持iptables配置命令
重新編譯kernel,把 iptables/netfilter選項開啟,並停用bridge-> Networking support -> Networking options -> Network packet filtering framework(Netfilter) -> Network packet filtering debugging -> Advaned netfilter configuration Core Netfilter Configuration -> Netfilter NFQUEUE over NFNETLINK interface -> Netfilter connection tracking support -> Netbios name service protocal support(new) -> Netfilter Xtables support (required for ip_tables) -> multiport Multiple port match support -> owner match support -> state match support IP: Netfilter Configuration -> IPv4 connection tracking support (require for NAT) -> proc/sysctl compatibility with old connection tracking -> IP tables support (required for filtering/masq/NAT) -> Packet filtering -> REJECT target support -> Full NAT -> MASQUERADE target support -> REDIRECT target support
1.安裝交叉編譯工具鏈2.配置環境變量,打開/etc/profile 文件3.編譯Kernel (linux-2.6.38)4.下載 Iptables源代碼 (使用iptables-1.4.3.2/iptables-1.4.3.1) 5.拷貝編碼器缺檔(ipt_dscp.h、ipt_DSCP.h)到/iptable-x.x.x/extensions/下。PS.如果使用gcc-4.5.1會缺這兩個檔。6.編譯iptables # ./configure --prefix=/usr/local/arm/iptables --host=arm-linux # make CC=arm-linux-gcc KERNEL_DIR=/home/linux-2.6.38/kernel/ # make CC=arm-linux-gcc install7.拷貝/usr/local/arm/iptables整個資料夾到Target platform
# ./configure --prefix=/usr/local/arm/iptables --host=arm-linux –with-kernel=/home/linux-2.6.38/kernel/ --disable-shared --enable-static