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 install and use firewall in Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the Linux system how to install and use the firewall related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this Linux system how to install and use the firewall article will have a harvest, let's take a look.

Firewall is a combination of computer hardware and software. firewall technology is a technology that organically combines all kinds of software and hardware equipment used for security management and screening to help computer networks build a relatively isolated protection barrier between their internal and external networks to protect the security of user data and information.

1. After restart, it will take effect permanently:

Enable:

Chkconfig iptables on shuts down:

Chkconfig iptables off 2. Effective immediately and expire after restart:

Enable:

Service iptables start shuts down:

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:

Enable:

/ etc/init.d/iptables status shuts down:

/ etc/rc.d/init.d/iptables stop 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 stopubuntu:

Because UBUNTU does not have relevant direct commands

Please use the following command

Iptables-P INPUT ACCEPT iptables-P OUTPUT ACCEPT temporarily opens 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.

This is the end of the article on "how to install and use firewalls in Linux system". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to install and use firewalls in Linux system". If you want to learn more, you are welcome to follow the industry information channel.

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

Development

Wechat

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

12
Report