Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 08-05-2002, 04:00 AM   #1
LQ Newbie
Registered: Jul 2002
Posts: 18

Rep: Reputation: 0
Question Ip Forwarding Question

I need a little help with forwarding

Setup : Machine 1
Suse Linux 7.1 / Kernel 2.4.16-35
Iptables 1.2.6a
1 dynamic ip address
Apache 1.26

Machine 2

I have client windows applications (running in var. countries)
which connect on port 2300 on the linux machine
I need to forward this port to the windows machine ,
where I have a server running ,which triggers a sql query
when a client connects and then sends back a result set to the connected client application.

How to correctly call iptables ?
something like :
iptables -t nat -A postrouting -o eth0 -j SNAT ........

Thanks for any help
Old 08-05-2002, 05:06 AM   #2
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
iptables -A PREROUTING -p tcp --dport 2300 -i eth0 -j DNAT --to ipofwindows:porttoaccess

iptables -A POSTROUTING -o eth0 -j MASQUERADE

That might do it. Not sure if that will work so........Im not expert at iptables. I read this from a magazine.

you could always try a GUI app to set it up.


btw, you will need the relevant bits in the kernel for the nat stuff unless you didn't know.

Last edited by webtoe; 08-05-2002 at 04:38 PM.
Old 08-05-2002, 09:04 PM   #3
LQ Newbie
Registered: Jul 2002
Posts: 18

Original Poster
Rep: Reputation: 0
Tried but it did not work .....
Old 08-06-2002, 05:13 AM   #4
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
I have a feeling that the last rule may be wrong. It will need to be -o eth1 (your card going to the windows machine) and it may need an -i eth0 for the card connected to the net. so it will be
iptables -A POSTROUTING -i eth0 -o eth1 -j MASQUERADE

You'll have to look at the man page or on since my skills at iptables are shabby at best. The main structure should be there though.


p.s.Sorry I was no good but sometimes you need to admit ignorance before you can become informed. If you find a solution post it back so we know how to do it in future.

Last edited by webtoe; 08-06-2002 at 05:14 AM.
Old 08-12-2002, 01:26 PM   #5
Senior Member
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
should be iptables -t nat -A ~~~



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Port Forwarding Question caps_phisto Linux - Networking 1 07-10-2005 10:33 PM
Port forwarding question GUIPenguin Linux - Networking 1 10-12-2004 01:30 PM
Port forwarding question Doolspin Linux - Networking 2 09-03-2004 10:11 PM
Qmail Forwarding Question LostNLinux Linux - Software 0 05-27-2004 05:16 PM
could i ask a question about forwarding a packet mostafa_ezz Linux - Networking 0 02-07-2004 02:05 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:19 PM.

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