LinuxQuestions.org
Visit Jeremy's Blog.
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 04-09-2012, 02:47 PM   #1
h02
LQ Newbie
 
Registered: Apr 2012
Posts: 2

Rep: Reputation: Disabled
IPTables NAT to Windows Machine, not working when forwarding source IP


I currently have a linux machine with two interfaces - eth1 (public) eth0 (private) - and a windows machine with a private interface and a service bound to it.

I have NAT setup to forward from the linux machine to the windows machines private interface.

Here is my current iptables:
Quote:
iptables -F
iptables -t nat -F
iptables -t mangle -F

iptables -X
iptables -t nat -X
iptables -t mangle -X

iptables -A FORWARD -i eth0 -j ACCEPT

iptables -t nat -A PREROUTING -i eth1 -d 216.245.192.38 -j DNAT --to-destination 10.4.11.54
iptables -A FORWARD -p udp -m multiport --dports 7777,7778 -j ACCEPT

The windows server is configured to use the linux machine as a gateway.

Currently the windows server is succsesfully receiving the packets, and it is attempting to send a reply, but the linux machine is not receiving the reply from the windows machine.

When i used this:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Everything worked, but it forwarded the linux servers private IP and not the original source public IP. I am trying to get it to work forwarding the public IP to the windows server.

Any help would be appreciated!
 
Old 04-11-2012, 03:24 AM   #2
nikmit
Member
 
Registered: May 2011
Location: Nottingham, UK
Distribution: Debian
Posts: 178

Rep: Reputation: 34
Since the packets are getting all the way to the windows machine, I assume you have configured the forwarded IP address as a secondary IP on eth1. (you might want to mask it out in your post)

What is the output of iptables -t nat -L -v -n and iptables -L -v -n - do all of your rules see traffic?
What is the output of tcpdump -i eth0 host 10.4.11.54?

Nik
 
Old 04-18-2012, 11:32 AM   #3
h02
LQ Newbie
 
Registered: Apr 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
There was a problem in the datacenter preventing this action on the private LAN, installed a crossover cable and no other problems.
 
  


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
iptables: can't initialize iptables table `NAT' linuxgentoo Linux - Kernel 3 01-17-2010 10:15 AM
NAT and Proxy in one machine!!! vishnu_sreekumar Linux - Networking 2 01-05-2007 03:56 AM
IPTABLES : build NAT using IPTABLES joseph Linux - Networking 4 04-23-2004 05:08 AM
FTP server (Windows) behind NAT (IPtables) SWAT Linux - Newbie 10 01-08-2004 12:54 PM
Iptables Need It To Route To A Windows Machine For Remote Desktop sal_paradise42 Linux - General 2 11-11-2003 08:20 PM

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

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

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