LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 06-07-2019, 03:31 PM   #1
training
LQ Newbie
 
Registered: Jun 2019
Posts: 3

Rep: Reputation: Disabled
Unhappy [Centos 7] Is firewalld started/enabled as default? after started why i cant access any ports?


I just installed centos 7, few days ago
my CentOS version : Linux release 7.6.1810 (Core)
this is my first time using centos 7, but i am very familiar with centos 6


Is firewalld started/enabled as default when centos rebooted?


after started using this command
service firewalld start

why i cant access any ports anymore, like 2087 (WHM), 21 (FTP) or any ports?
do i need to set them all, like below?
firewall-cmd --permanent --zone=public --add-port=2087/tcp
firewall-cmd --permanent --zone=public --add-port=21/tcp


i can access them again after run this command
service firewalld stop


thank you for your answer

Last edited by training; 06-07-2019 at 03:32 PM.
 
Old 06-07-2019, 03:45 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Welcome to LinuxQuestions.

Similar to CentOS 6 the default firewall is enabled and only allows ssh traffic. While service still works you should become familiar with the systemctl command.

Yes, the posted commands will open the associated ports but you should reload the firewall.
firewall-cmd --reload
 
Old 06-07-2019, 04:35 PM   #3
training
LQ Newbie
 
Registered: Jun 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Welcome to LinuxQuestions.

Similar to CentOS 6 the default firewall is enabled and only allows ssh traffic. While service still works you should become familiar with the systemctl command.

Yes, the posted commands will open the associated ports but you should reload the firewall.
firewall-cmd --reload
whoa, so if starting/enabling firewalld i need to run all of these manually?

firewall-cmd --permanent --zone=public --add-port=2087/tcp
firewall-cmd --permanent --zone=public --add-port=21/tcp
firewall-cmd --reload


is there tutorial/complete list port i need to add?

Last edited by training; 06-07-2019 at 04:37 PM.
 
Old 06-07-2019, 05:00 PM   #4
training
LQ Newbie
 
Registered: Jun 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
if we are already using CSF in cpanel, do we still need firewalld? are they both handling the same thing?

this is answer from cpanel people https://forums.cpanel.net/threads/fi.../#post-2448543 , but i want answer from linux centos people too here

Last edited by training; 06-07-2019 at 05:43 PM.
 
Old 06-07-2019, 05:12 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
The --permanent option saves the new rules but does not change the run time environment. Reloading the rules is necessary to update the running firewall.

Not using the --permanent option changes run time but they are not saved.

Once the rules are saved they are automatically loaded when the firewall starts at boot time.

What ports you need to add depends on what services you run and what you want to make available to the outside world (LAN or WAN). There are many firewalld guides/tutorials.

https://www.linode.com/docs/security...lld-on-centos/
 
Old 06-07-2019, 05:20 PM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by training View Post
why i cant access any ports anymore, like 2087 (WHM), 21 (FTP) or any ports?
By default, both Centos 6 and 7 block all ports except 22. Centos 6 doesn’t have the firewalld and you need to use other tools to unblock ports.

Quote:
Originally Posted by training View Post
is there tutorial/complete list port i need to add?
That depends on the applications you are running. If you run a webserver, open ports 80 and 443. In case of an iSCSI target, 3260, and so on.

Note that firewall-cmd also has an add-service option, which opens the required ports and might do other things for difficult services like ftp.

Last edited by berndbausch; 06-07-2019 at 05:22 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reset firewalld back to default factory Winanjaya Linux - Security 2 04-09-2019 07:22 PM
firewalld blocking my open ports and services mmartinell Linux - Security 2 03-14-2018 11:36 AM
[SOLVED] CentOS 7 - Problems with firewalld/iptables on CentOS 7 Router -Can't connect to MariaDB between private networks (Virtual Box) arkfantasy CentOS 4 01-09-2017 01:56 PM
opening ports using firewalld rcmonroig Linux - Networking 4 09-05-2014 10:23 PM
ports, ports, ports cjae Linux - Networking 1 04-09-2006 09:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 07:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration