IPtables:
Exact meaning of an option which are used in iptable command:————–
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 blockedTo 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
service iptables restartTo allow PORT in iptables you have to follow below commandsExact meaning of an options which uses in the command
=====================================
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
iptables -I INPUT -p tcp –dport 2082 -j DROPiptables -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
After adding or removing iptables you need to save iptable rule using following command.
- service iptables save
- service iptables restart
iptables -A INPUT -p tcp –destination-port 1568:1570 -j ACCEPTiptables -A OUTPUT -p tcp –source-port 1568:1570 -j ACCEPT
- service iptables save
- service iptables restart