Ipp2p l7filter Debian
วิธีการติดตั้ง ipp2p , l7filter บน Debian Etch 4 ( เก่า ) แบบใหม่ Work 100% Click
1. Edit Source list
#nano /etc/apt/source.list deb http://www.backports.org/debian etch-backports main contrib non-free #apt-get update && apt-get install debian-backports-keyring && apt-get update
Download Kernel Package
#apt-get install build-essential kernel-package libncurses5-dev bzip2 #cd /usr/src #wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.tar.bz2
Download the iptables version 1.4.0 the layer7 version 2.20 and the layer7 protocols ipp2p
#wget http://netfilter.org/projects/iptables/files/iptables-1.4.0.tar.bz2 #wget http://downloads.sourceforge.net/l7-filter/netfilter-layer7-v2.20.tar.gz #wget http://downloads.sourceforge.net/l7-filter/l7-protocols-2008-04-23.tar.gz #wget http://www.ipp2p.org/downloads/ipp2p-0.8.2.tar.gz
แตก File ทั้งหมด ไว้ที่ /usr/src
#ln -sf /usr/src/linux-2.6.25 /usr/src/linux #ln -sf /usr/src/iptables-1.4.0 /usr/src/iptables #cd linux #patch -p1 < ../netfilter-layer7-v2.20/kernel-2.6.25-layer7-2.20.patch #cp /boot/config-2.6.18-6-686 ./.config #make menuconfig
ไปที่ Networking –> Networking options –> Network packet filtering framework (Netfilter) –> Core netfilter configuration
เลือก
<M> Netfilter connection tracking support <M> “layer7″ match support [*] Layer 7 debugging output
Exit และไปที่ IP: Netfilter Configuration
<M> IPv4 connection tracking support (required for NAT) <M> Full NAT
เสร็จแล้วออก ( และอย่าลืม FTP Support ด้วย ไม่งั้น ip_conntrack_ftp ไม่มานะจ๊ะ ) เซฟ Kernel config ซะถึงเวลา Compile Kernel โดยใช้คำสัง
#make-kpkg clean #make-kpkg --initrd --append-to-version=-l7filter kernel_image kernel_headers
รอ เพราะ นาน มากถ้าเครื่องไม่แรงก็ไม่ต้องสืบกางมุ้งนอนเลย หลังจากรอมานานก็ติดตั้ง Kernel โดยใช้คำสั่ง
#dpkg -i linux-image-2.6.25-l7filter_2.6.25-l7filter-10.00.Custom_i386.deb #dpkg -i linux-headers-2.6.25-l7filter_2.6.25-l7filter-10.00.Custom_i386.deb
รีสตาร์ทเครื่องซะ หลังจากเลือกเข้า Kernel ที่เราเพิ่งจะติดตั้งไปเราต้องเอา IPTables เก่าเน่าๆออกก่อนครับ
#apt-get --purge remove iptables
เอาของเน่าออกแล้วไปที่ /usr/src/iptables เพื่อที่จะติดตั้ง Patch ให้กับ Iptables ตัวใหม่ของเรา
#cd /usr/src/iptables #patch -p1 < ../netfilter-layer7-v2.20/iptables-1.4-for-kernel-2.6.20forward-layer7-2.20.patch #chmod +x extensions/.layer7-test
เรียบร้อยละ Compile ซะและติดตั้งไปเลยเพื่อไม่ให้เสียเวลากินเตี๋ยว
#make KERNEL_DIR=/usr/src/linux #make install KERNEL_DIR=/usr/src/linux #cd ../l7-protocols-2008-04-23 #make install
เสร็จแล้วถึงคราว ipp2p บ้าง
#cd ../ipp2p-0.8.2 #wget http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/net-firewall/ipp2p/files/ipp2p-0.8.2-kernel-2.6.22.patch #wget http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/net-firewall/ipp2p/files/ipp2p-0.8.2-iptables-1.4.0.patch #patch -p1 < ipp2p-0.8.2-kernel-2.6.22.patch #patch -p1 < ipp2p-0.8.2-iptables-1.4.0.patch #nano Makefile
เปลี่ยน
libipt_ipp2p.so: libipt_ipp2p.c ipt_ipp2p.h $(CC) $(CFLAGS) $(IPTABLES_OPTION) $(IPTABLES_INCLUDE) -fPIC -c libipt_ipp2p.c ตรงนี้ >>> ld -shared -o libipt_ipp2p.so libipt_ipp2p.o
เป็น
$(CC) -shared -o libipt_ipp2p.so libipt_ipp2p.o
#make
#cp libipt_ipp2p.so /usr/local/lib/iptables/
#cp ipt_ipp2p.ko /lib/modules/2.6.25-l7/kernel/net/netfilter/
#deepmod -a
เสร็จละ แต่เดี๋ยว ลองดูซิเสียเวลาเปล่าหรือไม่ที่ทำมอะ
#/sbin/iptables -m layer7 --help #/sbin/iptables -m ipp2p --help
จบครับขอให้เมามันกับการ Compile Kernel ใหม่ :-)