LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2010, 03:40 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Rep: Reputation: 31
How to add a rule in user define chain.


Hi,

I have created a new user define chain

# iptanles -N blacklist

Normally when we add a new rule it automatically insert in the default iptable but when we create a user define chain then how can I add my rules in this chain ?

2- How can i execute the user define chain ?

thanks in advance
garden

Last edited by gardenair; 11-30-2010 at 04:15 AM.
 
Old 11-30-2010, 10:51 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Basically you give the name of the chain as first argument with -A, -I and -R after that the rule contents you want to add, insert or replace. See 'man iptables'.
 
Old 12-01-2010, 02:30 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
Thanks unSpawn for the reply. well if you kindly write a simple example then it will be clear for me to understand. According to my understand i did as following

Code:
# iptables -t blacklist -A INPUT -s 192.168.1.10 -j drop
but this does't accept by the kernel.I know that it is wronge but what will be the valid rule ?
please guide me ,
thanks in advance.
 
Old 12-01-2010, 11:30 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
If you read 'man iptables' like I suggested then you'd see "-t" is for tables (see `cat /proc/net/ip_tables_names`) and usually that'll be "filter". In the "filter" table "INPUT" refers to one of the default chains. So you rule would become 'iptables -t filter -A blacklist -s 192.168.1.10 -j DROP'.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables chain rule specifation vlrk Linux - Newbie 1 12-04-2008 09:33 PM
How to add user define services in RHEL 5 kalyanv Linux - Software 1 08-30-2008 01:55 PM
iptables bash script to add offending ip's to temporary chain NinjaGuru Programming 1 01-08-2008 11:05 AM
IPTABLES how to add/edit/delete rules in existing chain? debug019 Linux - Newbie 1 11-11-2004 03:48 PM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 11:06 AM


All times are GMT -5. The time now is 10:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration