How To Cut Existing Network Connection In Linux? – POFTUT

How To Cut Existing Network Connection In Linux?


Today’s applications create a lot of network connection to the different servers. This connection may legit or unwanted connection. If you are looking for a tool that will end the network connection between two host cutter is one of the best solutions. Keep in mind that we assume the Linux box sits between hosts or one host in one side.

Install Tcpkill

We will use tcpkill for cutting network connections. Tcpkill tool is provided by dsniff package

Ubuntu, Debian, Mint, and Kali

We will install the following command in order to install dsniff in deb based distributions.

$ sudo apt-get install dsniff -y
Ubuntu, Debian, Mint, and Kali
Ubuntu, Debian, Mint, and Kali

CentOS, Fedora, Red Hat

We can install dsniff for rpm-based distributions like below.

$ sudo yum install dsniff -y

List Network Connections

We will first list all connection with netstat command. We want TCP connections and numbered IP addresses.

$ netstat -tn
List Network Connections
List Network Connections

List Network Interface

tcpkill is also required the network interface name in order to kill a network connection. We can list network interfaces in different ways but the most easy and fast way is using ip link command like below.

$ ip link
List Network Interface
List Network Interface

Kill Connection

We will kill connection by providing a target connection tcpdump style filter. Tcpdump style filter is the syntax used in tcpdump to filter network traffic. In our situation is very easy. We just provide the IP address and host keyword.

$ sudo tcpkill -i ens3 port 22
Kill Connection
Kill Connection
  • `-i ens3specifies that we want to use ens3 interfaces for kill operation
  • port 22is our target port where connections will be killed. We kill ssh server so we will disconnect
LEARN MORE  What Is Windows Sysinternal?

Leave a Comment