- Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system.
- A module can be configured as built-in or loadable.
- To create a kernel moduld, you can read The Linux Kernel Module Programming Guide
- A module can be configured as built-in or loadable.
- For example,
- One type of module is the device driver, which allows the kernel to access hardware connected to the system.
- Without modules, we would have to build monolithic kernels and add new functionality directly into the kernel image.
- Besides having larger kernels, this has the disadvantage of requiring us to rebuild and reboot the kernel every time we want new functionality.
Example:
:~$ lsmod | grep conn
nf_conntrack_ipv4 16384 1
nf_defrag_ipv4 16384 1 nf_conntrack_ipv4
nf_conntrack 106496 3 nf_nat,nf_nat_ipv4,nf_conntrack_ipv4
:~$ lsmod | grep iptab
iptable_nat 16384 1
nf_nat_ipv4 16384 1 iptable_nat
iptable_filter 16384 0
ip_tables 28672 2 iptable_filter,iptable_nat
x_tables 36864 4 ip_tables,xt_tcpudp,iptable_filter,xt_REDIRECT
nf_conntrack_ipv4 16384 1
nf_defrag_ipv4 16384 1 nf_conntrack_ipv4
nf_conntrack 106496 3 nf_nat,nf_nat_ipv4,nf_conntrack_ipv4
:~$ lsmod | grep iptab
iptable_nat 16384 1
nf_nat_ipv4 16384 1 iptable_nat
iptable_filter 16384 0
ip_tables 28672 2 iptable_filter,iptable_nat
x_tables 36864 4 ip_tables,xt_tcpudp,iptable_filter,xt_REDIRECT
~$ lsmod | grep nat
nf_nat_redirect 16384 1 xt_REDIRECT
iptable_nat 16384 1
nf_nat_ipv4 16384 1 iptable_nat
nf_nat 24576 2 nf_nat_redirect,nf_nat_ipv4
nf_conntrack 106496 3 nf_nat,nf_nat_ipv4,nf_conntrack_ipv4
ip_tables 28672 2 iptable_filter,iptable_nat
nf_nat_redirect 16384 1 xt_REDIRECT
iptable_nat 16384 1
nf_nat_ipv4 16384 1 iptable_nat
nf_nat 24576 2 nf_nat_redirect,nf_nat_ipv4
nf_conntrack 106496 3 nf_nat,nf_nat_ipv4,nf_conntrack_ipv4
ip_tables 28672 2 iptable_filter,iptable_nat
machine:~$ modinfo nf_conntrack
filename: /lib/modules/3.19.0-25-generic/kernel/net/netfilter/nf_conntrack.ko
license: GPL
srcversion: 87BEFE2F26ECB852F6EF9EC
depends:
intree: Y
vermagic: 3.19.0-25-generic SMP mod_unload modversions
signer: Magrathea: Glacier signing key
sig_key: 6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo: sha512
parm: tstamp:Enable connection tracking flow timestamping. (bool)
parm: acct:Enable connection tracking flow accounting. (bool)
parm: nf_conntrack_helper:Enable automatic conntrack helper assignment (default 1) (bool)
parm: expect_hashsize:uint
filename: /lib/modules/3.19.0-25-generic/kernel/net/netfilter/nf_conntrack.ko
license: GPL
srcversion: 87BEFE2F26ECB852F6EF9EC
depends:
intree: Y
vermagic: 3.19.0-25-generic SMP mod_unload modversions
signer: Magrathea: Glacier signing key
sig_key: 6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo: sha512
parm: tstamp:Enable connection tracking flow timestamping. (bool)
parm: acct:Enable connection tracking flow accounting. (bool)
parm: nf_conntrack_helper:Enable automatic conntrack helper assignment (default 1) (bool)
parm: expect_hashsize:uint
:~$ modinfo ip_tables
filename: /lib/modules/3.19.0-25-generic/kernel/net/ipv4/netfilter/ip_tables.ko
description: IPv4 packet filter
author: Netfilter Core Team <coreteam@netfilter.org>
license: GPL
srcversion: 44A16130862F8CA2ECA59D9
depends: x_tables
intree: Y
vermagic: 3.19.0-25-generic SMP mod_unload modversions
signer: Magrathea: Glacier signing key
sig_key: 6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo: sha512
machine:~$ modinfo nf_nat
filename: /lib/modules/3.19.0-25-generic/kernel/net/netfilter/nf_nat.ko
license: GPL
srcversion: A7C7F33E2B7EFD16A2534DF
depends: nf_conntrack
intree: Y
vermagic: 3.19.0-25-generic SMP mod_unload modversions
signer: Magrathea: Glacier signing key
sig_key: 6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo: sha512
filename: /lib/modules/3.19.0-25-generic/kernel/net/netfilter/nf_nat.ko
license: GPL
srcversion: A7C7F33E2B7EFD16A2534DF
depends: nf_conntrack
intree: Y
vermagic: 3.19.0-25-generic SMP mod_unload modversions
signer: Magrathea: Glacier signing key
sig_key: 6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo: sha512
No comments:
Post a Comment