How to activate firewall on Centos server?

Support for security such as Firewalls and securing linux
Post Reply
friv
Posts: 1
Joined: 2022/01/29 08:46:35

How to activate firewall on Centos server?

Post by friv » 2022/01/29 08:54:23

Hello folks

I am facing with one problem to activate firewall on my Centos 7 server, VPS

My first step is to check did firewall is active with command sudo systemctl status firewalld and then i see is not active ,after command sudo systemctl enable firewalld firewall is active in green color.

But when i want to check websites i see the error "Host error" and every website is down. Then after disabling firewall websites back again online.

I was contact my hosting company and they do not want to help to activate firewall at my server. They told me that i need to pay 79$ for that. LOL

So, i think that i am in right place for this,because i hope so that somebody will help me. Thanks in advance

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to activate firewall on Centos server?

Post by TrevorH » 2022/01/29 14:23:11

If you've never run it then it comes up and disallows everything except ssh port 22 traffic. Yuo need to start it and then configure it to allow the right things through. For example, firewall-cmd --add-service=http then run that again with --permanent so that comes back at next reboot/restart. Also may want to --add-service=https as well.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

tmandel
Posts: 8
Joined: 2022/01/25 13:38:52

Re: How to activate firewall on Centos server?

Post by tmandel » 2022/01/30 00:29:06

I would also do a

Code: Select all

sudo firewall-cmd --add-service=ssh --permanent
Then you can go with a

Code: Select all

sudo firewall-cmd --reload
or a

Code: Select all

sudo systemctl restart firewalld

Post Reply