Creating nftables rules

88 views
Skip to first unread message

Adriano Marto Reis

unread,
Jul 16, 2020, 11:04:06 PM7/16/20
to pyroute2-dev
Hi,

Does anyone know how to use NFTables class to create rules? Is there any documentation available? Examples? Anything?

I trying to use pyroute2 to manage nftables rules. I need to create rules based on network interfaces, ports, protocols, etc. The problem is that I cannot find any documentation on how to use the the class NFTables. The only source information I could find is a comment in the source code that demonstrate how to create a rule based on the source address:

nft.rule('add',
   table='test0',
  chain='test_chain0',
  expressions=(ipv4addr(src='192.168.0.0/24'),
  verdict(code=1)))

From:
https://github.com/svinota/pyroute2/blob/master/pyroute2/nftables/main.py

Thanks,

Adriano.
Reply all
Reply to author
Forward
0 new messages