How to get iptables NAT rules?

68 views
Skip to first unread message

TheDiveO

unread,
May 26, 2018, 5:52:58 PM5/26/18
to pyroute2-dev
I would like to get those iptable rules covering SNAT and DNAT,single shot only using an IPRoute() object. How can I do this?

Best regards,
TheDiveO

Peter Saveliev

unread,
May 27, 2018, 5:18:13 AM5/27/18
to TheDiveO, pyroute2-dev
Unfortunately, iptables has almost nothing to do with netlink. It is not possible to get/set/add iptables rules via netlink.

If you need to manipulate some firewall rules via netlink, so the netlink defines the environment, then choose nftables.

it it is iptables that defines the environment, then choose some other way to manipulate the firewall rules.

--
You received this message because you are subscribed to the Google Groups "pyroute2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TheDiveO

unread,
May 27, 2018, 11:00:11 AM5/27/18
to pyroute2-dev
Ah, thank you Peter for clarifying my confusion. As the system I need to work with uses iptables, I will go for python-iptables then.


On Sunday, May 27, 2018 at 11:18:13 AM UTC+2, Peter Saveliev wrote:
Unfortunately, iptables has almost nothing to do with netlink. It is not possible to get/set/add iptables rules via netlink.

If you need to manipulate some firewall rules via netlink, so the netlink defines the environment, then choose nftables.

it it is iptables that defines the environment, then choose some other way to manipulate the firewall rules.
2018-05-26 23:52 GMT+02:00 TheDiveO <harald....@gmx.net>:
I would like to get those iptable rules covering SNAT and DNAT,single shot only using an IPRoute() object. How can I do this?

Best regards,
TheDiveO

--
You received this message because you are subscribed to the Google Groups "pyroute2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages