- kernel includes the essential bits and distros are wrappers that add non-essential modules
# kernel config params
- `sysctl` handles settings for kernel modules
- allows you to view and change kernel parameters
- `sudo systctl -a` shows all kernel modules and values ![[images/Pasted image 20250804202502.png]]
- when you make changes with `sysctl` it saves changes in `/proc` fs in real time
- `sysctl net.ipv4.ip_forward=1` updates `/proc/sys/net/ipv4/ip_forward` in real time
- could also `echo 1` into the noted proc file
- above changes don't persist unless placed in `/etc/sysctl.conf`
- `/etc/sysctl.conf` has a line re: ipv4 packet forwarding that can be uncommented to enable the above changes with persistence
- `sysctl -p` to reload sysctl.conf file instead of rebooting
# kernel tools for adding/removing kernel modules
- system automatically loads modules upon boot
- modules typically stored in `/lib/modules`
- modules have a `.ko` extension
- `lsmod` shows all active modules in running kernel ![[images/Pasted image 20250801194749.png]]
- similar info can be found in `/proc/modules` ![[images/Pasted image 20250801195034.png]]
- `sudo modinfo module_name` to show more detailed info ![[images/Pasted image 20250801194905.png]]
- `find /usr/lib | grep module_name` to find path to kernel module
- `rmmod` removes kernel modules from running kernel
- `rmmod module_name`
- `insmod` inserts kernel modules
- `insmod /path-to/module_name`
- `dmseg` to shows removal/insertion of modules
- `modprobe` inserts modules AND installs related dependencies
- `modprobe module_name`
- use `modprobe` over `insmod`
- `modinfo module_name` shows info for a kernel module