Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to turn off the firewall of linux system manually

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to shut down the firewall of linux system manually". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to shut down the firewall of linux system manually.

(1) after restart, it will take effect permanently:

Enable: chkconfig iptables on

Turn off: chkconfig iptables off

(2) effective immediately and expire after restart:

Enable: service iptables start

Turn off: service iptables stop

It is important to note that you can use the above command to enable and close other services under Linux.

When the firewall is enabled, make the following settings to open the relevant port

Modify the / etc/sysconfig/iptables file to 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:

/ etc/init.d/iptables status will get a series of messages indicating that the firewall is on.

/ etc/rc.d/init.d/iptables stop turn off the firewall

Finally:

Enter setup under the root user, enter a graphical interface, select Firewall configuration, go to the next interface, select Security Level as Disabled, and save. Just restart it.

=

Under fedora

/ etc/init.d/iptables stop

=

Under ubuntu:

Because UBUNTU does not have relevant direct commands

Please use the following command

Iptables-P INPUT ACCEPT

Iptables-P OUTPUT ACCEPT

Temporarily open all ports

There is no command to close iptables on Ubuntu

=

Iptables is a powerful firewall under linux, which is powerful enough to replace most hardware firewalls without considering efficiency, but if not applied properly, it may block not only those potential attacks, but also yourself. The harm caused by this may not matter to the ordinary personal PC, but imagine if this is a server, once this happens, not only the normal service of the cinema, but also need to go to the scene to restore, how much loss will this bring you?

So what I'm trying to say is that you have to be very careful when you type in every command related to iptables.

1. When applying each rule to DROP target, check the rule carefully and consider the impact it brings to you before applying it.

two。 In redhat, we can use service iptables stop to turn off the firewall, but in some versions, such as ubuntu, this command does not work. You may find many articles on the Internet that tell you to use the iptables-F command to turn off the firewall, but before using this command, remember to use iptables-L to check the default target,iptables-F of all chains in your system. This command only clears all rules, but does not really close iptables. Imagine that if your chain default target is DROP, you have rules to allow certain ports, but once you apply iptables-L and clear all the rules, the default target will block any access, including you from the remote ssh management server.

So my recommended command to turn off the firewall is

Iptables-P INPUT ACCEPT

Iptables-P FORWARD ACCEPT

Iptables-P OUTPUT ACCEPT

Iptables-F

In short, when you want to make any changes on your server, it's best to have a test environment that has done enough testing before applying it to your server. In addition, to make good use of iptables, it is necessary to understand how iptables works and how to handle iptables for each packet. Only in this way can we write the rules accurately and avoid unnecessary trouble.

At this point, I believe you have a deeper understanding of "how to manually shut down the firewall of the linux system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report