Mic*_* TM 10 linux firewall configuration netfilter nftables
我怎样才能在一行中做到这一点?
tcp dport 53 counter accept comment "accept DNS"
udp dport 53 counter accept comment "accept DNS"
Run Code Online (Sandbox Code Playgroud)
Tot*_*tor 11
如果足够新nftables
,你可以写:
meta l4proto {tcp, udp} th dport 53 counter accept comment "accept DNS"
Run Code Online (Sandbox Code Playgroud)
事实上,你可以做得更好:
set okports {
type inet_proto . inet_service
counter
elements = {
tcp . 22, # SSH
tcp . 53, # DNS (TCP)
udp . 53 # DNS (UDP)
}
Run Code Online (Sandbox Code Playgroud)
进而:
meta l4proto . th dport @okports accept
Run Code Online (Sandbox Code Playgroud)
如果您更喜欢使用端口/服务名称(来自) ,您也可以编写domain
代替。53
/etc/services
归档时间: |
|
查看次数: |
12761 次 |
最近记录: |