APP01 iptabel rules not saved - IPtables Installation And Configuration

Hi,

I tried task for IPtables Installation And Configuration and failed it.
“Rule was not added permanently on App server 1”

Following are the steps that i did.

Installing Iptables

yum install iptables-services
systemctl start iptables
systemctl enable iptables

ADDED BELOW line to Iptables

iptables -I INPUT ! --src 172.16.238.14 -m tcp -p tcp --dport 5000 -j DROP

Removed one rule from both app02 and app03 since it was blocking all protocols
iptables -D INPUT 5

Saved using

service iptables save

Below are the screen shorts

APP01

I was able to ping app server from loadbalancer server by using

What did i do wrong?

try this iptables rules, its worked for me

sudo iptables -R 5 INPUT -p tcp --destination-port (in question) -s 172.16.238.14 -j ACCEPT
sudo iptables -A INPUT -p tcp --destination-port (in question) -j DROP

Thanks for the relpy . I will try next time.

But just curious why mine failed @mmumshad

Can you tell me why you used ! argument?

From iptables man
** A “!” argument before the address specification inverts the sense of the address.**

iptables -I INPUT ! --src 172.16.238.14 -m tcp -p tcp --dport 5000 -j DROP

So its more like if src not equal to 172.16.238.14 then drop it.

For tutorial/solution - https://youtu.be/oW2UTb-Nfx0
This video is made by me with sole intention of helping the community

For Tutorial/Solution - Content made for sole reason to help the community.