Iptables task fail

Not sure where I have gone wrong :man_shrugging:

I dont have a screenshot of the original question.

It was along the lines off I need to install and configure iptables to only allow the LBR server access access to the httpd port (5002) on all the app servers. I needed to make sure the config is saved.

I thought i had done this but the end of the task check advises this was not saved permanently to App Server 1

From the command history you can see I added the relevant rules to app server 1 and ran the command to permanently save the rule set.

Will be great if someone can advise where I have gone wrong :slightly_smiling_face:

iptables-save command only writes to the standard output, it does not actually saves the data to the iptables configuration file.

To make changes permanent to IPtables config file(/etc/sysconfig/iptables) you have to use below command.

service iptables save

Thanks,
Ram

2 Likes

Thanks.

It would be good if this was covered off in the iptables lecture on the Linux course, I got confused between ‘service iptables save’ and ‘iptables-save’.

Oh well I now know for next time.

1 Like

I am now more confused :frowning: . So far I knew sudo iptables save and sudo iptables-save > /etc/sysconfig/iptables. I have posted a similar question in the below link. It will be great if you can explain the differences.

Edit: Actually I have seen if I have enabled the iptables to start with then iptables-save works

looks like i am wrong, posted here Saving iptables - different approach? - #2 by praddasg