Problem with port forwarding config (iptables)

This is a discussion on Problem with port forwarding config (iptables) within the Linux Networking forums, part of the Linux Forums category; Hi all, I'm trying to set up port forwarding for a webcam feed (using Windows Media Encoder 9) from ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-14-2007
Daryl
 
Posts: n/a
Default Problem with port forwarding config (iptables)

Hi all,

I'm trying to set up port forwarding for a webcam feed (using Windows
Media Encoder 9) from a computer inside my internal network. I can
connect to it directly from inside the network, but whenever I try to
connect to it through my router it doesn't connect (with Media Player
kicking back some "network error" message that isn't useful.

The iptables config in my router looks like this:

*nat
[...snippet...]
-A PREROUTING -p tcp -m tcp --dport 6666 -j DNAT --to-destination
192.168.10.20:8080

*filters
[...snippet...]
-A INPUT -p tcp -m tcp --dport 6666 -j ACCEPT


I have obviously not included most of my iptables file. If you need
anything else from it let me know -- or ask and I can tell you about
the config.

Now, when I access http://192.168.10.20:8080 through Windows Media
Player from inside the network I can see the feed. But when I access
it through http://myserver.com:6666 it continually fails to connect
(where my router is "myserver.com"; if I use its IP directly I get the
same error).

I would appreciate any help on this problem whatsoever. Thanks in
advance.

Reply With Quote
  #2 (permalink)  
Old 02-15-2007
Pascal Hambourg
 
Posts: n/a
Default Re: Problem with port forwarding config (iptables)

Hello,

Daryl a écrit :
>
> I'm trying to set up port forwarding for a webcam feed (using Windows
> Media Encoder 9) from a computer inside my internal network. I can
> connect to it directly from inside the network, but whenever I try to
> connect to it through my router it doesn't connect (with Media Player
> kicking back some "network error" message that isn't useful.
>
> The iptables config in my router looks like this:
>
> *nat
> [...snippet...]
> -A PREROUTING -p tcp -m tcp --dport 6666 -j DNAT --to-destination
> 192.168.10.20:8080
>
> *filters
> [...snippet...]
> -A INPUT -p tcp -m tcp --dport 6666 -j ACCEPT


Wrong rule. The correct rule must be in the FORWARD chain and match
destination port 8080 in order to catch the forwarded packets. Also,
matching on the destination address won't harm and will add some extra
security :

-A FORWARD -d 192.168.10.20 -p tcp -m tcp --dport 8080 -j ACCEPT

And of course you also need to accept the reply packets.

> Now, when I access http://192.168.10.20:8080 through Windows Media
> Player from inside the network I can see the feed. But when I access
> it through http://myserver.com:6666 it continually fails to connect
> (where my router is "myserver.com"; if I use its IP directly I get the
> same error).


From inside the network ? It's a common issue due to asymmetric routing
(NAT does not like it). Add the following rule to force reply packets
from the server to go back to the router and try again :

-A POSTROUTING -s 192.168.10.0/24 -d 192.168.10.20 \
-p tcp -m tcp --dport 8080 -j SNAT --to <router_lan_address>
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

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



All times are GMT +1. The time now is 08:59 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0