0

I am new to Linux. In CentOS 6.3 I added this rule:

iptables -I INPUT -p udp --dport 9494 -j ACCEPT

Now I am trying to save it:

/sbin/service iptables save It gives me: [FAILED]

I tried to do: /sbin/service iptables stop but it gives me FAILED on unloading modules iptable_filter iptable_filter [FAILED]es

Andrew
  • 165
  • 9
  • "new to Linux" doesn't really fit the subject matter of [Server Fault](http://serverfault.com/faq). [unix](http://unix.stackexchange.com/) is a better place when you're first starting out. – Andrew B Feb 27 '13 at 03:58
  • 1
    @AndrewB - that is absolutely inaccurate. Serverfault has no requirement that site users be of a certain skill level. The only requirement is that they are performing these duties as part of their profession. Even new linux admins are professionals. If you don't care to answer simple questions, than feel free to ignore them. – EEAA Feb 27 '13 at 04:08
  • @EEAA I apologize then, I appear to have picked up a false impression from watching others. The point is fair, there was nothing to indicate a home setting, so it was an inappropriate assumption. – Andrew B Feb 27 '13 at 04:15
  • @AndrewB - no problem. Lesson learned. – EEAA Feb 27 '13 at 04:17

2 Answers2

-1

You run:

$ iptables-save > /path/to/file

That will store the current iptables rules in /path/to/file.

Then to re-load the rules:

$ iptables-restore < /path/to/file
EEAA
  • 109,363
  • 18
  • 175
  • 245
-1

OK, I added rules to file /etc/sysconfig/iptables and it worked

Andrew
  • 165
  • 9
  • If by "it worked" you mean "it still isn't automatically saving your tables but it's enough", then yes. That's not an answer to the question you posed though. – Andrew B Feb 27 '13 at 03:57
  • Well, I don't know what is good enough and what is not! If it works, it should be good? – Andrew Feb 27 '13 at 04:01
  • @AndrewB I think the OP is qualified to determine what answer truly answers his question. It's clear that he figured out how to solve the problem and then posted his solution. What's the problem with that? FWIW, I'm giving him a +1. – EEAA Feb 27 '13 at 04:10
  • @EEAA respect! Thank you for your help-- I have a lot to learn! – Andrew Feb 27 '13 at 04:12
  • @Andrew Right on. Don't let the naysayers get you down. We all started somewhere. Keep the questions coming! – EEAA Feb 27 '13 at 04:13
  • @EEAA The question posed was specifically about the `iptables` initscript writing out information when used in a "save" context. Manually coding the rules doesn't actually resolve this. While I fully admit that my initial comment was inappropriate, a discussion on meta specifically raises the problem of new users answering their own question in ways that are incongruent to the posed question. The chosen answer is "what worked for them" and their prerogative to select, but that isn't always the same scale on which answers are judged. – Andrew B Feb 27 '13 at 04:23