Linux manual shutdown of the firewall steps

  
                

The system firewall protects our computers from hackers and is very important to the security of the system, but sometimes it is necessary to turn off the firewall manually because some programs need to be shut down. The following small series will introduce you to the method of manually shutting down the firewall.

is a so-called firewall refers to a combination of software and hardware together, at the interface between the between the internal network and external networks, private network and the public network structure protective barrier. It is an image of a method of obtaining security. It is a combination of computer hardware and software that establishes a security gateway between the Internet and the intranet.

(1) Permanently effective after reboot:

Open: chkconfig iptables on

Close: chkconfig iptables off

(2) Immediately effective, restart Post-failure:

Open: service iptables start

Close: service iptables stop

It should be noted that other services under Linux can be opened and closed with the above commands. operating.

When the firewall is turned on, do the following to open the relevant port,

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:

/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 to enter a graphical interface and select Firewall configuration Go to the next screen and select Security Level as Disabled and save. Restart it.

===================================================== ==========

fedora

/etc/init.d/iptables stop

=========== ================================================================== Ubuntu:

Since UBUNTU has no direct commands

Please use the following command

iptables -P INPUT ACCEPT

iptables -P OUTPUT ACCEPT

Temporarily open all ports

There are no commands to close iptables on Ubuntu

======================== ============================================================================================ How does the system home use the iptables command to configure the firewall for Linux systems? It can be used to replace most hardware firewalls without considering efficiency. However, if the firewall is not properly applied, it may not only be the potential ones. Attack, and maybe it's your own. The harm caused by this may not matter for ordinary personal PCs, but imagine that if this is a server, once this happens, it is not only the normal service of the theater, but also needs to go to the scene to recover, this will give How much loss do you bring?

So what the system family Xiaobian wants to say is that you should be very careful when you type in every iptables related command.

1. When applying each rule to the DROP target, you should carefully check the rules, and consider the impact he has on you before applying.

2. In redhat we can use service iptables stop to close the firewall, but in some versions such as ubuntu this command does not work, you may find a lot of articles on the Internet tell you to use iptables -F This command is used to turn off the firewall, but before using this command, remember to use iptables -L to check the default target of all the chains in your system. The iptables -F command just clears all the rules, just does not really close iptables. Imagine If your chain default target is DROP, you have rules to allow some specific ports, but once iptables -L is applied, after clearing all rules, the default target will block any access, including the remote ssh management server. you.

So my recommended firewall shutdown command 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 a good idea to have a test environment fully tested and applied to your server. In addition, to use iptables, it is necessary to understand the operating principle of iptables, know how to handle each packet iptables. In this way, the rules can be accurately written to avoid unnecessary trouble.

The above is how Linux manually shuts down the firewall. If you need to manually turn off the firewall and can't find the closed interface, you can use the method described in this article.

Copyright © Windows knowledge All Rights Reserved