Manage kernel modules and their parameters

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

01:00:00

Difficulty

Advanced

In this exercise, you need to modify a kernel module to provide more information.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Manage kernel modules and their parameters

Introduction

In this exercise, you need to modify a kernel module to provide more information.

You have been asked to enable connection tracking timeflow stamping in the Linux kernel of a particular host. This change should take effect immediately, as well as persist upon reboot.

The kernel module to change is nf_conntrack, you need to modify the parameter that enables time stamping.

Solution

Start by logging in to the lab servers using the credentials provided on the hands-on lab page:

ssh cloud_user@PUBLIC_IP_ADDRESS

Become the root user:

sudo su -

Enable nf_conntrack time stamping in the running kernel

  1. Check to see if the module is loaded:

    lsmod | grep nf_conntrack
  2. View the parameters available for the nf_conntrack module:

    modinfo nf_conntrack
  3. Verify the current setting of the timestamp parameter:

    cat /sys/module/nf_conntrack/parameters/tstamp
  4. Stop the firewall and unload the module:

    systemctl stop firewalld
    modprobe -r nf_conntrack
  5. Load the module with timestamping enabled:

    modprobe nf_conntrack tstamp=1
  6. Verify the current setting of the timestamp parameter:

    cat /sys/module/nf_conntrack/parameters/tstamp

Make the change persist through a restart

  1. Make the change persist through a reboot:

    echo "options nf_conntrack tstamp=1" > /etc/modprobe.d/nf_conntrack.conf

Conclusion

Congratulations, you've completed this hands-on lab!