內核編譯
關於內核操作
進入內核:
[root@server1 ~]# cd /lib/modules/`uname-r`
進入內核目錄:
[root@server1 2.6.18-164.el5]# cd kernel/
查詢內核此時版本號:
[root@server1 kernel]# uname –r
查看內核目錄:
[root@server1 kernel]# ls
arch crypto drivers fs lib net sound
查詢安裝包信息:
進入關於網卡的目錄net
[root@server1 kernel]# cd net
進入無線網絡模塊:
[root@server1 net]# cd wireless/
目標功能:編譯內核
1、合併kernel+layer7補丁,分別上傳linux-2.6.25.19.tar.gz2和
netfilter-layer7-v2.20.tar.gz(請點擊下載http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.19.tar.bz2 以及下載附件)
解壓縮:
[root@server1~]#tar jxvf linux-2.6.25.19.tar.gz2-C /usr/src/
[root@server1 ~]#tar zxvf netfilter-layer7-v2.20.tar.gz -C /usr/src/
補丁:
[root@server1~]# cd /usr/src/linux-2.6.25.19/
[root@server1 ~]#patch -p1 </usr/src/netfilter-layer7-v2.20/kernel-2.6.25-layer7-2.20.patch
配置新內核:
[root@server1 linux-2.6.25.19]# cp/boot/config-2.6.18-164.el5 .config
[root@server1 linux-2.6.25.19]# mkae menuconfig
//配置內核時,在“Networking ---> Networking Options --->Network Packet filtering framework (Netfilter) ”處主要注意兩個地方:
1) ---> Core Netfilter Configuration
//將“Netfilterconnection tracking suport (NEW)”選擇編譯爲模塊(M),需選取此項才能看到layer7支持的配置。
//將layer7、string、state、time、IPsec、iprange、connlimit……等編譯成模塊,根據需要看着辦。
2) ---> IP: Netfilter Configuration
//將“IPv4 connection tracking support (require for NAT)”編譯成模塊。
//將“FullNAT”下的“MASQUERADE target support”和“REDIRECT target support”編譯成模塊。
3、編譯及安裝模塊、新內核
[[email protected]] make &&make modules_install && make install
//編譯安裝成後後,重啓選擇使用新的內核(2.6.25.19)引導系統
完成!