Networking Forums

Networking Forums > Computer Networking > Linux Networking > need help on port forward using iptables.

Reply
Thread Tools Display Modes

need help on port forward using iptables.

 
 
jsuthan
Guest
Posts: n/a

 
      01-16-2006, 11:00 AM
Hi,

I trying to port forwarding between internet and internal server. Here
is how my network configured:


----[ internet_ip ]-----> 172.16.1.10 [gateway] ---> 192.168.1.10
port 9009 -------------> port 20

I hv used this configuration but not working

iptables -t nat -A PREROUTING -p tcp -i eth1 -d 172.16.1.10 --dport 9009
-j DNAT --to 192.168.1.10:20
iptables -A FORWARD -p tcp -i eth1 -d 192.168.1.10 --dport 20 -j ACCEPT


I try to connect to port via telnet and there is no open port:
telnet 172.16.1.10 9009


--
jsuthan
Zues linux team
http://www.mypulau.com
 
Reply With Quote
 
 
 
 
jsuthan
Guest
Posts: n/a

 
      01-16-2006, 11:23 AM
jsuthan wrote:
> Hi,
>
> I trying to port forwarding between internet and internal server. Here
> is how my network configured:
>
>
> ----[ internet_ip ]-----> 172.16.1.10 [gateway] ---> 192.168.1.10
> port 9009 -------------> port 20
>
> I hv used this configuration but not working
>
> iptables -t nat -A PREROUTING -p tcp -i eth1 -d 172.16.1.10 --dport 9009
> -j DNAT --to 192.168.1.10:20
> iptables -A FORWARD -p tcp -i eth1 -d 192.168.1.10 --dport 20 -j ACCEPT
>
>
> I try to connect to port via telnet and there is no open port:
> telnet 172.16.1.10 9009
>
>


ops addon...

i try to connect from 172.16.1.10 to 192.168.1.10 and not from internet_ip.

--
jsuthan
Zues linux team
http://www.mypulau.com
 
Reply With Quote
 
Robert
Guest
Posts: n/a

 
      01-16-2006, 09:52 PM
On Mon, 16 Jan 2006 20:23:28 +0800, jsuthan wrote:

> jsuthan wrote:
>> Hi,
>>
>> I trying to port forwarding between internet and internal server. Here
>> is how my network configured:
>>
>> ----[ internet_ip ]-----> 172.16.1.10 [gateway] ---> 192.168.1.10
>>
>> I hv used this configuration but not working
>>
>> iptables -t nat -A PREROUTING -p tcp -i eth1 -d 172.16.1.10 --dport 9009
>> -j DNAT --to 192.168.1.10:20
>> iptables -A FORWARD -p tcp -i eth1 -d 192.168.1.10 --dport 20 -j ACCEPT
>>
>> I try to connect to port via telnet and there is no open port:
>> telnet 172.16.1.10 9009
>>

>
> ops addon...
>
> i try to connect from 172.16.1.10 to 192.168.1.10 and not from internet_ip.


Is the App that you want to connect to from the internet even listening on
port 20?


--

Regards
Robert

Smile... it increases your face value!


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
jsuthan
Guest
Posts: n/a

 
      01-17-2006, 11:09 AM
Robert wrote:
> On Mon, 16 Jan 2006 20:23:28 +0800, jsuthan wrote:
>
>
>>jsuthan wrote:
>>
>>>Hi,
>>>
>>>I trying to port forwarding between internet and internal server. Here
>>>is how my network configured:
>>>
>>>----[ internet_ip ]-----> 172.16.1.10 [gateway] ---> 192.168.1.10
>>>
>>>I hv used this configuration but not working
>>>
>>>iptables -t nat -A PREROUTING -p tcp -i eth1 -d 172.16.1.10 --dport 9009
>>>-j DNAT --to 192.168.1.10:20
>>>iptables -A FORWARD -p tcp -i eth1 -d 192.168.1.10 --dport 20 -j ACCEPT
>>>
>>>I try to connect to port via telnet and there is no open port:
>>>telnet 172.16.1.10 9009
>>>

>>
>>ops addon...
>>
>>i try to connect from 172.16.1.10 to 192.168.1.10 and not from internet_ip.

>
>
> Is the App that you want to connect to from the internet even listening on
> port 20?
>
>


The port is open at 192.168.1.10 port 20 and not at 172.16.1.10. I try
to connect from 172.16.1.10 and not from internet_ip.

--
jsuthan
Zues linux team
http://www.mypulau.com
 
Reply With Quote
 
Robert
Guest
Posts: n/a

 
      01-20-2006, 11:18 PM
On Tue, 17 Jan 2006 20:09:51 +0800, jsuthan wrote:

>> Is the App that you want to connect to from the internet even listening on
>> port 20?

>
> The port is open at 192.168.1.10 port 20 and not at 172.16.1.10. I try
> to connect from 172.16.1.10 and not from internet_ip.


So how are you trying to connect? What command/s are you giving/using?


--

Regards
Robert

Smile... it increases your face value!


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
edd
Guest
Posts: n/a

 
      01-20-2006, 11:54 PM
Robert wrote:
> On Tue, 17 Jan 2006 20:09:51 +0800, jsuthan wrote:
>
>>> Is the App that you want to connect to from the internet even listening on
>>> port 20?

>> The port is open at 192.168.1.10 port 20 and not at 172.16.1.10. I try
>> to connect from 172.16.1.10 and not from internet_ip.

>
> So how are you trying to connect? What command/s are you giving/using?
>
>

google it :P or read the manual
 
Reply With Quote
 
jsuthan
Guest
Posts: n/a

 
      01-21-2006, 01:52 AM
edd wrote:
> Robert wrote:
>
>> On Tue, 17 Jan 2006 20:09:51 +0800, jsuthan wrote:
>>
>>>> Is the App that you want to connect to from the internet even
>>>> listening on
>>>> port 20?
>>>
>>> The port is open at 192.168.1.10 port 20 and not at 172.16.1.10. I
>>> try to connect from 172.16.1.10 and not from internet_ip.

>>
>>
>> So how are you trying to connect? What command/s are you giving/using?
>>
>>

> google it :P or read the manual


well linux is good os.. problem is that I hv a complex firewall
configuration. I added that line at bottom while communication already
chopped off at top of iptables statement. I resolve it by adding a new
table for iptables.

iptables -N ript
for cif in $slan
do
for port in $sport
do
iptables -A ript -i eth0 -p tcp -s $cif -d $ipwan --dport $port -j ACCEPT
iptables -A ript -i eth0 -p udp -s $cif -d $ipwan --dport $port -j ACCEPT
done
iptables -A ript -i eth0 -s $cif -d $localnet -j DROP
iptables -A ript -i eth0 -s $cif -d $everywhere -j ACCEPT
done


then inject this new table after passing filtering and tweaking.

--
jsuthan
Zues linux team
http://www.mypulau.com
 
Reply With Quote
 
jsuthan
Guest
Posts: n/a

 
      01-21-2006, 01:53 AM
Robert wrote:
> On Tue, 17 Jan 2006 20:09:51 +0800, jsuthan wrote:
>
>
>>>Is the App that you want to connect to from the internet even listening on
>>>port 20?

>>
>>The port is open at 192.168.1.10 port 20 and not at 172.16.1.10. I try
>>to connect from 172.16.1.10 and not from internet_ip.

>
>
> So how are you trying to connect? What command/s are you giving/using?
>
>


to test communication I use telnet.

--
jsuthan
Zues linux team
http://www.mypulau.com
 
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 port forward question Ken Williams Linux Networking 2 07-21-2006 08:55 PM
iptables forward to local different port Ross Linux Networking 13 06-17-2006 12:32 PM
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
iptables: mac-source and FORWARD zacWonder Linux Networking 1 11-28-2003 03:14 PM
iptables - url forward soraya soch Linux Networking 0 11-02-2003 09:40 AM



1 2 3 4 5 6 7 8 9 10 11