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