IPマスカレードの為のカーネル&モジュール再構築

ここは、カーネル& PCMCIAモジュールを一気に再構築してしまいます。

■ カーネルパッケージ作成

必要と思われるパッケージをインストールしておく

# apt-get install kernel-package
# apt-get install bzip2
# apt-get install bin86
# apt-get install gcc
# apt-get install libncurses5-dev

# apt-get install kernel-source-2.2.19
# apt-get install pcmcia-source 3.1.22-0.2potato
ソースツリーの展開

# cd /usr/src

/usr/src# tar -xvf kernel-source-2.2.19.tar

最近はbzip2形式らしいです。その場合は

# tar -Ixvf kernel-source-2.2.19.tar.bz2

シンボリックリンクの張り直し

/usr/src# ln -s kernel-source-2.2.19 linux
/usr/src# ln -s kernel-source-2.2.19 linux-2.2.19
カーネル構成を設定する

/usr/src# cd /usr/src/linux
/usr/src/linux# make menuconfig
Networking optionsを選択し設定する。

<M> Packet socket
[*] Kernel/User netlink socket
[*] Routing messages
<*> Netlink device emulation
[*] Network firewalls
[*] Socket Filtering
<M> Unix domain sockets
[*] TCP/IP networking
[*] IP: multicasting
[*] IP: advanced router
[ ] IP: policy routing
[ ] IP: equal cost multipath
[ ] IP: use TOS value as routing key
[ ] IP: verbose route monitoring
[ ] IP: large routing tables
[ ] IP: kernel-level configuration support
[*] IP: firewalling
[*] IP: firewall packet netlink device
[ ] IP: transparent proxy support
[*] IP: masquerading
--- Protocol-specific masquerading support will be built as modules.
[*] IP: ICMP masquerading
--- Protocol-specific masquerading support will be built as modules.
[*] IP: masquerading special modules support
<M> IP: ipautofw masq support (EXPERIMENTAL)
<M> IP: ipportfw masq support (EXPERIMENTAL)
<M> IP: ip fwmark masq-forwarding support (EXPERIMENTAL)
[*] IP: optimize as router not host
<M> IP: tunneling
<M> IP: GRE tunnels over IP
[ ] IP: broadcast GRE over IP
[ ] IP: multicast routing
[*] IP: aliasing support
[ ] IP: ARP daemon support (EXPERIMENTAL)
[*] IP: TCP syncookie support (not enabled per default)
カーネル構成を保存して終了する。

ディレクトリ内の余分なファイルを削除する。

# make-kpkg clean

パッケージ作成

# make-kpkg --revision 02010401 kernel_image

/usr/srcに kernel-image-2.2.19_02010401_i386.debというパッケージファイルができる。

■ PCMCIAモジュール関係パッケージ作成

ソースツリーの展開

# cd /usr/src
/usr/src# tar -zxvf pcmcia-cs.tar.gz
モジュール関連のコンパイル

# cd /usr/src/linux
# make-kpkg --revision 02010401 modules-image
パッケージ作成

# cd /usr/src/modules/pcmcia-cs
# debian/rules binary-modules
# debian/rules binary-cs
/usr/src/modulesに以下のパッケージが作成される。

pcmcia-cs_3.1.22-0.2potato_i386.deb
pcmcia-modules-2.2.19_3.1.22-0.2potato+02010401_i386.deb
作成したパッケージをインストールします。

# dpkg -i /usr/src/kernel-image-2.2.19_02010401_i386.deb

# dpkg -i /usr/src/modules/pcmcia-cs_3.1.22-0.2potato_i386.deb

# dpkg -i /usr/src/modules/pcmcia-modules-2.2.19_3.1.22-0.2potato+02010401_i386.deb

# reboot