Score:0

Why do my iptable rules keep growing longer and longer

cn flag

I added port 80 and port 3306 to my iptables rules on a VM.Standard.E2.1.Micro running Ubuntu on Oracle by doing:

sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT

sudo netfilter-persistent save

sudo netfilter-persistent reload

and

sudo iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT

sudo netfilter-persistent save

sudo netfilter-persistent reload

When I check my iptables rules using sudo iptables -nL -v or any other command, I can see that the rules seem to be multiplying.

Am I doing something wrong here when it comes to adding rules and saving rules?

My current rules look like this, and they weren't this long before I add those two rules. Can you please help?

enter image description here

in flag
Please don't post screenshots of text you could just copy&paste.
paladin avatar
id flag
Somehow your iptables get copied and pasted into again without clearing the former settings. Probably a third program, like a software firewall or some NAT ruling or some DHCP is messing arround your iptables with a wrong implemented config. Or maybe your OS has an out-of-the-box iptables restore mechanic which I don't know.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.