Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables & variables

Reply
Thread Tools Display Modes

iptables & variables

 
 
toto19
Guest
Posts: n/a

 
      07-15-2003, 10:13 AM
Hello world,

well I'm doing iptables rules and I have a problem to specify several
ip adresses in a destination.

I've tried something like this but unsuccessfull.

INTDESTIP="10.0.0.1,10.0.0.2,10.0.0.3"

for IP in $INTDESTIP
do

/sbin/iptables -a OUTPUT -d $IP -m state --state NEW,ESTABLISHED -J
ACCEPT

done

And the script doesn't substitute well the $IP variable by the good
values.

The more surprising is that with several ports in a variable it rus
without problem.

Can you help me ?
 
Reply With Quote
 
 
 
 
Skull
Guest
Posts: n/a

 
      07-15-2003, 03:09 PM
Sgranocchiando il cranio di toto19, vi trovai inciso:


> INTDESTIP="10.0.0.1,10.0.0.2,10.0.0.3"


try writing this as

INTDESTIP="10.0.0.1 10.0.0.2 10.0.0.3"

--
Emanuele Balla aka Skull - Public Key #661E5CBF on www.keyserver.com
+----------------------------------------------------------------------+
"And 1.1.81 is officially BugFree(tm), so if you receive any bug-reports
on it, you know they are just evil lies." (By Linus Torvalds)
 
Reply With Quote
 
/dev/rob0
Guest
Posts: n/a

 
      07-15-2003, 04:08 PM
In article <(E-Mail Removed) >,
toto19 wrote:
> Hello world,


Hey I wrote a program to say that!

> well I'm doing iptables rules and I have a problem to specify several
> ip adresses in a destination.


This has nothing to do with iptables. It's sh (bash) scripting.

> I've tried something like this but unsuccessfull.
>
> INTDESTIP="10.0.0.1,10.0.0.2,10.0.0.3"


A comma (",") is not an appropriate word delimiter. See the IFS special
variable in "man bash". You *could* set it in $IFS, but ... don't. You
would break too many other things.
--
/dev/rob0 - preferred_email=i$((28*28+28))@softhome.net
or put "not-spam" or "/dev/rob0" in Subject header to reply
 
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
passing two variables with for loop Bartosz Wegrzyn Linux Networking 10 10-03-2005 04:48 AM
Looking for iptables applications code (iptables.c) to run some rules to forward packets tvnaidu@yahoo.com Linux Networking 2 01-17-2005 05:01 PM
Programatic monitoring of TCP variables Sam Windows Networking 1 10-10-2003 11:13 AM
iptables "can't initialize iptables table `filter'" pete Linux Networking 1 10-10-2003 03:44 AM
Environment Variables Matthew Windows Networking 0 07-27-2003 07:11 AM



1 2 3 4 5 6 7 8 9 10 11