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 06-16-2012, 12:04 PM   #1
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137
Blog Entries: 1

Rep: Reputation: 17
MASQ / SNAT / DNAT Issues


This network setup is a bit complicated. I realize it'd be much easier to redo most of it and I wouldn't have this issue in the first place, but with what was laying around in the hardware closet, this is what I have. Couldn't run coax or cat5 across the house, so I had to make a wireless bridge basically.

Code:
Cable Modem -> Router (192.168.1.*) -> Old Laptop wlan0 (192.168.1.7 DMZ'd) -[forwarding rules]> Old laptop eth0 (10.0.0.1) -[crossover cable]> IPCop Box (10.0.0.2) on RED & 192.168.0.1 on GREEN
Interesting issues:
1.) Sometimes ALL ports from the outside forward to apache2 on an internal box.
2.) Sometimes NO ports at all forward to an internal box

I'm lost there.

If I nmap from laptops eth0 to inside everything's normal, so I know IPCop is forwarding things just fine.
If I nmap from laptops wlan0 to inside I get nothing. No hosts up regardless of scan type.
So I know its an issue with the laptops forwarding rules.

I'm currently using MASQ to do the job, but I think it may be time to switch to SNAT.

I've searched here, and found this:

Code:
iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to-source <SERVER'S_EXTERNAL_IP>
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.24:80
Which should adapt to this:

Code:
iptables -t nat -A POSTROUTING -o wlan0 -j SNAT --to-source 192.168.1.7
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j DNAT --to-destination 10.0.0.2:80
Repeat last statement for ports needing forwarding, but isn't working.

Any ideas?

Last edited by jmoschetti45; 06-16-2012 at 12:06 PM.
 
  


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
DNAT and SNAT for ipv6 in RHEL6 marifran Linux - Kernel 0 12-09-2010 04:09 AM
IPTABLES DNAT SNAT Re-Addressing jccurtis Linux - Networking 1 01-03-2006 04:41 PM
MASQUERADE vs. DNAT/SNAT Palula Linux - Networking 9 08-12-2005 10:23 AM
shorewall masq or snat varun_saa Mandriva 1 01-08-2005 02:14 AM
[MS Direct Play DNAT SNAT] MrGreg Linux - Networking 2 06-09-2002 06:58 PM

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

All times are GMT -5. The time now is 05:21 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