After going through several posts here and documentation, I came to a conclusion that this task can be done in 3 different ways, however I was only successful only by one method.
The 3 different methods I thought can be used are
- using the iptables cli
- update the
/etc/sysconfig/iptables
file - using
iptables-restore
command
However the only thing worked was updating the /etc/sysconfig/iptables
file. Providing the screenshots below with the different approaches except the file update as it was successful
So my question
- Is my initial, understanding about 3 approaches wrong?
- Does
iptables-save
persist the change post restart? - Any other input is highly appreciated
Restore iptables using iptables-restore command
Note: See the iptables.txt had the rules but not the iptables. Also i tried to do curl from jump host and it was working (which it was not supposed to)
Using iptables CLI and Append command
Note: Here I have tried iptables-save
and restart but still the /etc/sysconfig/iptables
did not change. Also i tried to do curl from jump host and it was working (which it was not supposed to)
Using iptables CLI and Insert command
Note: Here iptables-save
seem to have did the trick but as soon as i restarted, things reverted
Using iptables CLI and not using “iptables-save” command and instead trying to restart iptables
Note: Here did not do iptables-save
tried restart and things did not work