Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables add rule case

Reply
Thread Tools Display Modes

iptables add rule case

 
 
jeniffer
Guest
Posts: n/a

 
      11-06-2006, 10:57 AM
The man page of iptables says in the explanation to add a rule (-A)
that "When the source and/or destination names resolve to more than
one address, a rule will be added for each possible address
combination" ...Can anyone please give an example of this type of a
rule? When will this condition be true?

 
Reply With Quote
 
 
 
 
Pascal Hambourg
Guest
Posts: n/a

 
      11-06-2006, 11:42 AM
Hello,

jeniffer a écrit :
> The man page of iptables says in the explanation to add a rule (-A)
> that "When the source and/or destination names resolve to more than
> one address, a rule will be added for each possible address
> combination" ...


Yes.

>Can anyone please give an example of this type of a rule?


# host security.debian.org
security.debian.org has address 128.101.240.212
security.debian.org has address 212.211.132.32
security.debian.org has address 212.211.132.250
# iptables -N dummy
# iptables -A dummy -s security.debian.org
# iptables -L dummy
Chain dummy (0 references)
target prot opt source destination
all -- 212.211.132.250 0.0.0.0/0
all -- 128.101.240.212 0.0.0.0/0
all -- 212.211.132.32 0.0.0.0/0

> When will this condition be true?


Which condition ?
 
Reply With Quote
 
Llanzlan Klazmon the 15th
Guest
Posts: n/a

 
      11-07-2006, 12:09 AM
"jeniffer" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) ups.com:

> The man page of iptables says in the explanation to add a rule (-A)
> that "When the source and/or destination names resolve to more than
> one address, a rule will be added for each possible address
> combination" ...Can anyone please give an example of this type of a
> rule? When will this condition be true?
>


I presume that the DNS server has multiple A records for the same name.
Ditto if the names are being resolved via a host file a name can resolve to
multiple ip addresses.

Klamzon.
 
Reply With Quote
 
jeniffer
Guest
Posts: n/a

 
      11-07-2006, 03:12 AM

Pascal Hambourg wrote:
> Hello,
>
> jeniffer a écrit :
> > The man page of iptables says in the explanation to add a rule (-A)
> > that "When the source and/or destination names resolve to more than
> > one address, a rule will be added for each possible address
> > combination" ...

>
> Yes.
>
> >Can anyone please give an example of this type of a rule?

>
> # host security.debian.org
> security.debian.org has address 128.101.240.212
> security.debian.org has address 212.211.132.32
> security.debian.org has address 212.211.132.250
> # iptables -N dummy
> # iptables -A dummy -s security.debian.org
> # iptables -L dummy
> Chain dummy (0 references)
> target prot opt source destination
> all -- 212.211.132.250 0.0.0.0/0
> all -- 128.101.240.212 0.0.0.0/0
> all -- 212.211.132.32 0.0.0.0/0
>
> > When will this condition be true?

>
> Which condition ?



Thanks for the answer.I understood that if names resolve to multiple IP
addresses then number of rules that will be added would be more than
1.Is this the only case (-s hostname/-d hostname) when multiple rules
are added for a single rule?

 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      11-07-2006, 09:35 AM
jeniffer a écrit :
>
> Thanks for the answer.I understood that if names resolve to multiple IP
> addresses then number of rules that will be added would be more than 1.


You understood well. In my example the source hostname resolves to three
IP addresses, and the iptables command created three rules.

>Is this the only case (-s hostname/-d hostname) when multiple rules
> are added for a single rule?


There is no other case I can think of. You cannot use hostnames in
DNAT/SNAT targets. However I don't know what would happen when you use a
service name in --sport or --dport which "resolves" to more than one
port number in /etc/services (is this legal ?).
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables rule Bonno Bloksma Linux Networking 6 03-06-2010 10:48 PM
iptables: rule with RETURN target just after a rule with ACCEPT target Neroku Linux Networking 0 04-25-2007 08:13 AM
iptables: rule with RETURN target after a rule with the ACCEPT target Neroku Linux Networking 0 04-24-2007 08:43 PM
Iptables rule ID drg Linux Networking 3 02-22-2006 02:24 AM
iptables rule problems Kauna Linux Networking 1 10-14-2003 01:39 PM



1 2 3 4 5 6 7 8 9 10 11