How to turn off the firewall on Linux server?

How to turn off the firewall on Linux server?

In many cases, the firewall will block the communication of some port numbers .

For example, our tomcat, nginx, and redis are clearly installed without any problem , but they cannot be accessed from the outside, which is likely to be the reason for the protective wall . I am Ai Xi, today I will share with you how to turn off the firewall on the Linux server

 

1. It will take effect permanently after restarting:

Enable: chkconfig iptables on

Off: chkconfig iptables off

2. It takes effect immediately and becomes invalid after restarting:

Open: service iptables start

Close: service iptables stop

It should be noted that for other services under Linux, the above commands can be used to enable and disable operations.

When the firewall is enabled, do the following settings and open the relevant ports. Open ports in the firewall for external access, such as 8080 of tomcat, 3306 of mysql, 6379 of redis, and port 80 of nginx. When we open the configuration file, we will find that he only opens port 22 by default. We can copy that line, insert it next to it, and change it to the port number we want to open. Note (must be next to the next line)

 

Modify the /etc/sysconfig/iptables file and add the following:

-A RH-Firewall-1-INPUT -m state ——state NEW -m tcp -p tcp ——dport 80 -j ACCEPT

-A RH-Firewall-1-INPUT -m state ——state NEW -m tcp -p tcp ——dport 22 -j ACCEPT

or enable:

/etc/init.d/iptables status

closure:

/etc/rc.d/init.d/iptables stop

Finally: enter setup under the root user, enter a graphical interface, select Firewall configuration, enter the next interface, select Security Level as Disabled, and save. Just restart.

Under fedora: /etc/init.d/iptables stop

Under ubuntu: Since UBUNTU has no related direct commands

Please use the following command

iptables -P INPUT ACCEPT

iptables -P OUTPUT ACCEPT

Temporarily open all ports

There is no command to turn off iptables on Ubuntu

Iptables is a powerful firewall under Linux. It is powerful enough to replace most hardware firewalls without considering efficiency. However, if a powerful firewall is not used properly, it may block not only those potential attacks, but also It could be yourself.

I'm Ai Xi, have you learned how to turn off the firewall of the Linux server shared today ?

I hope it will be helpful to those in need, see you next time

Guess you like

Origin blog.csdn.net/V13807970340/article/details/130171197