Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Linux Networking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-16-2008, 08:40 PM
David Brown
 
Posts: n/a
Using hostnames in iptables

If I write an iptables rule with a hostname, when is the hostname
resolved? For example:

iptables -A INPUT -p tcp --src remoteoffice.company.com --dport 25 -j ACCEPT


I believe that "remoteoffice.company.com" is resolved at the time the
"iptables" statement is executed, rather than being stored in the chain
as a hostname and resolved when packets are checked. Can anyone confirm
that?

If I wanted to have such a rule for a hostname whose address changed
(say, a dynamic ADSL address), is there any way to do it?

mvh.,

David
Reply With Quote
  #2 (permalink)  
Old 03-16-2008, 11:55 PM
D. Stussy
 
Posts: n/a
Re: Using hostnames in iptables

"David Brown" <david.brown@hesbynett.removethisbit.no> wrote in message
news:47dd77b4$0$8159$8404b019@news.wineasy.se...
> If I write an iptables rule with a hostname, when is the hostname
> resolved? For example:
>
> iptables -A INPUT -p tcp --src remoteoffice.company.com --dport 25 -j

ACCEPT
>
>
> I believe that "remoteoffice.company.com" is resolved at the time the
> "iptables" statement is executed, rather than being stored in the chain
> as a hostname and resolved when packets are checked. Can anyone confirm
> that?


Correct. Resolved when the command is loaded.

Watch out for names that resolve to more than one address.


Reply With Quote
  #3 (permalink)  
Old 03-17-2008, 01:05 AM
David Brown
 
Posts: n/a
Re: Using hostnames in iptables

D. Stussy wrote:
> "David Brown" <david.brown@hesbynett.removethisbit.no> wrote in message
> news:47dd77b4$0$8159$8404b019@news.wineasy.se...
>> If I write an iptables rule with a hostname, when is the hostname
>> resolved? For example:
>>
>> iptables -A INPUT -p tcp --src remoteoffice.company.com --dport 25 -j

> ACCEPT
>>
>> I believe that "remoteoffice.company.com" is resolved at the time the
>> "iptables" statement is executed, rather than being stored in the chain
>> as a hostname and resolved when packets are checked. Can anyone confirm
>> that?

>
> Correct. Resolved when the command is loaded.
>
> Watch out for names that resolve to more than one address.
>


Thanks for confirming that for me. I'll only be using it for names that
I have control over and which will resolve to a single address. I
suppose that the most convenient way to update such rules when the ip
address changed would be to put them into a separate chain, which could
then be flushed and re-loaded without affecting other rules in the tables.

mvh.,

David


Reply With Quote
  #4 (permalink)  
Old 03-17-2008, 02:37 AM
D. Stussy
 
Posts: n/a
Re: Using hostnames in iptables

"David Brown" <david.brown@hesbynett.removethisbit.no> wrote in message
news:47ddb5ae$0$8161$8404b019@news.wineasy.se...
> D. Stussy wrote:
> > "David Brown" <david.brown@hesbynett.removethisbit.no> wrote in message
> > news:47dd77b4$0$8159$8404b019@news.wineasy.se...
> >> If I write an iptables rule with a hostname, when is the hostname
> >> resolved? For example:
> >>
> >> iptables -A INPUT -p tcp --src remoteoffice.company.com --dport 25 -j

ACCEPT
> >>
> >> I believe that "remoteoffice.company.com" is resolved at the time the
> >> "iptables" statement is executed, rather than being stored in the chain
> >> as a hostname and resolved when packets are checked. Can anyone

confirm
> >> that?

> >
> > Correct. Resolved when the command is loaded.
> >
> > Watch out for names that resolve to more than one address.

>
> Thanks for confirming that for me. I'll only be using it for names that
> I have control over and which will resolve to a single address. I
> suppose that the most convenient way to update such rules when the ip
> address changed would be to put them into a separate chain, which could
> then be flushed and re-loaded without affecting other rules in the tables.


If you're using a script to set up multiple rules for your own server, it's
better to use iptables-restore than individual iptables lines.



Reply With Quote
  #5 (permalink)  
Old 03-18-2008, 05:59 PM
Andrew Gideon
 
Posts: n/a
Re: Using hostnames in iptables

On Sun, 16 Mar 2008 17:37:54 -0800, D. Stussy wrote:

> If you're using a script to set up multiple rules for your own server,
> it's better to use iptables-restore than individual iptables lines.


Even where the actual change is a relatively small part of the set of all
rulesets? Is there some crossover point at which this isn't true, or is
it true regardless of how large the entire set and how small the changes?

- Andrew
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Linux Networking


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:15 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Credit Card | Nora Roberts | Divorce and Credit | Credit Card Debt Consolidation | Gas Suppliers



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114