Iptables firewall rules to add, delete, modify, save

Source: Internet
Author: User
Tags iptables


Original link: http://www.splaybow.com/post/iptables-rule-add-delete-modify-save.html One, view rule set

Iptables–list-n//Plus one-n displays IP and port in digital form, it looks more comfortable. Configure default rules

Iptables-p INPUT DROP//Not allowed
Iptables-p FORWARD DROP//Do not allow forwarding
Iptables-p OUTPUT ACCEPT//Allow three, add rules

Iptables-a input-s 192.168.0.0/24-j ACCEPT
Allows the source IP address to be streamed into the 192.168.0.0/24 network segment (including all protocols, where a single IP is also specified)
Iptables-a input-d 192.168.0.22-j ACCEPT
Allow all IP to 192.168.0.22 access
Iptables-a input-p tcp–dport 80-j ACCEPT
Open native Port 80
Iptables-a input-p icmp–icmp-type echo-request-j ACCEPT
Open native ICMP protocol IV, delete rule

iptables-d input-s 192.168.0.21-j ACCEPT
Delete the first rule that you have just established v. the preservation of rules

Iptables-f
Clear the rule buffer (this operation will empty the above increment, if you want to keep the suggestion to execute the sentence first: Save)
Service Iptables Save
Save rules in/etc/sysconfig/iptables file
Service Iptables Restart
Restart the Iptables service

Finally, the iptables firewall configuration file is stored in:/etc/sysconfig/iptables

Original link: http://www.splaybow.com/post/iptables-rule-add-delete-modify-save.html

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.