Linux Firewalld Setup Kodekloud

 


Question:


Solution:

You need to do the task in all app servers.

At first start from stapp01 server

ssh tony@stapp01

sudo su

Then check apache and nginx service status

systemctl status httpd &&  systemctl status nginx

Next, find the apache and nginx port number

 
grep -i Listen /etc/httpd/conf/ht*  /etc/nginx/nginx.conf

Then install firewalld

 
yum install -y firewalld

Enable and check status

systemctl start firewalld && systemctl enable firewalld && systemctl status firewalld

Now allow the nginx port that you got from finding port number before 

 
firewall-cmd --permanent --zone=public --add-port=8091/tcp

Allow http and https

 
firewall-cmd --permanent --zone=public --add-service={http,https}

Allow the httpd port also

firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source                 address=172.16.238.14 port protocol=tcp port=8087 accept'

Reload and restart firewalld

firewall-cmd --reload && systemctl restart firewalld && firewall-cmd --zone=public --list-all

 

Finally, go to stapp02 and stapp03 server and do the same.

 


Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment