Before using commands for opening the port please make sure the specific port is already opened and what is the use of that port.
you can verify the port with
# netstat -nap | grep :
1.you can open OR block TCp port with following syntax
iptables -A INPUT -p tcp –dport -j ACCEPT
iptables -A INPUT -p tcp –dport -j DROP - to block the port
2. You can open UDP port with
iptables -A INPUT -p udp –sport -j ACCEPT
iptables -A INPUT -p udp –sport -j DROP - to block the port
after that
3 service iptables save
To allow or block IPs:
iptables -A INPUT -s -j ACCEPT
iptables -A INPUT -s -j DROP - to block the IP
Make sure to save IPtables if you did changes in IPtables
Usefull Options
Either long or short options are allowed.
--append -A chain Append to chain
--delete -D chain Delete matching rule from chain
--delete -D chain rulenum
Delete rule rulenum (1 = first) from chain
--insert -I chain [rulenum]
Insert in chain as rulenum (default 1=first)
--replace -R chain rulenum
Replace rule rulenum (1 = first) in chain
--list -L [chain] List the rules in a chain or all chains
--flush -F [chain] Delete all rules in chain or all chains
--zero -Z [chain] Zero counters in chain or all chains
--new -N chain Create a new user-defined chain
--delete-chain
-X [chain] Delete a user-defined chain
--policy -P chain target
Change policy on chain to target
service iptables save - To save IPtables
service iptables restart - To restart the IPtables firewall.
Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar
Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar
No comments:
Post a Comment