Linux Firewall shutdown details

Source: Internet
Author: User
Article Title: Linux Firewall shutdown details. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1) It takes effect permanently after restart:

Enable: chkconfig iptables on

Close: chkconfig iptables off

2) It takes effect immediately and becomes invalid after restart:

Enable: service iptables start

Disable: service iptables stop

You can use the preceding command to enable or disable other services in Linux.

When the firewall is enabled, make the following settings to enable the relevant ports,

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

-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 information, indicating that the firewall is on.

/Etc/rc. d/init. d/iptables stop disable Firewall

Finally:

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

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

-------------------------------

Under fedora

/Etc/init. d/iptables stop

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

Under ubuntu:

UBUNTU has no related direct commands.

Use the following command

Iptables-P INPUT ACCEPT

Iptables-P OUTPUT ACCEPT

Temporarily open all ports

No command to disable iptables on Ubuntu

========

Iptables is a powerful firewall in linux. without considering the efficiency, it is powerful enough to replace most hardware firewalls. However, if the powerful firewall is improperly used, it may block not only the potential attacks, but also you. the harm brought by this may not matter to ordinary personal PCs, but imagine that if this is a server, once this happens, it is not just a normal Cinema Service, we still need to go to the site for recovery. How much will this cause to you?

So I want to say that you should be very careful when you type every command related to iptables.

1. When applying each rule to DROP target, you must carefully check the rule. before applying the rule, consider the impact it has on you.

2. in redhat, we can use service iptables stop to disable 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 close the firewall, but before using this command, remember to use iptables-L to check the default targets of all links in your system. The iptables-F command only clears all rules, but does not actually close iptables. imagine that if the default target of your chain is DROP, you have rules to allow specific ports, but once iptables-L is applied, After all rules are cleared, the default target will block any access, including remote ssh server management.

So the recommended command to disable 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 is best to have a test environment that has been fully tested and then applied to your server. in addition, to use iptables properly, you must understand the running principle of iptables and know how iptables processes each data packet. in this way, rules can be accurately written to avoid unnecessary troubles.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.