KERNEL COMPILE 하기
1.kernel source구하기
ftp://ftp.kernel.org 또는 http://ftp.kernel.org 에서 kernel source를 구한다.
2.kernel source 설치
download 한 kernel source를 아래와 같은 방법으로 압축을 푼다.
# cd /usr/src
# rm -f linux
# mkdir linux-2.4.19
# tar xvzf linux-2.4.19.tar.gz linux-2.4.19
# ln -s linux-2.4.19 linux
3.kernel patch하기
http://www.linuxvirtualserver.org/software/index.html에서 kernel version에 맞는 patch를 구한다.
ex)linux-<커널버전>-ipvs-<patch 버전>.patch.gz
# gzip -cd <커널patch file> | patch -p0
또는
# cd /usr/src/linux
# cat ../ <커널 patch file> | patch -p1
4.make mrproper
이전에 설정한 정보를 지우거나 새로운 커널 소스를 가져다 컴파일 할 때에는 이 명령을 먼저 사용해야 합니다. make mrproper 명령은 이전 커널을 컴파일할 때 만들어진 오브젝트 파일(*.o)과 의존성 설정, 컴파일 환경 설정값, 버전 정보 등 새로 시작하는 컴파일에 영향을 주는 이전 정보들을 삭제합니다.
이전에 설정된 컴파일환경을 재사용한다면 이 과정을 건너뜁니다.
# cd /usr/src/linux
# make mrproper
5.kernel option 추가(환경설정)
--xwindow 환경시...
# cd /usr/src/linux
# make xconfig
--text mode 환경시...# make menuconfig
커널 컴파일 옵션 셋팅
----------------------
Code maturity LeveL optionS -->
----------------------
<Y> Prompt for deveLopment and/or incomplete code/drivers
----------------------
LoadabLe module SupporT -->
----------------------
<Y> EnaLbLe LoadabLe module Support
<Y> Set version information on aLL SymboLs for moduLes
<Y> KerneL module Loader
----------------------
Networking Options -->
----------------------
<Y> Packet socket
<Y> Packet socket:mmapped IO
<Y> Netlink device dmulation
<Y> Network packet filtering (replaces ipchains)
<N> Network packet filtering debugging
<Y> Socket Filtering
<Y> Unix domain sockets
<Y> TCP/IP networking
<Y> IP:multicastring
<Y> IP:advanced router
<Y> IP:policy routing
<Y> IP:use netfilter MARK value as routing key
<Y> IP:fast network address translation
<Y> IP:equal cost multipath
<Y> IP:use TOS value as routing key
<Y> IP:verbose route monitoring
<Y> IP:large routing tables
<Y> IP:kernel level autoconfiguration
<N> IP:DHCP support
<N> IP:BOOTP support
<N> IP:RARP support
<M> IP:tunneling
<N> IP:GRE tunnels over IP
<N> IP:multicast routing
<N> IP:ARP daemon support
<N> IP:TCP Explicit Congestion Notification support
<Y> IP:TCP syncookie support
------------------------------
IP:Netfilter Configuration -->
------------------------------
<M> Connection tracking
<M> FTP protocol support
<M> IRC protocol support
<M> Userspace queueing via NETLINK
<M> IP tables support
<M> limit match support
<M> MAC address match support
<M> netfilter MARK match support
<M> Multiple port match support
<M> TOS match support
<M> AH/ESp match support
<M> LENGTH match support
<M> TTL match support
<M> tcpmss match support
<M> Connection state match support
<M> Unclean match support
<M> Owner match support
<M> Packet filtering
<M> REJECT target support
<M> MIRROR target support
<M> Full NAT
<M> MASQUERADE target support
<M> REDIRECT target support
<N> NAT of local connections
<N> Basic SNMP-ALG support
<M> Packet mangling
<M> TOS target support
<M> MARK target support
<M> LOG target support
<M> ULOG target support
<M> TCPMSS target support
<M> ARP tables support
<M> ARP packet filtering
<N> ipchains support
<N> ipfwadm support
----------------------------------
IP:Virtual Server Configuration-->
----------------------------------
<M> virtual server support
<Y> IP virtual server debugging
[12] IPVS connection hash table size (the Nth power of 2)
------- IPVS scheduler
<M> round-robin schduling
<M> weighted round-robin scheduling
<M> least-connection scheduling scheduling
<M> weighted least-connection scheduling
<M> locality-based least-connection scheduling
<M> locality-based least-connection with replication scheduling
<M> destination hashing scheduling
<M> source hashing scheduling
------- IPVS application helper
<M> FTP protocol helper
<N> The IPv6 protocoL (EXPERIMENTAL)
IPv6: Netfilter Configuration-->
<N> Kernel httpd acceleration (EXPERIMENTAL)
[N] Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)
<M> 802.1Q VLAN Support (EXPERIMENTAL)
---
<N> The IPX protocol
<N> Appletalk protocol support
Appletalk devices-->
<N> DECnet Support
<N> 802.1d Ethernet Bridging
<N> CCITT X.25 Packer Layer (EXPERIMENTAL)
<N> LAPB Data Link Driver (EXPERIMENTAL)
[Y] 802.2 LLC (EXPERIMENTAL)
----------------------
Network device SupporT -->
----------------------
<Y> Network device support
ARCnet devices --->
<M> Dummy net driver support
<N> Bonding driver support
<N> ELQ (serial line load balancing) support
<N> Universal TUN/TAP device driver support
<N> Ethertap network tap (OBSOLETE)
<N> General Instruments Surfboard 1000
------------------------------
Ethernet (10 or 100Mbit) -->
------------------------------
[Y] Ethernet (10 or 100Mbit)
<N> Sun Happy Meal 10/100baseT support
<N> Sun GEM support
[M] 3COM cards
<N> 3c501 "EtherLink" support
<N> 3c503 "EtherLink II" support
<N> 3c505 "EtherLink Plus" support
<N> 3c507 "EtherLink 16" support (EXPERIMENTAL)
<N> 3c509/3c529 (MCA)/3c579 "EtherLink III" support
<N> 3c515 ISA "Fast EtherLink"
<M> 3c590/3c900 series (592/595/597) "Vortex/Boomerang" support
<N> AMD LANCE and PCnet (AT1500 and NE2100) support
[N] Western Digital/SMC cards
[N] Racal-Interlan (Micom) NI cards
<N> AT1700/1720 support (EXPERIMENTAL)
<N> DEPCA, DE10x, DE200, DE201, DE202, DE422 support
<N> HP 10/100VG PCLAN (ISA, EISA, PCI) support
[N] Other ISA cards
[Y] EISA, VLB, PCI and on board controllers
.
.
.
<Y> EtherExpressPro/100 support
.
.
.
<M> RealTek RTL-8139 PCI Fast Ethernet Adapter support
----------------------
FiLe SyStemS -->
----------------------
[N] Quota Support
<N> Kernel automounter support
<Y> Kernel automounter version 4 support (also supports v3)
[Y] Reiser fs support
[Y] Have reiserfs do extra internal checking
[Y] Stats in /proc/fs/reiserfs
.
.
.
<Y> Ext3 journalling file system support
[Y] JBD (ext3) debbuging support
.
.
.
[Y] Virtual memory file system support (former shm fs)
<Y> ISO 9660 CDROM file system support
[Y] Microsoft joliet CDROM extensions
.
.
.
[Y] /proc file system support
[N] /dev file system support (EXPERIMENTAL)
[Y] /dev/pts file system for Unix98 PTYs
.
.
.
<Y> Second extended fs support
.
.
.
<N> UFS file system support (read only)
------------------------------
Network File Systems -->
------------------------------
<Y> Coda file system support (advanced network fs)
<N> InterMezzo file system support (experimental, replicating fs)
<Y> NFS file system support
.
.
.
<Y> NFS server support
(나머지 System Dependent한 사항은 http://kldp.org의 커널 컴파일
Howto를 참고하여 옵션을 셋팅할 것.)
6.청소 와 Compile
# cd /usr/src/linux
# make dep && make clean
&& 는 앞선 명령이 성공했을 때에만 뒤이은 명령을 실행하라는 뜻입니다
make dep : 새 커널 만들기를 시작하는 명령입니다. 컴파일을 위한 의존성 관계를 설정합니다.
make clean : 이전에 수행했던 컴파일과정에서 생성된 오브젝트 파일(*.[oas]), 커널, 임시파일(.tmp*), 설정값(configure) 등을 삭제합니다.
--Kernel compile
# cd /usr/src/linux
# make bzImage
--모듈 컴파일
모듈 컴파일을 시작하기 전에 이전 버전에서 설치한 모듈을 (커널 버전이 달라지지 않았다면) 이름을 바꾸어 두는 것이 좋습니다. 커널 버전이 다르다면 잠시 그냥 두었다가, 새 커널과 모듈이 제대로 동작하는 것을 확인하고 지웁니다.
# cd /usr/src/linux
# make modules && make modules_install && make install7.Boot Loader Setting(Grub.config)
정상적으로 compile과 option setting끝이 나면 boot loader를 수정한다.
#vi /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/hda1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title Red Hat Linux (2.4.19)
root (hd0,0)
kernel /boot/vmlinuz-2.4.19 ro root=/dev/hda1 /*이 부분을 부팅지정해준다*/
initrd /boot/initrd-2.4.19.img
title Red Hat Linux (2.4.18-14)
root (hd0,0)
kernel /boot/vmlinuz-2.4.18-14 ro root=/dev/hda1
initrd /boot/initrd-2.4.18-14.img
title Windows2000
rootnoverify (hd0,1)
chainloader +1
8. NAT방식의 클러스터링 로드 벨런서 시스템 구성
INTERNET
│
┌─┴─┐ eth0 192.168.3.108
│ │ GW/NETMASK/SUBNET는 회선
│ LB │ 공급자에게서 정보를 받아 세팅한다.
│ │
└─┬─┘eth1 10.0.0.1
│ GW 192.168.0.108
│
┌─────── HUB ────────┐
│ │
┌─┴─┐ eth0 10.0.0.2 ┌─┴─┐ eth0 10.0.0.3
│ │ GW 10.0.0.1 │ │ GW 10.0.0.1
│ RS1 │ │ RS2 │
│ │ │ │
└───┘ └───┘
-NAT방식의 클러스터링 구성을 위해서는 LB에 두개의 이더넷 카드를 사용해야하면 구성은 위의 그림과 같다.
-네트웍 환경이 구성되면 각각 핑테스트를 해본다.(테스트중 LB와 HUB 라인의 이상으로 상당 시간을 소비했다.)
NIC 관련 세팅 파일
/etc/sysconf/network-scripts/ifcfg-eth0
/etc/sysconf/network-scripts/ifcfg-eth1(LB경우만)
# vi ifcfg-eth0 (for RS1)
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.0.0.2
NETMASK=255.0.0.0
GATEWAY=10.0.0.1
9 LVS 관리툴 ipvsadm
ipvsadm 설치
#rpm -ivh ipvsadm-1.21-3.src.rpm
#cd /usr/src/redhat/SOURCES
#tar xvzf ipvsadm-1.21.tar.gz
#cd ipvsadm-1.21
#vi Makefile
(INCLUDE 항목에서 include 경로를 수정)
INCLUDE = -l/usr/src/linux-2.4/include -l.. -l.
#cd /usr/src/redhat/SOURCES
#rm ipvsadm-1.21.tar.gz -f
#tar cvzf ipvsadm-1.21.tar.gz ipvsadm-1.21/
#rm -rf ipvsadm-1.21/
#cd /usr/src/redhat/SPECS
#rpmbuild -ba ipvsadm.spec
#cd /usr/src/redhat/RPMS/i386/
#rpm -ivh ipvsadm-1.21-3.i386.rpm
ipvsadm이 잘 설치되었는지 확인하기 위해
# ipvsadm
IP Virtual Server version 1.0.7(size=4096)
Prot Address:Port Scheduler Flags
->RemoteAddress:Port Forward Weight ActiveConn InActConn
LB에서..아래와 같이 실행시킨다.
#ipvsadm -A -t 192.168.3.108:80 -s wrr
#ipvsadm -a -t 192.168.3.108:80 -r 10.0.0.2:80 -m
#ipvsadm -a -t 192.168.3.108:80 -r 10.0.0.3:80 -m
-A : add service
-t : tcp_service_address
-s : scheduling을 사용하겠음
{
wrr : weight round robbing
wlc : weight least connection sc.
rr : round robbing
lc : least connection sc.
}
-a : add server
-r : real service
{
-m: NAT
-g : direct routing
-I : tunneling
}



