Linux under Iptables configuration detailedIf your iptables basic knowledge is not yet known, it is recommended to take a look first.Start ConfigurationLet's configure a firewall for the filter table.(1) Check the setting of this institution in Iptables[email protected] ~]# iptables-l-NChain INPUT (Policy ACCEPT)Target
If your iptables basic knowledge is not yet known, it is recommended to take a look first.Start ConfigurationLet's configure a firewall for the filter table.(1) Check the setting of this institution in Iptables[email protected] ~]# iptables-l-NChain INPUT (Policy ACCEPT)Target prot opt source destination Chain FORWARD (policy ACCEPT)Target prot opt source destina
If your iptables basic knowledge is not yet known, it is recommended to take a look first.Start ConfigurationLet's configure a firewall for the filter table.(1) Check the setting of this institution in Iptables[email protected] ~]# iptables-l-NChain INPUT (Policy ACCEPT)Target prot opt source destination Chain FORWARD (policy ACCEPT)Target prot opt source destina
Iptables Settings for CENTOS6 servers (host firewall)Vim/etc/sysconfig/iptables-configAdd to:iptables_modules= "Ip_nat_ftp ip_conntrack_ftp" in order to enable the IPTABLES support FTP service moduleReboot will fail then set boot boot:1 Script content:vim/etc/sysconfig/iptables.sh#!/bin/bashIptables-a clean_in-p TCP! --syn-m State--state New-j DROPIptables-a inpu
Iptables default three tables:• Filter: Firewall, including INPUT, OUTPUT, and FORWARD• Nat: Network conversion, including PREROUTING, POSTROUTING, and OUTPUT• Mangle: Traffic Shaping, including all five chainsFive Links in iptables-> where to write rules• INPUT: data packets are stored on the LINUX host.• OUTPUT: data packets are sent by the LINUX host.• FORWARD: the data packet enters from one interface a
Install iptables Firewall
If you do not install iptables you need to install first, CentOS execution:
Yum Install Iptables
Debian/ubuntu Execution:
Apt-get Install Iptables
On the VPS on the week nine Iptables set to:
*nat:P rerouting ACCEPT [7,978:1,018,059]:P ostrout
Iptables is an important means of access control in Linux and is an important part of Linux firewall system. Here are some common operating instructions for iptables firewall rules.The following operations are based on CentOS and should be similar to different Linux distributions. In CentOS 5.x and 6.x, Iptables is installed by default (if not installed, install
How to compile and install Iptables instances:First uninstall the system already installed iptables, the need to back up three documents before uninstalling: iptables startup script, Iptables-config configuration document, and already established Iptables rule document[email
no corresponding entry is in the connection tracking template; (The first handshake in a TCP three-second handshake)After the Established:new state, the communication process that was made before the entry in the margin tracking template was deleted is called established; (TCP's second third handshake, called established Connection (established))INVALID: There is a state, more bizarre, such as: Syn=1 ack=1 rst=1, for this we do not recognize, we call INVALID unrecognizedRelated: Indicates that
Turn from:A iptables script#!/bin/bashPath=/sbin:/usr/sbin:/bin:/usr/binRc_squid=/etc/rc.d/init.d/squid# on the outside connectionextif= "Eth1"# on the Insideintif= "Eth0"innet= "192.168.100.1/24"# Pin NAT DHCPnatnet= "Eth2"ntnet= "192.168.21.1/24"#掛入相關 Module/sbin/modprobe Ip_tables/sbin/modprobe ip_nat_ftp/sbin/modprobe Ip_conntrack/sbin/modprobe ip_conntrack_ftp# Clear all the fire walls first/sbin/iptables
The first two articles: IPtables II: basic rule writing IPtables: Basic ConceptsFor the differences between explicit and implicit extensions, first analyze the following two rules:Rule 1: iptables-t filter-a input-s 192.168.1.0/24-d 172.16.100.1-p udp-dport 53-j DROPRule 2: iptables-t filter-a input-s 192.168.1.0/24-d
sent from the eth0 (external network adapter) to 61.99.28.1 (a network segment is specified here, which is generally not specified)
Iptables-T Nat-A postrouting-s 192.168.1.0/24-O eth0-j snat -- To 61.99.28.1
3) DNAT: used for smart DNS.
Intelligent DNS: whether the client enters any IP address in the DNS entry, it will direct it to a dnsip specified by the server.
Before routing, all the packets destined for port 53 f
Iptables Introduction
Iptables is a core based firewall, very powerful, iptables built-in Filter,nat and mangle three tables.
Filter is responsible for filtering packets, including the chain of rules, input,output and forward;
NAT is concerned with network address translation, including the rule chain, prerouting,postrouting and output;
Mangle table is mainly
Land and application examples
#!/bin/sh
#
# Stone Licensing Country Small firewall set instruction draft
# 2002/8/27
# set by: Li Zhongxian (modified from iptables tutorial 1.1.11 by Oskar Andreasson)
# The original document is designed in accordance with the requirements of the DMZ, has been modified according to the needs of the campus NAT network, the remaining changes include:
# New communication Protocol definition block
# when new execution, aut
Your own example:-A input-s 192.168.28.68-p tcp--dport 1000-j ACCEPT172.168.XX.XX in the Internal network open 1000 this portIn any case, iptables is a need for special care to set up something, in the event that the server is not around you, and you rushed to set up to prevent SSH, then wait for the boss scold it, hehe ...The content is written to prevent this from happening, of course, it is very elementary, but the general server is enough:1. First
When a new Linux server is configured, if you need to configure iptables, you are typically configured with the following command:
First, install and start the firewall
[Root@linux ~]#/etc/init.d/iptables start
When we use Iptables to add rules, save, these rules to file the situation exists on disk, take CentOS as an example, the file address is/etc/sysconf
check on the chain is checked in order:1. The same rules match the scope of the small side above2. Different types of rules, the number of matches frequently on the side3. The default rules should be setVi. What is a table? TableEach function corresponds to a few chains, the chain is the table, the following is the four function table:
Filter
Input
Forward
Output
Nat
Prerouting
Output
Postrouting
m
For more information about IPTABLES configuration in linux-general Linux technology-Linux technology and application information, see the following. Simple Application of IPTABLES:
Iptables-a input-p tcp-s 10.1.2.187-j ACCEPT
Add 10.1.2.187 to the permitted range
Iptables-t nat-a postrouting-j SNAT -- to-source 10.1.
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.