iptables - most easy way to find rule and remove it?


 
Thread Tools Search this Thread
Special Forums IP Networking iptables - most easy way to find rule and remove it?
# 1  
Old 08-14-2011
iptables - most easy way to find rule and remove it?

I have situation where I have rules in iptables with comments. Now... I can for example enter rule like "iptables -A FORWARD -s xxx -j ACCEPT" and delete it with "iptables -D FORWARD -s xxx -j ACCEPT".. but if that rule contain some random comment (-m comment) then ... ? I can find with scripting --line-numbers and remove line number, but there is race thing if something is inserted with "-I" meanwhile.... Anyone cares to suggest something?
# 2  
Old 08-14-2011
See if this helps, you can edit the /etc/sysconfig/iptables file, vi the file and remove the rules you don't need.

Save the file and don't forget to do "service iptables restart" Smilie.
# 3  
Old 08-15-2011
this is slackware.. Smilie no such file exists... and iptables cannot just be restarted Smilie also it's not what I need.. I need to do it on-fly ... as this is for captive portal.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash to remove find and remove specific extension

The bash below executes and does find all the .bam files in each R_2019 folder. However set -x shows that the .bam extension only gets removed from one .bam file in each folder (appears to be the last in each). Why is it not removing the extension from each (this is $SAMPLE)? Thank you :). set... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. UNIX for Dummies Questions & Answers

iptables rule to block access from VM Browser to Firewall Login Page

(1 Reply)
Discussion started by: senrabdet
1 Replies

3. Cybersecurity

iptables rule sanity check?

why would: iptables -A INPUT -s 180.0.0.0/8 -j DROP along with /etc/hosts.deny rule of ALL: 180.0.0.0/8 not stop traffic to/from 180.x.x.x, which I still see by running iftop? Or could iftop just be showing an artifact and is there a better way to monitor connections real-time? (3 Replies)
Discussion started by: unclecameron
3 Replies

4. Shell Programming and Scripting

Help using variable in find rule

I'm not able to use a variable in my find rule. It's essentially being ignored. I'm trying to store a list of file types to ignore in a variable. This is the relevant code. #!/bin/ksh EXCEPTIONS='-not -name "*.xom" -a -not -name "*.sh" -a -not -name "*.pl"' /usr/local/bin/find... (9 Replies)
Discussion started by: skwyer
9 Replies

5. Solaris

Jumpstart -- Warning: Could not find matching rule in rules.ok

I just setup a new jumpstart server, and I'm having problems with rules.ok errors. I'm coming up blank after many Google searches, forum searches, etc..... This is the error I receive: Skipped interface e1000g1 Attempting to configure interface e1000g0... Configured interface e1000g0... (0 Replies)
Discussion started by: christr
0 Replies

6. Linux

iptables rule problem

Hi, i have 40 client's in my network, that connected to internet via squid server (WebProxy). i want none of these client can't ping my squid server bat squid server can ping them.i wrote these rules but it is'nt work. iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -A INPUT -p... (1 Reply)
Discussion started by: skynet_boy
1 Replies

7. UNIX for Dummies Questions & Answers

Easy Script, just to find the given username if is it online or not

hey guys plz help me..with shell script. i must find the given(the user types a username) username if is it login or not.. i know how to do it logically, but i think that i can't in scripting. Thank you all (5 Replies)
Discussion started by: aintour
5 Replies

8. UNIX for Advanced & Expert Users

iptables rule to block ping to internet

I want to block ping on a linuxbox to any other address where it would go to the default gateway. vmdebianamd64:/etc/tcng# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 198.9.200.0 * 255.255.255.0 U 0 ... (1 Reply)
Discussion started by: progressdll
1 Replies

9. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies
Login or Register to Ask a Question