1

I used iptables -F on my machine, and what can I do to recover the iptables into the default without rebooting my machine?

I restarted the iptables service and it failed, and I can't find iptables under /etc/sysconfig/iptables

2 Answers 2

0

The iptables-restore command is used to restore the iptables rule-set that was saved with the iptables-save command. It takes all the input from standard input and can't load from files as of writing this, unfortunately. This is the command syntax for iptables-restore:

iptables-restore [-c] [-n]

More details here

5
  • I do know this command, but since I never save my iptable with iptables-save, so I can't find any file to restore, I am wondering if their is a default iptables stored somewhere, so I can just load this iptables would be fine.
    – dspjm
    Commented Jan 4, 2014 at 6:31
  • 1
    @Unnikrishnan you can load files using standard redirection, e.g., iptables-restore < /path/to/file. Alternatively, use the iptables-apply command.
    – pepoluan
    Commented Jan 13, 2014 at 9:27
  • 1
    @dspjm what Linux distro are you using? Anyways, try grep -r "*filter" /etc/* to find the files (generated by iptables-save)
    – pepoluan
    Commented Jan 13, 2014 at 9:27
  • @pepoluan using your method, I found a file suspicious /etc/ppp/firewall-masq, which is a script to add rules into iptables when system boot. I am using fedora BTW
    – dspjm
    Commented Jan 20, 2014 at 10:28
  • 1
    @dspjm Then I wager that file actually contains the iptables rules dump. Can you put that in a pastebin somewhere so I can take a peek?
    – pepoluan
    Commented Jan 22, 2014 at 3:54
-1

Your system is probably using firewalld, so you'll probably want to run systemctl restart firewalld.

3
  • Given the info provided, what the heck makes you think that?
    – NOCARRIER
    Commented Oct 30, 2023 at 21:32
  • Seeing the question again after 3 years, truth be said, most probably from the top of my head.
    – gmelis
    Commented Nov 1, 2023 at 18:30
  • Just a bit out of left field, but fair enough.
    – NOCARRIER
    Commented Nov 4, 2023 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .