In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to configure iptables firewall under CentOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Set the firewall in Linux, and take CentOS as an example, open the configuration file of iptables:
Vi / etc/sysconfig/iptables
Use the / etc/init.d/iptables status command to query whether port 80 is open, and if not, you can handle it in two ways:
1. Modify the vi / etc/sysconfig/iptables command to make the firewall open port 80
-A RH-Firewall-1-INPUT-m state-- state NEW-m tcp-p tcp-- dport 80-j ACCEPT
two。 Turn off / turn on / restart the firewall
/ etc/init.d/iptables stop
# enable start
# restart restart
3. Permanently turn off the firewall
Chkconfig-level 35 iptables off
/ etc/init.d/iptables stop
Iptables-P INPUT DROP
4. Open port 21 in active mode
Iptables-An INPUT-p tcp-- dport 21-j ACCEPT
5. Open the port between passive mode 49152 and 65534
Iptables-An INPUT-p tcp-- dport 49152 tcp 65534-j ACCEPT
Iptables-An INPUT-I lo-j ACCEPT
Iptables-An INPUT-m state-- state ESTABLISHED-j ACCEPT
Note:
Be sure to give yourself a way back, leaving a management port for VNC and a management port for SSh.
It is important to note that you must modify this file according to the situation of your server.
Restart iptables after all modifications:
Service iptables restart
You can verify that the rules are already in force:
Iptables-L
This is the end of the introduction of "how to configure iptables Firewall under CentOS". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.