I’m using Raspbian Stretch Lite (September 2017 version) and for some reason, wanted to disable IPv6 kernel module, which is loaded by default. Basically, it can be done by blacklisting the kernel module. [1]
Here is steps I took.
1. Check already loaded modules (Optional)
You can check already loaded modules by ‘lsmod’ command. IPv6 appears at the last line of the example below.
pi@raspberrypi:~ $ lsmod Module Size Used by cmac 3239 1 bnep 12051 2 hci_uart 20020 1 btbcm 7916 1 hci_uart bluetooth 365511 24 hci_uart,bnep,btbcm brcmfmac 223048 0 brcmutil 9092 1 brcmfmac cfg80211 543091 1 brcmfmac rfkill 20851 6 bluetooth,cfg80211 bcm2835_gpiomem 3940 0 evdev 12423 0 joydev 9988 0 fixed 3285 0 uio_pdrv_genirq 3923 0 uio 10204 1 uio_pdrv_genirq hid_multitouch 11312 0 ip_tables 13161 0 x_tables 20578 1 ip_tables ipv6 409035 22
2. Blacklist IPv6 kernel module
Open the configuration file,
sudo nano /etc/modprobe.d/ipv6.conf
and add the line below.
blacklist ipv6
Save, and close.
3. Reboot
Restart the system to unload the kernel module.
sudo reboot
4. Verify
Check the loaded modules again. ‘ipv6’ should be gone if everything is done properly.
pi@raspberrypi:~ $ lsmod Module Size Used by cmac 3239 1 bnep 12051 2 hci_uart 20020 1 btbcm 7916 1 hci_uart bluetooth 365511 24 hci_uart,bnep,btbcm brcmfmac 223048 0 brcmutil 9092 1 brcmfmac cfg80211 543091 1 brcmfmac rfkill 20851 6 bluetooth,cfg80211 bcm2835_gpiomem 3940 0 evdev 12423 0 fixed 3285 0 uio_pdrv_genirq 3923 0 joydev 9988 0 uio 10204 1 uio_pdrv_genirq hid_multitouch 11312 0 ip_tables 13161 0 x_tables 20578 1 ip_tables
References
1. How to disable loading of unnecessary kernel modules