The firewall under the Linux server is iptablesComponents, the Iptables firewall will block some of the necessary connections when installing some software.Viewing iptables Status: Service iptables statusIptables boot: On: Chkconfig iptables on off: Chkconfig iptables offipt
CentOS7 -- iptables configuration, centos7 -- iptables
In the Red Hat RHEL7 SystemFirewalld ServiceReplacedIptables serviceBut can still be usedIptables commandTo manage the netfilter of the kernel.
Common Control types in the iptables command include:
The rule chain is classified based on the location of the data packet to be processed:
PREROUTING:Data packe
Iptables practical tutorial (1): Basic Concepts and Principles, iptables practical tutorialOverview
Iptables is a built-in firewall software for linux. It is used to configure IPv4 packet filtering or NAT (ip6tables for IPv6 ).
In linux, the firewall is actually part of the system kernel. Based on the Netfilter architecture, the basic principle is to place some h
firewall matches the rules in the corresponding link according to the table sequence and the data flow.
4: The jump (action) of rules in the chain can be divided into: ACCEPT (ACCEPT), DROP (discard), REJECT (REJECT), LOG (LOG)
The action indicates the action performed by the firewall when the rule is matched. The action is discarded or passed, or recorded in the LOG. when the action is LOG, the action will continue to match downward, therefore, LOG should be written at the beginning.
Ii. Detai
Linux (10) ___ iptables firewall, linux ___ iptables
I. Functions of the firewall
Iii. Classification of firewalls
III. Basic iptables Syntax:
Table:
Filters are commonly used. nat is used for address ing conversion.
Configuration file:
/Etc/sysconfig/iptables
Filter table information
,
View
PS: This iptables script is good, very practical, according to the actual application changes can be used by themselves. Share it for everyone to reference. Original author Anonymous. The source code is as follows:#!/bin/sh#Modprobe Ipt_masqueradeModprobe ip_conntrack_ftpModprobe ip_nat_ftpIptables-fIptables-t nat-fIptables-xIptables-t Nat-x########################## #INPUT键 ###################################Ipta
valueExample:-m mac--mac 00:0d:29:24:ec:19B. Common extension matches
Category
Options
Usage
Show matches
Status Matching
-M State--state status value
MAC address Matching
-M Mac--mac-source MAC address
Multi-port matching
-M multiport--sport Source Port list
-M multiport--dport Target Port list
rule on the previous chain.
5) match extension matching extension
In the matching parameters, only the protocol, source address, target address, and network interface can be matched. For more detailed matching (for example, matching the target port), there is nothing to do. There is a-m in the matching parameter, which can provide more detailed matching.
For example, to enable a packet sent by an SSH client, you need to use tcp extension. You can specify the Packet target address:
Use-m tcp-dp
rules, we can use the state tracking mechanism;~]# iptables-d FORWARD 2Add a rule, both inside and out as long as the response messages are allowed to proceed normally;~]# iptables-i forward-m state–state established-j ACCEPTIn the future, just write the request strategy;Such as: Intranet host open SSH connected to the external network;~]# iptables-r FORWARD 2-s
Echo "1">/proc/sys/net/ipv4/icmp_echo_ignore_all
This is because someone else cannot ping you or ping someone else.
Change the value to 1 to disable PING.
Change the value to 0 to disable PING.
In fact, iptable is the simplest
Iptables-a input-p icmp-type 8-s 0/0-j DROP
Iptables-a input-p icmp-type 0-s 0/0-j ACCEPT
Iptables-a output-p icmp-type 0-s 192.168.29.1-j
Iptables-save is used to store the current rules in a file for iptables-restore use. It's very simple to use, with only two parameters:Iptables-save [-c] [-t table]The function of parameter-C is to save the value of the packet and byte counter. This allows us to not lose statistics on packets and bytes after restarting the firewall. The Iptables-save command with
Practical setting of Linux Firewall iptables, linux Firewall iptables
One important step to maintain a server is to manage the opening and closing of ports to prevent external malicious attacks from exploiting the ports occupied by these services.
First, you can view the iptables information:
Sudo iptables-L
Multiport Module
You can use the multiport module to specify multiple ports at a time.
When writing a rule, you must specify the "-m" parameter to check the status.
-M stat -- state detection package status
-M multiport: This module can match a group of source or destination port numbers, up to 15 ports;
As follows:
-- Source-ports 22, 80
-- Destination-ports 110
The root user cannot modify iptables. the root user iptables
Requirement: Because the firewall imposes IP and port restrictions, you need to add a rule to allow access to the specified IP address and port.
Vi/etc/sysconfig/iptables. After the file is added, wq is saved, prompting that the file cannot be saved only !!!
Solution:
1. Check the file permissio
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.