Error returned after rebooting after modifying iptables
This is how I changed vi / etc/sysconfig/iptables after adding rules to the firewall.
-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 21-j ACCEPT
Restart: / etc/init.d/iptables restart
Return value: Error occurred at line: 16
Try `iptables-restore-h' or 'iptables-restore-- help' for more information.
[FAILED]
Find a solution:
/ sbin/iptables-I INPUT-p tcp-- dport 21-j ACCEPT
/ etc/rc.d/init.d/iptables save
/ etc/init.d/iptables restart
Restart successfully: iptables: Setting chains to policy ACCEPT: filter [OK]
Iptables: Flushing firewall rules: [OK]
Iptables: Unloading modules: [OK]
Iptables: Applying firewall rules: [OK]
# the command to block a single IP is
Iptables-I INPUT-s 123.45.6.7-j DROP
# the command for the whole paragraph from 123.0.0.1 to 123.255.255.254
Iptables-I INPUT-s 123.0.0.0 iptables 8-j DROP
# IP paragraphs are commands from 123.45.0.1 to 123.45.255.254
Iptables-I INPUT-s 124.45.0.0 DROP 16-j
# commands for IP paragraphs from 123.45.6.1 to 123.45.6.254 are
Iptables-I INPUT-s 123.45.6.0 Universe 24-j DROP