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

What are the firewall rules commonly used by iptables in Linux

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

Share

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

Xiaobian to share with you what iptables commonly used firewall rules in Linux, I believe most people do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

IPTABLES is an IP packet filtering system integrated with the latest version 3.5 of the Linux kernel. If the Linux system is connected to the Internet or LAN, server or proxy server connecting LAN and Internet, this system facilitates better control of IP packet filtering and firewall configuration on Linux system.

Firewalls have a set of rules to follow when making packet filtering decisions, and these rules are stored in dedicated packet filtering tables that are integrated into the Linux kernel. In packet filtering tables, rules are grouped in what we call chains. The netfilter/iptables IP packet filtering system is a powerful tool for adding, editing, and removing rules.

Although the netfilter/iptables IP packet filtering system is referred to as a single entity, it actually consists of two components, netfilter and iptables.

The netfilter component, also known as kernel space, is part of the kernel and consists of packet filtering tables that contain the set of rules used by the kernel to control packet filtering processing.

The iptables component is a tool, also known as userspace, that makes it easy to insert, modify, and remove rules from packet filtering tables. Unless you are using Red Hat Linux 7.1 or later, you need to download the tool and install it to use it.

The details are as follows:

iptables -A INPUT -s 127.0.0.1-d 127.0.0.1 -j ACCEPT#Allow local loopback interfaces (i.e. run native to access native)iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT #Allow established or associated traffic iptables -A OUTPUT -j ACCEPT #Allow all native outbound access iptables -A INPUT -p tcp --dport 22 -j ACCEPT #Allow access to port 22 iptables -A INPUT -p tcp --dport 80 -j ACCEPT #Allow access to port 80 iptables -A INPUT -p tcp --dport 21 -j ACCEPT #Allow ftp service on port 21 iptables -A INPUT -p tcp --dport 20 -j ACCEPT #Allow FTP service on port 20 iptables -A INPUT -j reject #Prevent access to iptables by other rules that are not allowed-A FORWARD -j REJECT #Prevent access to other rules that are not allowed The above is "What are the common firewall rules for iptables in Linux" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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

Servers

Wechat

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

12
Report