Skip to contentSkip to conversation

newbie question

DISCUSSION M. Ahmad Ijaz 6 participants 13 messages Apr 8, 2004 – Apr 9, 2004

lore
Share & tools
lore
#0 lore raw

hi,

I just wanna know few things , i have installed red hat 9, iptable is installed.

Now the thing is, i didnt know at first that i have to load the modules, i was getting the message

iptables: No chain/target/match by that name

so after couple of searches i did find some help and i manage to apply few commands i.e.

modprobe ip_tables
modprobe ip_conntrack
modprobe iptable_nat
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -p icmp --icmp-type 8 -j DROP

all the above commands are accepted at command prompt, but when i try to use this command

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e.
iptables: No chain/target/match by that name

So it also give the same message with POSTROUTING.

also i dont wana load the modules and the commands each time the system starts, so when i type the commands i used iptables-save command to save tat, also is there ne possibility where i can store the command and execute when system startsup

#1 lore raw
Quoted 9 lines · M. Ahmad Ijaz

when i try to use this command

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e. iptables: No chain/target/match by that name

So it also give the same message with POSTROUTING.

You need a "-t nat" in there, to tell it the rule is going into the nat table of the PREROUTING chain, not the filter table (which is the default, but does not exist in PREROUTING).

Regards,

Antony.

Signature · 4 lines
People who use Microsoft software should be certified.

                                                     Please reply to the list;
                                                           please don't CC me.
#2 lore raw

do i know where to put that "-t nat"
iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m
tcp --dport 80 -j REDIRECT --to-ports 8080

----- Original Message -----
From: "Antony Stone" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 08, 2004 5:02 PM
Subject: Re: newbie question

Quoted 7 lines · M. Ahmad Ijaz
Quoted 6 lines

when i try to use this command

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

Quoted 6 lines
Quoted 4 lines

where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e. iptables: No chain/target/match by that name

So it also give the same message with POSTROUTING.

You need a "-t nat" in there, to tell it the rule is going into the nat

table

Quoted 1 line

of the PREROUTING chain, not the filter table (which is the default, but

does

Quoted 10 lines

not exist in PREROUTING).

Regards,

Antony.

Signature · 3 lines
People who use Microsoft software should be certified.

                                                     Please reply to the

list;

Quoted 1 line

please don't CC

me.

Quoted 1 line
#3 lore raw
Quoted 3 lines · M. Ahmad Ijaz

do i know where to put that "-t nat"
iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m
tcp --dport 80 -j REDIRECT --to-ports 8080

I don't know - do you? I'll assume that you don't, since you've asked us...

My preference is to place it after the chain name:

iptables -A PREROUTING -t nat -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

However other people sometimes place it before.

Regards,

Antony.

Signature · 6 lines
If you want to be happy for an hour, get drunk.
If you want to be happy for a year, get married.
If you want to be happy for a lifetime, get a garden.

                                                     Please reply to the list;
                                                           please don't CC me.
#4 lore raw
In reply to M. Ahmad Ijaz

iptables -t nat -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

Quoted 66 lines · M. Ahmad Ijaz

do i know where to put that "-t nat"
iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

----- Original Message -----
From: "Antony Stone" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 08, 2004 5:02 PM
Subject: Re: newbie question

Quoted 9 lines · M. Ahmad Ijaz
Quoted 8 lines

when i try to use this command

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

Quoted 9 lines
Quoted 6 lines

where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e. iptables: No chain/target/match by that name

So it also give the same message with POSTROUTING.

You need a "-t nat" in there, to tell it the rule is going into the nat

table

Quoted 3 lines

of the PREROUTING chain, not the filter table (which is the default, but

does

Quoted 12 lines

not exist in PREROUTING).

Regards,

Antony.

Signature · 3 lines
People who use Microsoft software should be certified.

                                                    Please reply to the

list;

Quoted 3 lines

please don't CC

me.

#5 lore raw
In reply to Antony Stone

Hey Antony,

I just wanted to take a minute to say 'Thanks' for all the time you put in answering questions on this list. You probably help 10-15 people a day and while many thank you for your help, I want to say thanks for those of us who just listen in. I know that at least once a week I read one of your postings and think 'hmmm, I didn't know that'. Those postings get printed and added to my netfilter reference folder. You are a valuable asset to the list and I appreciate your effort. Thanks from all of us.

Jeff

#6 lore raw
Quoted 6 lines · Jeffrey Laramie

Hey Antony,

I just wanted to take a minute to say 'Thanks' for all the time you put in answering questions on this list. You probably help 10-15 people a day and while many thank you for your help, I want to say thanks for those of us who just listen in.

Hey, thanks, it's nice to remember that there's a lot more people on this list than just those who post (questions or answers).

Quoted 2 lines

I know that at least once a week I read one of your postings and think 'hmmm, I didn't know that'.

Good - in that case I'm doing a useful job :) If I were posting replies
which people thought "yes, I knew that - why didn't the questioner just look it up in a tutorial somewhere", then I'd probably just start saying "RTFM" or posting hyperlinks instead of explaining my answers.

Quoted 3 lines

Those postings get printed and added to my netfilter reference folder. You are a valuable asset to the list and I appreciate your effort. Thanks from all of us.

Thank you. I regard netfilter as a great system, and it's just my way of
putting something back into Open Source.

Regards,

Antony.

Signature · 3 lines
G- GIT/E d- s+:--(-) a+ C++++$ UL++++$ P+(---)>++ L+++(++++)$ !E W(-) N(-) o? 
w-- O !M V+++(--) !PS !PE Y+ PGP+> t- tv@ b+++ DI++ D--- e++>+++ h++ r@? 5? 
!X- !R K--?
#7 lore raw

[OT] about this list (was: newbie question)

* Antony Stone <[email protected]> 8. Apr 04:

Quoted 4 lines · Jeffrey Laramie
Quoted 1 line

[thanks to Antony]

Hey, thanks, it's nice to remember that there's a lot more people on this list than just those who post (questions or answers).

I totally agree to Jeffrey. And I really admire your patience. Unfortunatelly I don't have it.

Quoted 3 lines

Good - in that case I'm doing a useful job :) If I were posting replies
which people thought "yes, I knew that - why didn't the questioner just look it up in a tutorial somewhere",

This list has (IMHO) three 'problems' (this is one of it):

1. There are a lot of 'bad' questition/postings, like "This is my script (200+ lines), it doesn't work, what's wrong?" I would never answer something like this. Many problems are very bad described. (I had some mails offlist with somebody from this list. But after about three mails to and from I still had no idea about the problem. So I gave up.)

2. Additionally most of the questions could be answered with 'RTFM', a -j LOG at a proper place, a 'watch -d iptables -t $table -nvxL $chain' and/or a tcpdump. (Maybe I should write a mini-howto-debug-iptables?)

3. And finally, these very few interesting postings left from this stuff are answerd by Antony in a blink of an eye. (Hey, notice the ticks around the word 'problem'.)

Quoted 2 lines

I regard netfilter as a great system, and it's just my way of putting something back into Open Source.

This is very noble trait. I started a lot of mails and finally deleted them. They looked like <[email protected]> (but less polite).

Thanks for your work,
regards, Frank.

Signature · 1 line
Sigmentation fault
#8 lore raw

Re: [OT] about this list

Quoted 10 lines · Frank Gruellich

This list has (IMHO) three 'problems' (this is one of it):

1. There are a lot of 'bad' questition/postings, like "This is my script (200+ lines), it doesn't work, what's wrong?"

2. Additionally most of the questions could be answered with 'RTFM'

3. And finally, these very few interesting postings left from this stuff are answerd by Antony in a blink of an eye. (Hey, notice the ticks around the word 'problem'.)

Okay, maybe I'll try answering questions differently, perhaps:

1. "Reduce your ruleset to the minimum rules which still show the problem, and then if you still have the problem, ask again."

2. RTFM (if I'm feeling kind, I'll suggest which FM to R).

3. I'll get back to you tomorrow.

Have a good Easter, folks :)

Regards,

Antony.

Signature · 6 lines
Anything that improbable is effectively impossible.

 - Murray Gell-Mann, Nobel Prizewinner in Physics

                                                     Please reply to the list;
                                                           please don't CC me.
#9 lore raw

Re: [OT] about this list (was: newbie question)

In reply to Frank Gruellich
Quoted 22 lines · Frank Gruellich

* Antony Stone <[email protected]> 8. Apr 04:

Quoted 5 lines · Jeffrey Laramie
Quoted 1 line

[thanks to Antony]

Hey, thanks, it's nice to remember that there's a lot more people on this list than just those who post (questions or answers).

I totally agree to Jeffrey. And I really admire your patience. Unfortunatelly I don't have it.

Quoted 3 lines

Good - in that case I'm doing a useful job :) If I were posting replies
which people thought "yes, I knew that - why didn't the questioner just look it up in a tutorial somewhere",

This list has (IMHO) three 'problems' (this is one of it):

1. There are a lot of 'bad' questition/postings, like "This is my script (200+ lines), it doesn't work, what's wrong?" I would never answer something like this. Many problems are very bad described. (I had some mails offlist with somebody from this list. But after about three mails to and from I still had no idea about the problem. So I gave up.)

Quoted 3 lines

2. Additionally most of the questions could be answered with 'RTFM', a -j LOG at a proper place, a 'watch -d iptables -t $table -nvxL $chain' and/or a tcpdump. (Maybe I should write a mini-howto-debug-iptables?)

Awhile back I wrote down some mailing list guidelines which might be useful to newbies or others who are not mailing list 'regulars'. I normally wouldn't re-post something like this, but in the context of this thread I think helping people write effective postings is the best way to do something nice for Antony and the others who post here regularly.

http://www.ubaight.com/JeffsRules.html

Feel free to reuse, copy, edit, link to 'Jeffs Rules' as you see fit. I welcome any suggestions for addtions or changes; please send them to me directly off list. Again, thanks to Antony and all the others who spend their time helping others.

Jeff

#10 lore raw
In reply to M. Ahmad Ijaz

* M. Ahmad Ijaz <[email protected]> 8. Apr 04:

Quoted 1 line

hi,

Hello,

Quoted 11 lines

modprobe ip_tables
modprobe ip_conntrack
modprobe iptable_nat
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -p icmp --icmp-type 8 -j DROP

Quoted 4 lines

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e. iptables: No chain/target/match by that name

Try

# iptables -t nat -A PREROUTING ...

Rules go into the filter table by default, if not specified otherwise, but filter has not {PRE,POST}ROUTING.

Quoted 4 lines

also i dont wana load the modules and the commands each time the system starts, so when i type the commands i used iptables-save command to save tat, also is there ne possibility where i can store the command and execute when system startsup

As a script somewhere in /etc/init.d/ and a symlink in /etc/rc.$defaultrunlevel/.

HTH,
regards, Frank.

Signature · 1 line
Sigmentation fault
#11 lore raw

thanks for ur reply n the 1st portion is solved, its now working

I typed all the commands on root and afterwards used

iptables-save

command to commit, but when i restarted the system and used this command

iptables -L

it shows no rules. So how to accomplish this. Also quite frankly i didnt get it

Quoted 2 lines

As a script somewhere in /etc/init.d/ and a symlink in /etc/rc.$defaultrunlevel/.

can you please tell me how to do it , as i m new to it.

Regards.
Aejaz

----- Original Message -----
From: "Frank Gruellich" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 08, 2004 5:09 PM
Subject: Re: newbie question

Quoted 17 lines

* M. Ahmad Ijaz <[email protected]> 8. Apr 04:

Quoted 1 line

hi,

Hello,

Quoted 12 lines

modprobe ip_tables
modprobe ip_conntrack
modprobe iptable_nat
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -p icmp --icmp-type 8 -j DROP

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m

tcp --dport 80 -j REDIRECT --to-ports 8080

Quoted 24 lines
Quoted 3 lines

where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e. iptables: No chain/target/match by that name

Try

# iptables -t nat -A PREROUTING ...

Rules go into the filter table by default, if not specified otherwise, but filter has not {PRE,POST}ROUTING.

Quoted 4 lines

also i dont wana load the modules and the commands each time the system starts, so when i type the commands i used iptables-save command to save tat, also is there ne possibility where i can store the command and execute when system startsup

As a script somewhere in /etc/init.d/ and a symlink in /etc/rc.$defaultrunlevel/.

HTH,
regards, Frank.

Signature · 1 line
Sigmentation fault
#12 lore raw
In reply to M. Ahmad Ijaz

you must specify the table.

with -t modif
----- Original Message -----
From: M. Ahmad Ijaz
To: [email protected]
Sent: Thursday, April 08, 2004 8:57 AM
Subject: newbie question

hi,

I just wanna know few things , i have installed red hat 9, iptable is installed.

Now the thing is, i didnt know at first that i have to load the modules, i was getting the message

iptables: No chain/target/match by that name

so after couple of searches i did find some help and i manage to apply few commands i.e.

modprobe ip_tables
modprobe ip_conntrack
modprobe iptable_nat
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

  iptables -P INPUT ACCEPT
  iptables -P OUTPUT ACCEPT
  iptables -P FORWARD DROP
  iptables -A INPUT -p icmp --icmp-type 8 -j DROP 

all the above commands are accepted at command prompt, but when i try to use this command

iptables -A PREROUTING -s xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 where xxx is any IP and yyy is the subnet mask, it returns me the same message i.e.
iptables: No chain/target/match by that name

So it also give the same message with POSTROUTING.

also i dont wana load the modules and the commands each time the system starts, so when i type the commands i used iptables-save command to save tat, also is there ne possibility where i can store the command and execute when system startsup