Networking Forums

Networking Forums > Computer Networking > Linux Networking > port redirect not accepted?

Reply
Thread Tools Display Modes

port redirect not accepted?

 
 
Laurens
Guest
Posts: n/a

 
      03-18-2007, 05:54 PM
Hi all,

It must be simple what i want, but I just can't find it...
I'm using an ubuntu box with IPTables 1.3.3, which I manage through webmin.

I want to route all incoming connections to port 6603 to be redirected
to port 3306; all on the same machine.

I made a redirect for this which does just that, but now it still
doesn't accept it, because my default input rule is to DROP.
Now, I can open up port 3306 in the input-chain, then everything works
ok....but the problem is, it is just my point to NOT have that port open

I know, i could change my dbase port to 6603, but i prefer using
iptables. So, how can I make an input rule that will only accept for
redirected traffic?

Thnx in advance...

Laurens
 
Reply With Quote
 
 
 
 
Sir Jackery
Guest
Posts: n/a

 
      03-19-2007, 02:04 AM
On Sun, 18 Mar 2007, Laurens wrote:

> Hi all,
>
> It must be simple what i want, but I just can't find it...
> I'm using an ubuntu box with IPTables 1.3.3, which I manage through webmin.
>
> I want to route all incoming connections to port 6603 to be redirected to
> port 3306; all on the same machine.
>
> I made a redirect for this which does just that, but now it still doesn't
> accept it, because my default input rule is to DROP.
> Now, I can open up port 3306 in the input-chain, then everything works
> ok....but the problem is, it is just my point to NOT have that port open
>
> I know, i could change my dbase port to 6603, but i prefer using iptables.
> So, how can I make an input rule that will only accept for redirected
> traffic?
>
> Thnx in advance...
>
> Laurens
>



To tell you the truth I can't figure out what you are trying to do. If you
want to redirect incoming traffic to a different port, try this:

$IPT -t nat -I PREROUTING -p tcp -d IP.ADDR.OF.BOX --dport 6603 -i \
$EXTINT -j DNAT --to IP.ADDR.OF.BOX:3306

where $IPT is your iptables binary and $EXTINT is the interface you want
this rule to apply to. This also assumes you have a prerouting rule like:

$IPT -t nat -P PREROUTING ACCEPT

I am not familiar with the particular GUI configuration tool you are using
with your distribution of Linux but these iptables calls are
distro-independant.

If this doesn't answer your question please restate it more clearly and I
will see if I can offer some help.


--
Sir Jackery
 
Reply With Quote
 
Laurens
Guest
Posts: n/a

 
      03-19-2007, 10:45 AM
Sir Jackery wrote:
> On Sun, 18 Mar 2007, Laurens wrote:
>
>> Hi all,
>>
>> It must be simple what i want, but I just can't find it...
>> I'm using an ubuntu box with IPTables 1.3.3, which I manage through
>> webmin.
>>
>> I want to route all incoming connections to port 6603 to be redirected
>> to port 3306; all on the same machine.
>>
>> I made a redirect for this which does just that, but now it still
>> doesn't accept it, because my default input rule is to DROP.
>> Now, I can open up port 3306 in the input-chain, then everything works
>> ok....but the problem is, it is just my point to NOT have that port
>> open
>>
>> I know, i could change my dbase port to 6603, but i prefer using
>> iptables. So, how can I make an input rule that will only accept for
>> redirected traffic?
>>
>> Thnx in advance...
>>
>> Laurens
>>

>
>
> To tell you the truth I can't figure out what you are trying to do. If
> you want to redirect incoming traffic to a different port, try this:
>
> $IPT -t nat -I PREROUTING -p tcp -d IP.ADDR.OF.BOX --dport 6603
> -i \
> $EXTINT -j DNAT --to IP.ADDR.OF.BOX:3306
>
> where $IPT is your iptables binary and $EXTINT is the interface you want
> this rule to apply to. This also assumes you have a prerouting rule like:
>
> $IPT -t nat -P PREROUTING ACCEPT
>
> I am not familiar with the particular GUI configuration tool you are
> using with your distribution of Linux but these iptables calls are
> distro-independant.
>
> If this doesn't answer your question please restate it more clearly and
> I will see if I can offer some help.
>
>

Ok, let me try and clear it a bit up

My box hangs on the net and has two interfaces, eth0 and 1. eth0 is
internet, eth1 has 192.168.0.1. It is doing NAT and masquerading for my
network, but also runs an sql server.

now I redirect all calls to port 6603 to 3306. I manage to do that using
a DNAT rule to 192.168.0.1, and when I use a REDIRECT rule, it also works.
But, it now only works for everything on the eth1, because in the filter
table, everything other than eth0 is accepted.
For eth1 now, I have a few rules (like accept established and related
connections) in filter table.
To get the redirect to work for eth0, i need to accept all conn's to
port 3306.
Great, so i can redirect 6603 to 3306 and it works, also from the
outside! But, what i need is to block port 3306 to everyone BUT the
redirect. Only calls to 6603 may be allowed.

Hopefully, that clears up a bit? I'm not very used to the command line
commands for iptables, but i'm able to retrieve what i need from it, so
that's fine...

Thanks so far...

Kind Regards,

Laurens
 
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
port-redirect not working peter pilsl Linux Networking 1 03-23-2005 07:50 AM
belkin F5D6230 redirect port renna Wireless Internet 2 03-08-2005 04:04 PM
Redirect port 80 to another port on another computer? Open Wound Wireless Internet 0 12-31-2003 03:07 AM
difference between port redirect and port forwarding Anil Kommareddy Linux Networking 1 10-31-2003 08:57 PM
Controlling accepted source port Rick Lim Linux Networking 3 08-22-2003 02:48 PM



1 2 3 4 5 6 7 8 9 10 11