1

I get the ports as a variable and I need to delete the rule in nftables. If the port is present in rule then i would grep the handle number and delete the rule. But in nftables service name would be present in rule so how can I delete the rule. Is there any way to find the what port belongs to service or any other way to delete the nftable rule other than handle or any other suggestions ??

infantus
  • 49
  • 7
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 08 '21 at 07:13

1 Answers1

2

Ports and service name are listed in /etc/services.

You can force the listing to use numeric ports by

nft -nna list ruleset/chain/set/table

I don't know the use case but a better solution may be achieved by using named sets, from which elements can be easily removed.

Lobz
  • 68
  • 4