How to : ClarkConnect 4.3 + Kernel-2.6.25 + iptables-1.4.0 + L7-filter-2.21
เริ่มเลยแล้วกัน การทำ ClarkConnect 4.3 + Kernel-2.6.25 + iptables-1.4.0 + L7-filter-2.21
[root@linux ~]# apt-get install cc-devel
[root@linux ~]# cd /usr/src
[root@linux ~]# wget
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.tar.bz2[root@linux ~]# wget
ftp://ftp.netfilter.org/pub/iptables/iptables-1.4.0.tar.bz2[root@linux ~]# wget
http://jaist.dl.sourceforge.net/sourceforge/l7-filter/netfilter-layer7-v2.21.tar.gz[root@linux ~]# wget
http://nchc.dl.sourceforge.net/sourceforge/l7-filter/l7-protocols-2008-12-18.tar.gz[root@linux ~]# tar xvjf iptables-1.4.0.tar.bz2
[root@linux ~]# tar zxvf netfilter-layer7-v2.21.tar.gz
[root@linux ~]# tar zxvf l7-protocols-2008-12-18.tar.gz
[root@linux ~]# tar xvjf linux-2.6.25.tar.bz2
[root@linux ~]# cd /usr/src/linux-2.6.25
[root@linux ~]# patch -p1 < /usr/src/netfilter-layer7-v2.21/kernel-2.6.25-2.6.28-layer7-2.21.patch
[root@linux ~]# cd /usr/src/iptables-1.4.0
[root@linux ~]# patch -p1 < /usr/src/netfilter-layer7-v2.21/iptables-1.4-for-kernel-2.6.20forward-layer7-2.21.patch
[root@linux ~]# chmod +x extensions/.layer7-test
[root@linux ~]# cd /usr/src/linux-2.6.25
[root@linux ~]# cp /boot/config-2.6.18-93.cc4 ./.config
[root@linux ~]# make menuconfig
ลือกไปที่
Networking --->
Networking options --->
Network packet filtering framework (Netfilter) --->
Core Netfilter Configuration --->
"layer7" match support (NEW)
เห็นอันไหนน่าสนใจก็กดๆ ตามใจชอบได้ครับ แต่ดูที่เกียวๆ กับเรื่องที่เรามีใช้อยู่ด้วยนะครับพวก 64bit อะไรไม่ต้องไปยุ่ง
กด Esc สองครั้งติดกันจนถึงหน้าที่ ให้ save config ก็ Save แล้วออกมาสั่งต่อด้านล่างเลยครับ
[root@linux ~]# make all && make modules_install && make install
เขาว่าค่อนข้างนาน ส่วนเครื่องที่ผมใช้ทำนั้นมันนานมาก
[root@linux ~]# nano /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda3
# initrd /initrd-version.img
#boot=/dev/hda
default=1 <=== แก้เป็น 0 เพื่อให้ boot เป็น kernel 2.6.25 ของเรา
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Linux (2.6.25)
root (hd0,0)
kernel /vmlinuz-2.6.25 ro root=LABEL=/ video=vesafb vga=0x313
initrd /initrd-2.6.25.img
title Linux (2.6.18-93.cc4)
root (hd0,0)
kernel /vmlinuz-2.6.18-93.cc4 ro root=LABEL=/ video=vesafb vga=0x313
initrd /initrd-2.6.18-93.cc4.img
title Linux Safe Mode (2.6.18-93.cc4)
root (hd0,0)
kernel /vmlinuz-2.6.18-93.cc4 ro root=LABEL=/
initrd /initrd-2.6.18-93.cc4.img
[root@linux ~]# shutdown -r now
หลัง reboot ดูด้วยว่า ระบบเลือก kernel ที่เราใส่ไปใหม่เป็นตัวหลักหรือไม่ และดูว่ามี error message ตอน boot หรือเปล่า เท่าที่ทำอยู่ไม่เจออะไรแปลก มีแค่เจอ card VGA ทำให้เลือก mode การแสดงผลที่ละเอียดขึ้นได้ เดี๋ยวจะหาวิธีแก้ต่อไป(สักวัน)
restart เสร็จแล้วทดสอบโดยสั่ง
[root@linux ~]# uname -a
Linux xxxxxxxx 2.6.25 #2 SMP Mon Feb 2 18:28:20 ICT 2009 i686 athlon i386 GNU/Linux
ตัวเลขเปลี่ยนเป็น 2.6.25 ของเราแล้วเสร็จเรียบร้อย ในส่วนของ kernel
มาทำในส่วนของ iptables 1.4.0 ให้รู้จัก layer7 ต่อ
[root@linux ~]# cd /usr/src/iptables-1.4.0
[root@linux ~]# make KERNEL_DIR=/usr/src/linux-2.6.25
[root@linux ~]# make install
[root@linux ~]# cd /usr/local/sbin/
[root@linux ~]# cp ip* /sbin/
[root@linux ~]# iptables -V
iptables v1.4.0
[root@linux ~]# mv /usr/src/l7-protocols-2008-12-18 /etc/l7-protocols
ทดสอบคำสั่ง ว่าใช้งาน layer7 ได้ไหม
[root@linux ~]# iptables -m layer7 -help
เสร็จแล้วครับการทำ ClarkConnect 4.3 + Kernel-2.6.25 + iptables-1.4.0 + L7-filter-2.21
ข้ามๆตกๆ หล่นๆ อ่านจากต้นฉบับนะครับ วิธีทำในส่วนของ iptables อ้างอิงจากของ debian ต้องประยุกใช้กับ CC นิดนึง
สรุปหลักๆของการทำ ClarkConnect 4.3 + Kernel-2.6.25 + iptables-1.4.0 + L7-filter-2.21
1. ทำ kernel ให้รู้จัก layer7 ก่อน จริงๆ จะหาทาง patch เข้ากับ kernel เดิมของ CC 4.3 เองเลยก็น่าจะได้นะครับ ท่านใดว่างๆ ลอง
apt-get install kernel-sourcecode#2.6.18-93.cc4
apt-get install kernel-devel#2.6.18-93.cc4
เอา src เดิมมาเล่นดูครับ
2. ทำ iptables ให้รู้จัก layer7 ด้วย
Credit ให้คุณ Ton-Or ครับ
http://linux.blog.in.th/node/53