LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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

Reply
 
Search this Thread
Old 08-25-2009, 08:39 AM   #1
muditcse@yahoo.com
LQ Newbie
 
Registered: Mar 2008
Posts: 22

Rep: Reputation: 15
Unhappy iptables script error


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
 
Old 08-25-2009, 09:11 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,117

Rep: Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455
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.
 
Old 08-25-2009, 09:27 AM   #3
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 285

Rep: Reputation: 61
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 09:35 AM.
 
  


Reply

Tags
error, iptables, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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-24-2008 11:39 PM
Iptables-restore +script error: bad argument COMMIT xorl Linux - Server 4 06-24-2007 09:50 AM
error with script iptables:bad intereptor yousmg Linux - Security 2 05-14-2007 11:16 PM
iptables script error(?) 386 Linux - Networking 1 10-08-2005 01: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 07:36 AM


All times are GMT -5. The time now is 05:02 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration