iptables not showing persistent rule after server reboot

Issues related to configuring your network
User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: iptables not showing persistent rule after server reboot

Post by jlehtone » 2022/03/15 09:51:51

csnegi wrote:
2022/03/15 08:48:58
We have scheduled a script with cronjob to block ports after every restart. Is this the only way to block the ports in persistent way?
No, not the only way.

The firewalld.service / iptables.service / nftables.service are "scripts" that add firewall rules on every restart.

Now you have at least two "scripts" that run on or after every restart and do bits of the same task.
One is made for that task, other you have created yourself. That sounds very redundant.
Do you know for certain when your cronjob runs relative to all other participants that modify firewall rules?

"Everybody" knows what iptables.service does. Nobody (you included) remembers that you have a custom cronjob.

csnegi
Posts: 6
Joined: 2022/03/03 09:07:52

Re: iptables not showing persistent rule after server reboot

Post by csnegi » 2022/03/15 09:59:02

Hello,

Kube-pyoxy is adding rules dynamically and saving them is causing service impact after reboot of the system. That is why I have asked, if there is any possibility to save rules only for target ports persistently instead of saving all the rules which includes rules added by kube-proxy services.

Please share if any feasibility exist for this.

Regards
Cnegi

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: iptables not showing persistent rule after server reboot

Post by jlehtone » 2022/03/15 10:44:03

Yes. Close down the kube-proxy. Start the machine so that the kube-proxy does not start.
Then you have only the rules that iptables.service adds.
When that ruleset is what you want and made persistent, then re-enable the kube-proxy.

csnegi
Posts: 6
Joined: 2022/03/03 09:07:52

Re: iptables not showing persistent rule after server reboot

Post by csnegi » 2022/03/16 09:50:20

Hello jlehtone & all,
Can you please help with the steps to stop and start kube-proxy service or to kill and start the process.

Regards
Csnegi

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: iptables not showing persistent rule after server reboot

Post by jlehtone » 2022/03/16 11:47:56

Red Hat describes service management in here: https://access.redhat.com/documentation ... th_systemd

Post Reply