Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
reload iptables w/ initial settings
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Tzuriel
Apprentice
Apprentice


Joined: 01 Jun 2004
Posts: 259

PostPosted: Fri Jul 29, 2022 8:40 pm    Post subject: reload iptables w/ initial settings Reply with quote

I was working with iptables and have made some mistakes to where I'd like to flush everything and reload with the configuration that comes with Gentoo, but not sure how.

Thoughts?
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Fri Jul 29, 2022 8:56 pm    Post subject: Reply with quote

By default, the location where rules are saved is IPTABLES_SAVE=/var/lib/iptables/rules-save as defined in /etc/conf.d/iptables.

Stop iptables, delete or move the "rules-save" file, and I believe you'll have the default rules the next time iptables is started (at least with openrc as /etc/init.d/iptables sets up some defaults).

If you don't specifically need iptables, you might instead consider using its successor, nftables.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
trilithium
n00b
n00b


Joined: 18 Nov 2019
Posts: 43

PostPosted: Fri Jul 29, 2022 9:16 pm    Post subject: Reply with quote

If you haven't yet restarted the iptables service you should still have a copy of all your previous rules in the file mentioned by pjp and can restore them using the script iptables-restore:

Code:
iptables-restore /var/lib/iptables/rules-save
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum