LinuxQuestions.org
Have you listened to LQ Radio?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 08-25-2009, 09:39 AM   #1
muditcse@yahoo.com
LQ Newbie
 
Registered: Mar 2008
Posts: 22
Thanked: 0
Unhappy iptables script error


[Log in to get rid of this advertisement]
Hi,

I make a script as folows

#!/bin/bash

#mv ReservedUserIP.txt ReservedUserIPList.txt

exec < ReservedUserIPList.txt
IPT="/sbin/iptables"
DIP="172.20.128.88"
while read line
do
echo "I m Reading"
echo $line;
$IPT -I FORWARD 1 -s $line -d $DIP -j ACCEPT
done

errror:

I m Reading
10.203.176.230
' not found.3.5: host/network `10.203.176.230
Try `iptables -h' or 'iptables --help' for more information.

no clue why this error is coming.urgent help needed
windows_xp_2003 muditcse@yahoo.com is offline  
Tag This Post , ,
Reply With Quote
Old 08-25-2009, 10:11 AM   #2
TB0ne
Senior Member
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, Mandrake, RedHat, Gentoo, Slack
Posts: 4,072
Thanked: 143
Quote:
Originally Posted by muditcse@yahoo.com View Post
Hi,

I make a script as folows

#!/bin/bash

#mv ReservedUserIP.txt ReservedUserIPList.txt

exec < ReservedUserIPList.txt
IPT="/sbin/iptables"
DIP="172.20.128.88"
while read line
do
echo "I m Reading"
echo $line;
$IPT -I FORWARD 1 -s $line -d $DIP -j ACCEPT
done

errror:

I m Reading
10.203.176.230
' not found.3.5: host/network `10.203.176.230
Try `iptables -h' or 'iptables --help' for more information.

no clue why this error is coming.urgent help needed
Don't flag your posts as urgent, please.

The script line works fine on my system as you have it above, but you don't show us the input text file. Chances are, as the error says, you're getting some bad input, and IPtables is erroring out on it.
linuxsuse TB0ne is offline     Reply With Quote
Old 08-25-2009, 10:27 AM   #3
fpmurphy
Member
 
Registered: Jan 2009
Location: Florida
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 181
Thanked: 24
The problem is you're confusing iptables by giving it a non-IP address string. Try echoing each line of input with a guard character at each end.
Code:
echo "[$line]"
It this does not show up the problem, try
Code:
cat -vET ReservedUserIPList.txt

Last edited by fpmurphy; 08-25-2009 at 10:35 AM..
windows_vista fpmurphy is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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-save, iptables-restore, how to set up them in some script sarajevo Linux - Networking 1 03-25-2008 12:39 AM
Iptables-restore +script error: bad argument COMMIT xorl Linux - Server 4 06-24-2007 10:50 AM
error with script iptables:bad intereptor yousmg Linux - Security 2 05-15-2007 12:16 AM
iptables script error(?) 386 Linux - Networking 1 10-08-2005 02:56 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 08:36 AM


All times are GMT -5. The time now is 10:14 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration