AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 774092
Accepted
metablaster
metablaster
Asked: 2024-04-08 18:29:30 +0800 CST2024-04-08 18:29:30 +0800 CST 2024-04-08 18:29:30 +0800 CST

在 nftables 中的表声明范围之外声明 ct 辅助对象

  • 772

ct helper这是当前如何根据nftables 文档声明对象的工作示例

#!/usr/sbin/nft -f

add table filter_4 {
    # TODO: Can helper object be declared outside the scope of table declaration scope?
    # ct helper stateful object
    # "ftp-standard" is the name of this ct helper stateful object
    # "ftp" is the in-kernel name of the ct helper for ftp
    ct helper ftp-standard {
        type "ftp" protocol tcp;
    }
}

然后该ct helper对象用于 ex。如下:

add chain filter_4 new_out_4 {
    comment "New output IPv4 traffic"
}

# FTP (active and passive)
# Rule for initial ftp connection (control channel), setting ct helper stateful object to use
# "ftp-standard" is the name of the ct helper stateful object
add rule filter_4 new_out_4 tcp sport >1023 tcp dport 21 ct helper set "ftp-standard" accept

我想要实现的是了解ct helper在表外声明对象的语法,其方式与声明集合的方式类似。

有关如何在表声明范围之外声明集合的示例

add set filter_4 multicast_proto { type inet_proto; comment "IPv4 multicast protocols"; }
add element ip filter_4 multicast_proto { udp, igmp }

以类似的方式,我想声明ct helper对象,例如:

# Table declaration
add table filter_4

# Declare ct helper separately
add ct helper ftp-standard {
    type "ftp" protocol tcp;
}

这当然不行,ct helper像这样添加\声明的语法是什么?

似乎ct helper必须绑定到一个表(这是真的吗?),因此也许应该在上面的示例中指定表名称。

nftables
  • 1 1 个回答
  • 8 Views

1 个回答

  • Voted
  1. Best Answer
    A.B
    2024-04-08T19:59:57+08:002024-04-08T19:59:57+08:00

    语法描述如下nft(8):

    CT助手

    add ct helper [family] table name { type type protocol protocol ; [l3proto family ;] }
    delete ct helper [family] table name
    list ct helpers

    所以对于你的情况:

    • 从 shell(包括'在适当的情况下使用正确的 shell 转义,nft它本身并不关心:它解析参数相同,但它们是分开提供的):

      nft add ct helper filter_4 ftp-standard '{ type "ftp" protocol tcp; }'
      
    • 或者如果已经在nft上下文中,只需:

      add ct helper filter_4 ftp-standard { type "ftp" protocol tcp; }
      
    • 1

相关问题

  • nftables:更改或创建新表时刷新/删除

  • nftables 不工作,我做对了吗?

  • 我可以在 nftables 中匹配一组负数吗?

  • 如何在 nftables 中按名称创建一组命名接口?

  • 重启后 Nftables 规则消失了!

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve