我有一个Linux系统,我有多个进程通过TCP端口与主进程通信。 我需要创build一个场景,阻止从一个特定进程的所有端口到主进程与该进程进行通信所使用的端口的所有通信。
例:
我要input的规则是来自PROCESS A端口的stream量(我可以使用netstat等)发往Master进程端口的stream量被iptables阻塞。
我环顾四周,发现丢弃发往特定端口的stream量的方法,但没有指定源端口的运气。
这与目的地港口几乎相同。 如果您使用--dport作为目标端口,则还必须为源端口指定--sport ,
man iptables-extensions tcp These extensions can be used if `--protocol tcp' is specified. It provides the following options: [!] --source-port,--sport port[:port] Source port or port range specification. This can either be a service name or a port num‐ ber. An inclusive range can also be specified, using the format first:last. If the first port is omitted, "0" is assumed; if the last is omitted, "65535" is assumed. If the first port is greater than the second one they will be swapped. The flag --sport is a convenient alias for this option. ...