LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-21-2010, 07:54 AM   #1
pshoaf
LQ Newbie
 
Registered: Feb 2005
Location: Charleroi, PA 30 mi SE of Pgh
Distribution: RedHat, Fedora, Oracle
Posts: 16

Rep: Reputation: 0
IPTables NAT Problem


I have IPTables setup and mostly working. I have two interface, inside & outside. All traffic from inside goes out and works fine. All traffice from outside goes where it should. My problem is that I have DNAT setup for two outside addresses to 2 inside addresses. From inside I can only access the boxes via their inside address, I can not access the outside address. Can someone please help me? I have been reading, and I believe I may need to use SNAT and/or add some DNAT statements. I am running on Fedora 10. Below is the /etc/sysconfig/iptables file with outside addresses top level masked.

*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth1 -j MASQUERADE
-A PREROUTING -p tcp -m tcp -d xx.xx.xx.21 -j DNAT --to-destination 192.168.100.3
-A PREROUTING -p tcp -m tcp -d xx.xx.xx.18 -j DNAT --to-destination 192.168.100.1
COMMIT
*filter
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:MASQ-FORWARD - [0:0]
:OUTPUT ACCEPT [0:0]
-A FORWARD -s 192.168.100.0/23 -o eth1 -j MASQ-FORWARD
-A MASQ-FORWARD -s 192.168.100.0/23 -o eth1 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p all -s 192.168.100.0/23 -j ACCEPT
-A INPUT -p all -s xx.xx.xx.0/25 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -j ACCEPT
-A INPUT -p udp -m udp --sport 3307 -j ACCEPT
-A INPUT -p udp -m udp --sport 123 -j ACCEPT
-A INPUT -p udp -m udp --sport 13 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 13 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 20 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 69 -j ACCEPT
-A INPUT -p udp -m udp --sport 37 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 37 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p tcp -m tcp -m state --dport 3307 --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp -m state --dport 20 --state NEW -j ACCEPT
-A INPUT -p udp -m udp -m state --dport 20 --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp -m state --dport 21 --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp -m state --dport 80 --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp -m state --dport 10000 --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp -m state --dport 20000 --state NEW -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
*mangle
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed
 
Old 10-21-2010, 12:30 PM   #2
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, PCLinuxOS
Posts: 148

Rep: Reputation: 9
You are right. Just try SNAT.
 
  


Reply

Tags
dnat, fedora 10, iptables, linux, snat


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
Iptables and NAT strange problem shukalo83 Linux - Networking 3 02-08-2012 05:06 AM
Iptables NAT routing problem marpel Linux - Security 10 05-09-2006 07:23 AM
iptables nat 1 to 1 problem ched Linux - Networking 1 04-27-2005 07:27 PM
Iptables FORWARD or NAT. problem. aronnok Linux - Networking 0 01-30-2005 04:57 AM
iptables NAT problem dave92082 Linux - Networking 1 06-16-2004 05:02 AM


All times are GMT -5. The time now is 10:27 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration