← 返回命令列表

Linux command

knock 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Knock on a sequence of ports

knock [hostname] [port1] [port2] [port3]

Knock

knock [hostname] [port]:tcp [port]:udp

Knock using UDP

knock -u [hostname] [port1] [port2] [port3]

Knock with a delay

knock -d [500] [hostname] [port1] [port2]

Display verbose

knock -v [hostname] [port1] [port2] [port3]

说明

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.

参数

-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

FAQ

What is the knock command used for?

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.

How do I run a basic knock example?

Run `knock [hostname] [port1] [port2] [port3]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -u, --udp do in knock?

Use UDP instead of TCP