Operating System - Linux
1828355 Members
3272 Online
109976 Solutions
New Discussion

Re: recompiling Kernel in RedHat

 
Cristian M.
Occasional Advisor

recompiling Kernel in RedHat

I'm using ipchains in RedHat 7.3 for firewall and masquarading and I want to configure some port forwarding. For that I need ipmasqadm to work.
Man page for ipmasqadm shows that:
"Kernel must have been compiled with
CONFIG_EXPERIMENTAL=y
CONFIG_IP_MASQUERADE=y
CONFIG_IP_MASQUERADE_MOD=y
..."

How can I verify if my Kernel were compiled with those parameters and if it wasn't how can I recompile it?
Thanx
time solve it all
6 REPLIES 6
Jarle Bjorgeengen
Trusted Contributor

Re: recompiling Kernel in RedHat

If you run a standard stock RedHat kernel you almost certainly have these in place.

The configs used for the sock kernels ar kept in /usr/src/linux-2-4/Configs.

Find the config file name that matches your running kernel , and grep for the parameters you mention in it.

For kernel compile,
install the kernel dev tools, the kernel-source, and kernel headers, and follow the description of the customisation guide on the redhat site, for the distro you have.

Rgds Jarle
Cristian M.
Occasional Advisor

Re: recompiling Kernel in RedHat

In RedHat 7.3 it seems that /usr/src contains only redhat directory with some other empty directories.
you have your points, anyway...
time solve it all
Jarle Bjorgeengen
Trusted Contributor

Re: recompiling Kernel in RedHat

Hi again,

actually you have to install the kernel-source-ver.arch.rpm to get the directories I was talking about... Sorry about that.

Rgds Jarle
Jarle Bjorgeengen
Trusted Contributor

Re: recompiling Kernel in RedHat

BTW,

I also would very much like to know if there is a way to extract the config a binary kernel was compiled with.

I've tried search for it, but found nothing yet.

Rgds Jarle
Jarle Bjorgeengen
Trusted Contributor

Re: recompiling Kernel in RedHat

Another BTW,

you know of course that you need to turn on ip-forwarding in order to do NAT/MASQUERADE ?

sysctl -a|grep net.ipv4.ip_forward > should be 1.

If not, sysctl -w net.ipv4.ip_forward=1 ,and put net.ipv4.ip_forward=1 in /etc/sysctl.conf to make it permanent through reboots.

Rgds Jarle
benoit Bruckert
Honored Contributor

Re: recompiling Kernel in RedHat

HI,
I would recommend the kernel how-to to know how to compile and install a new kernel.
http://www.tldp.org/HOWTO/Kernel-HOWTO/

To be short, kernel compilation could be resume by :
1- install kernel sources (from kernel.org), in /usr/src,
2- cd /usr/src/kernel2.4.xx,
3- make menuconfig, (save your changes by leaving),
4 - make dep,
5 - make clean,
6 - make bzImage,
7 - make modules,
8 - make modules_install
9 - Install your new kernel in your boot directory, install also System.map.
10 - Update you boot loader
11 - reboot. it should be ok !! (If you didn't forget to include all the drivers of your conf).

Nota I would recommend also iptables tools to replace ipchains (these are the new tools from netfilter). But there is also an masquerading how to which can help you in all the steps (kernel config also)

hth
Benoit
_________
"Faites-vous des amis prompts a vous censurer." -- Nicolas Boileau, Satires
Une application mal pansée aboutit à une usine à gaze (GHG)