LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2008, 08:37 AM   #1
gugabaga
Member
 
Registered: Jan 2006
Distribution: Fedora
Posts: 61

Rep: Reputation: 15
IPTABLES: DNAT port 1433


Hi,

I have setup a fedora/iptables firewall with static public ip address.

The fierwall m/c has two lan cards

eth0 - local ip
eth1 - public ip

We have a mssql database server at 192.168.0.100

My IPTABLE script -

/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 1433 -j DNAT --to-destination 192.168.0.100:1433

But I am unable to connect to my sql server.
I can ping my public ip address from the net.

Please help
 
Old 05-06-2008, 02:14 PM   #2
illscience
LQ Newbie
 
Registered: May 2007
Posts: 25

Rep: Reputation: 15
I think that by having your server on adress at 192.168.0.100 you are in essence referring to any address on the 192.168.0.0 subnet. You might want to change the address to 192.168.1.100. I hope that helps.
 
Old 05-11-2008, 11:07 AM   #3
gugabaga
Member
 
Registered: Jan 2006
Distribution: Fedora
Posts: 61

Original Poster
Rep: Reputation: 15
Solved the problem. Here is my complete solution-

/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 1433 -j DNAT --to-destination 192.168.0.100:1433

echo 1 > /proc/sys/net/ipv4/ip_forward

I had this setup from the begining but still I could not connect to sql server from the internet.

The problem was that I had not set the linux server as gateway in the SQL Server machine. Since the sql server does not work as a work station, it does not need to go to the net, so there was no gateway present.
The moment I set its gateway to 192.168.0.98 (my linux server) I was able to connect.

The next step for me will be to make the network secure.

I googled and came up with some scripts which are supposed to block some simple attacks like syn/fin.

I basically need three ports open.
ssh - directly to linux
1433(ms-sql-s) - DNAT to 192.168.0.100
14330 - DNAT to 192.168.0.200:1433 (another sql server)

What sort of security precautions should I take?

Any pointers will be appreciated.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH Port Forwarding with IPTables & DNAT MercurioBlue Linux - Networking 2 08-24-2006 11:17 PM
Problems with iptables DNAT to private IP, different port tisource Linux - Networking 1 04-13-2006 03:43 PM
Port Forwarding using iptables-DNAT radupastia Linux - Networking 2 07-18-2003 02:14 AM
FYI: increasing amount of port TCP/1433 scans unSpawn Linux - Security 0 05-22-2002 11:07 AM
IPTables - DNAT, SNAT, port forwarding FunkFlex Linux - Security 2 01-15-2002 07:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration