A – All source
I – INPUT
s – Source
j – jump on
Procedure:
For Example: If you want to check IP 49.248.23.83 is blocked or not then fire command
iptables -nL | grep 49.248.23.83
You can see the result as below
Which means IP is blocked To unblock that IP address use following command:
DROP all — 49.248.23.83 0.0.0.0/0
DROP all — 0.0.0.0/0 49.248.23.83
To Block back an IP Address:
iptables -I INPUT -s 49.248.23.83 -j ACCEPT
iptables -A INPUT -d 49.248.23.83 -j DROP
After adding or removing ips from iptables you need to save iptable rule using following command.
service iptables save
To allow PORT in iptables you have to follow below commands Exact meaning of an options which uses in the commandservice iptables restart
=====================================
p – protocol dport – destination port
j – jump on
=====================================
To drop (block) port in iptables you have to follow below commands:
iptables -I INPUT -p tcp –dport 2082 -j ACCEPTiptables -I INPUT -p udp –dport 2082 -j ACCEPT
iptables -I OUTPUT -p tcp –dport 2082 -j ACCEPT
iptables -I OUTPUT -p udp –dport 2082 -j ACCEPT
After adding or removing iptables you need to save iptable rule using following command.iptables -I INPUT -p tcp –dport 2082 -j DROP
iptables -I INPUT -p udp –dport 2082 -j DROP
iptables -I OUTPUT -p tcp –dport 2082 -j DROP
iptables -I OUTPUT -p udp –dport 2082 -j DROP
- service iptables save
- service iptables restart
iptables -A INPUT -p tcp –destination-port 1568:1570 -j ACCEPT iptables -A OUTPUT -p tcp –source-port 1568:1570 -j ACCEPT
- service iptables save
- service iptables restart
No comments:
Post a Comment