I have problem with firewall-cmd on Centos 7. I have task:

Allow TCP traffic on port 3306 from ip range, make sure to add this rule as second rule in the chain

and second task

Allow TCP traffic on port 80 from ip range, make sure to add this rule as first rule in the chain

It's a tasks which i find in google for linux training. These are tasks that I found on the internet to practice the firewall, but I can't do it.

I tried like this:

sudo firewall-cmd --add-source= --add-port=3306/tcp

but i got error

firewall-cmd: error: argument --add-port: not allowed with argument --add-source

In iptables i can do with this kind

sudo iptables -A INPUT -i eth0 -p tcp --dport 3306 --source -j ACCEPT

but how can i do this in firewall-cmd?

Regards Pawel

  • 1
    You're gonna need to use richrules or zones as suggested in this answer Aug 11, 2020 at 23:12
  • @GeekyMasters Ok, thank you very much for help :)
    – PawelC
    Aug 12, 2020 at 7:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.