Networking Forums

Networking Forums > Computer Networking > Linux Networking > What's wrong with this iptables command?

Reply
Thread Tools Display Modes

What's wrong with this iptables command?

 
 
Alec Waters
Guest
Posts: n/a

 
      11-14-2003, 11:54 AM
Hi all,

I'm trying to set up some port forwarding with iptables. I want all
traffic directed at eth0's IP address (the public interface) on tcp/8080
to be redirected to an internal host on the same port. Here's what I've got:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j DNAT --to
192.168.135.210:8080
iptables: Invalid argument

iptables is v1.2.8, Linux is 2.4.20. Which argument is invalid? What
have I done wrong?

thanks a lot,
alec
--

 
Reply With Quote
 
 
 
 
Walter Peters
Guest
Posts: n/a

 
      11-14-2003, 05:28 PM
Alec Waters wrote on 14.11.2003 13:54:


> Hi all,
>
> I'm trying to set up some port forwarding with iptables. I want all
> traffic directed at eth0's IP address (the public interface) on tcp/8080
> to be redirected to an internal host on the same port. Here's what I've
> got:
>
> iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j DNAT --to
> 192.168.135.210:8080
> iptables: Invalid argument
>
> iptables is v1.2.8, Linux is 2.4.20. Which argument is invalid? What
> have I done wrong?


Shouldn't this be "DNAT --to-destination" instead of "DNAT --to"?

--
Walter

 
Reply With Quote
 
remove dot
Guest
Posts: n/a

 
      11-17-2003, 11:10 AM
In article <3fb4d065$0$3148$(E-Mail Removed)>, Alec Waters <(E-Mail Removed)> wrote:
>Hi all,
>
>I'm trying to set up some port forwarding with iptables. I want all
>traffic directed at eth0's IP address (the public interface) on tcp/8080
>to be redirected to an internal host on the same port. Here's what I've got:
>
>iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j DNAT --to
>192.168.135.210:8080
>iptables: Invalid argument
>
>iptables is v1.2.8, Linux is 2.4.20. Which argument is invalid? What
>have I done wrong?
>


Not sure but have the same probnlem.
In my case kernel required recompliation in order to implement NAT. I suspect
iptables requiers recompliation too. Investigating.

j131
 
Reply With Quote
 
Dave {Reply Address in.sig}
Guest
Posts: n/a

 
      11-17-2003, 09:26 PM
In message <bpadrp$bpc$(E-Mail Removed)>, remove dot wrote:

> In article <3fb4d065$0$3148$(E-Mail Removed)>, Alec Waters
> <(E-Mail Removed)> wrote:
>>Hi all,
>>
>>I'm trying to set up some port forwarding with iptables. I want all
>>traffic directed at eth0's IP address (the public interface) on tcp/8080
>>to be redirected to an internal host on the same port. Here's what I've
>>got:
>>
>>iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j DNAT --to
>>192.168.135.210:8080
>>iptables: Invalid argument
>>
>>iptables is v1.2.8, Linux is 2.4.20. Which argument is invalid? What
>>have I done wrong?
>>

>
> Not sure but have the same probnlem.
> In my case kernel required recompliation in order to implement NAT. I
> suspect iptables requiers recompliation too. Investigating.
>

From the HOWTO:

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p tcp --dport 8080 -m state \
--state NEW,ESTABLISHED,RELATED -j ACCEPT

$IPTABLES -A PREROUTING -t nat -p tcp -d $EXTIP --dport 8080 \
-j DNAT --to $PORTFW:8080

You also need to sort out the return path with

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $EXTIP

The script variables are reasonably easy to work out, I think.

Dave
--
mail: da (E-Mail Removed) (without the space)
http://www.llondel.org/
So many gadgets, so little time...

 
Reply With Quote
 
remove dot
Guest
Posts: n/a

 
      11-18-2003, 07:53 AM
In article <bpadrp$bpc$(E-Mail Removed)>, (E-Mail Removed) (remove dot) wrote:
>In article <3fb4d065$0$3148$(E-Mail Removed)>, Alec Waters
> <(E-Mail Removed)> wrote:
>>Hi all,
>>
>>I'm trying to set up some port forwarding with iptables. I want all
>>traffic directed at eth0's IP address (the public interface) on tcp/8080
>>to be redirected to an internal host on the same port. Here's what I've got:
>>
>>iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j DNAT --to
>>192.168.135.210:8080
>>iptables: Invalid argument
>>
>>iptables is v1.2.8, Linux is 2.4.20. Which argument is invalid? What
>>have I done wrong?
>>

>
>Not sure but have the same probnlem.
>In my case kernel required recompliation in order to implement NAT. I suspect
>iptables requiers recompliation too. Investigating.
>


.. and confirming: after iptables recompilation with new kernel the "Invalid
argument" error is gone.

j131
 
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 command ignored? AAW Linux Networking 8 09-28-2007 10:11 PM
Questions related to iptables command jeniffer Linux Networking 5 11-08-2006 11:52 AM
what wrong with my iptables? nick Linux Networking 10 12-06-2005 07:48 PM
NAT FTP command port in pasive mode. What is wrong? ADAM Windows Networking 0 02-06-2004 09:53 PM
help with iptables command richard noel fell Linux Networking 3 09-26-2003 06:31 PM



1 2 3 4 5 6 7 8 9 10 11