LinuxCommandLibrary

knock

client component of port knocking

TLDR

Knock on ports with specified protocol

$ knock [hostname] [port]:tcp
copy
Knock using UDP
$ knock -u [hostname] [port]
copy
Force IPv4 or IPv6
$ knock -4 [hostname] [port]
copy
Display verbose output
$ knock -v [hostname] [port]
copy

SYNOPSIS

knock [options] hostname port[:protocol]...

DESCRIPTION

knock is the client component of port knocking. Port knocking is a security technique where a firewall opens specific ports only after receiving a predefined sequence of connection attempts ("knocks") on closed ports.
The client sends packets to the specified ports in sequence. When the server (knockd) detects the correct sequence, it executes configured commands, typically to open a firewall port for the client's IP address.

PARAMETERS

-u, --udp

Use UDP instead of TCP
-4
Force IPv4
-6
Force IPv6
-v, --verbose
Display verbose information
-d, --delay MS
Delay between knocks in milliseconds

CAVEATS

Port sequence must be kept secret. Network issues can cause knock sequences to fail. Not a replacement for proper authentication but an additional security layer.

HISTORY

Port knocking emerged as a security technique in the early 2000s to hide services from port scanners. The knock/knockd implementation is one of the most widely used port knocking solutions.

SEE ALSO

knockd(1), iptables(8), nmap(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community