jiaoyk / linux_tcp_time_wait_patch

A Linux Kernel patch that changes the default TIME-WAIT duration.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TCP TIME-WAIT Patch

This Linux Kernel patch changes the default TIME-WAIT duration (60 seconds for Linux 5.4).

Applying the Patch

  1. Download the Linux source tree linux-X.Y[.Z] in this directory:
$ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-X.Y[.Z].tar.xz
$ tar -xvf linux-X.Y[.Z].tar.xz
  1. Apply the patch:
$ cd linux-X.Y[.Z]
$ patch -p1 < ../patchfile_linux-X.Y[.Z]

Creating a New Patch

  1. Download the Linux source tree linux-X.Y[.Z] in this directory:
$ wget https://cdn.kernel.org/pub/linux/kernel/vX.x/linux-X.Y[.Z].tar.xz
$ tar -xvf linux-X.Y[.Z].tar.xz
  1. Copy it to linux-X.Y[.Z].original:
$ cp -R linux-X.Y[.Z] linux-X.Y[.Z].original
  1. Modify the source code in linux-X.Y[.Z].
  2. Create the new patch file:
$ diff -uNr linux-X.Y[.Z].original linux-X.Y[.Z] > patchfile_linux-X.Y[.Z]

Compiling the Kernel (on a Debian-based Distribution)

  1. Download the Linux source tree linux-X.Y[.Z] and apply a patch.
  2. Install the compilers and tools needed to build the Kernel:
$ sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev
  1. Copy and edit the existing Linux configuration (or use make menuconfig):
$ cp -v /boot/config-$(uname -r) linux-X.Y[.Z]/.config

If copying from Ubuntu, read this.

  1. Build the Kernel:
$ cd linux-X.Y[.Z]
$ make oldconfig
$ make -j $(nproc)
  1. Install the Kernel modules:
$ sudo make modules_install
  1. Install the Kernel:
$ sudo make install
  1. Clean build object files:
$ make clean
  1. Edit and update the Grub configuration:
$ sudo vi /etc/default/grub
$ sudo update-grub
  1. Reboot the system:
$ sudo reboot
  1. Check the new Kernel version:
$ uname -mrs

Developer

License

Copyright (C) 2022 Rodrigo Alves Lima.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

About

A Linux Kernel patch that changes the default TIME-WAIT duration.

License:GNU General Public License v3.0