LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   IP Tables - help (https://www.linuxquestions.org/questions/linux-newbie-8/ip-tables-help-798070/)

myubuntu 03-26-2010 10:59 AM

IP Tables - help
 
Hi guys, I have added rule to REJECT tcp dport 22 & can you please let me know what rule I have to add to delete that particular "REJECT" rule, so that dport can be allowed. please let me know.
My current rule mentioned below..

Chain INPUT (policy DROP 73 packets, 4764 bytes)
pkts bytes target prot opt in out source destination
2 120 REJECT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 reject-with icmp-port-unreachable
0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
49 7874 ACCEPT tcp -- eth0 * 172.16.0.0/16 0.0.0.0/0
0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- eth0 * 172.16.0.0/16 0.0.0.0/0

HasC 03-26-2010 11:53 AM

What is the cmd you use to add the reject?
If you used something like this:
Code:

iptables -A INSERT -p tcp --dport 22 -j REJECT
to reverse/delete it you should use
Code:

iptables -D INSERT -p tcp --dport 22 -j REJECT
As you can see, the commands are almost exactly the same, except the "-A" (append) and "-D" (delete) switches

BlackHatRob 03-26-2010 12:56 PM

You can also do a iptables --list --line-numbers
Using this information you can do the following
iptables -D <chain> <line-number>

When you do, dont forget to save your chains :)


All times are GMT -5. The time now is 11:23 PM.