Skip to contentSkip to conversation

Doubt about DNAT

DISCUSSION Rodrigo Leme de Mello 3 participants 4 messages Sep 10, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

I am in trouble to do a rule. Anybody can help me?

I want to redirect all traffic from a specific valid ip and specific destination port to a machine located inside a LAN.

This rule is to access SQL Server that is located inside a LAN and i have a valid ip address in a linux machine with iptables.

I've tried the following:

Lan IP with SQL Server: 192.168.0.10
Valid IP with iptables: 200.221.98.123
Valid IP that will acess SQL Server. 200.206.123.112

This rule i've put in the machine 200.221.98.123

iptables -t nat -A PREROUTING -p tcp -s 200.206.123.112 --dport 1433 -j DNAT --to 192.168.0.10

And now i configure my SQL Server to connect to 200.221.98.123 but i still can't connect. Dou you have any idea why it is not working?

The ip's i've mentioned are just for example.

Thanks a lot

Rodrigo

#1 lore raw
Quoted 16 lines · Rodrigo Leme de Mello

Hi all,

I am in trouble to do a rule. Anybody can help me?

I want to redirect all traffic from a specific valid ip and specific destination port to a machine located inside a LAN.

This rule is to access SQL Server that is located inside a LAN and i have a valid ip address in a linux machine with iptables.

I've tried the following:

Lan IP with SQL Server: 192.168.0.10
Valid IP with iptables: 200.221.98.123
Valid IP that will acess SQL Server. 200.206.123.112

Quoted 7 lines

This rule i've put in the machine 200.221.98.123

iptables -t nat -A PREROUTING -p tcp -s 200.206.123.112 --dport 1433 -j DNAT --to 192.168.0.10

And now i configure my SQL Server to connect to 200.221.98.123 but i still can't connect. Dou you have any idea why it is not working?

1. Do you have a rule to allow the packets through, such as:

iptables -A FORWARD -s 200.206.123.112 -p tcp --dport 1433 -d 192.168.0.10 -j ACCEPT

2. Try adding a LOG rule in your FORWARD and INPUT chains so you can see if there are any other packets trying to get through which you didn't think of:

iptables -A FORWARD -s 200.206.123.112 -j LOG
iptables -A INPUT -s 200.206.123.112 -j LOG

Antony.

Signature · 1 line
If at first you don't succeed, destroy all the evidence that you tried.
#2 lore raw
In reply to Rodrigo Leme de Mello

Hi Rodrigo:

Do you have a Forward rule to match the Prerouting rule?
Is your SQL server on the Internal Net expecting connections on Port 1433?

Stu………

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Rodrigo Leme de Mello
Sent: September 10, 2002 7:17 AM
To: [email protected]
Subject: Doubt about DNAT

Hi all,

I am in trouble to do a rule. Anybody can help me?

I want to redirect all traffic from a specific valid ip and specific destination port to a machine located inside a LAN.

This rule is to access SQL Server that is located inside a LAN and i have a valid ip address in a linux machine with iptables.

I've tried the following:

Lan IP with SQL Server: 192.168.0.10
Valid IP with iptables: 200.221.98.123
Valid IP that will acess SQL Server. 200.206.123.112

This rule i've put in the machine 200.221.98.123

iptables -t nat -A PREROUTING -p tcp -s 200.206.123.112 --dport 1433 -j DNAT --to 192.168.0.10

And now i configure my SQL Server to connect to 200.221.98.123 but i still can't connect. Dou you have any idea why it is not working?

The ip's i've mentioned are just for example.

Thanks a lot

Rodrigo

#3 lore raw

Hi Stewart,

Yeap! I have and my SQL Server is set with the default configuration, that put it to listen on 1433.
I've also did a port scan to check if the port is open and it is.

Thanks for youe help

Rodrigo

----- Original Message -----
From: Stewart Thompson
To: Rodrigo Leme de Mello ; [email protected]
Sent: Tuesday, September 10, 2002 5:27 PM
Subject: RE: Doubt about DNAT

Hi Rodrigo:

Do you have a Forward rule to match the Prerouting rule?

Is your SQL server on the Internal Net expecting connections on

Port 1433?

Stu...

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Rodrigo Leme de Mello
Sent: September 10, 2002 7:17 AM
To: [email protected]
Subject: Doubt about DNAT

Hi all,

I am in trouble to do a rule. Anybody can help me?

I want to redirect all traffic from a specific valid ip and specific destination port to a machine located inside a LAN.

This rule is to access SQL Server that is located inside a LAN and i have a valid ip address in a linux machine with iptables.

I've tried the following:

Lan IP with SQL Server: 192.168.0.10

Valid IP with iptables: 200.221.98.123

Valid IP that will acess SQL Server. 200.206.123.112

This rule i've put in the machine 200.221.98.123

iptables -t nat -A PREROUTING -p tcp -s 200.206.123.112 --dport 1433 -j DNAT --to 192.168.0.10

And now i configure my SQL Server to connect to 200.221.98.123 but i still can't connect. Dou you have any idea why it is not working?

The ip's i've mentioned are just for example.

Thanks a lot

Rodrigo