LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 02:40 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
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 03:15 AM.
 
Old 11-30-2010, 09:51 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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, 01:30 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
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, 10:30 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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



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 08:33 PM
How to add user define services in RHEL 5 kalyanv Linux - Software 1 08-30-2008 12:55 PM
iptables bash script to add offending ip's to temporary chain NinjaGuru Programming 1 01-08-2008 10:05 AM
IPTABLES how to add/edit/delete rules in existing chain? debug019 Linux - Newbie 1 11-11-2004 02: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 10:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:29 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
Open Source Consulting | Domain Registration