LinuxQuestions.org
Review your favorite Linux distribution.
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 08-01-2012, 01:36 AM   #1
Fatboyslim
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Rep: Reputation: Disabled
DNAT issue with iptables


Hi Guys

Im very much a n00b when it come to iptables etc

heres my setup

2 nics , WAN & LAN

eth0 = LAN =192.168.10.10
eth1 = WAN = 123.123.123.123

I am trying to DNAT incoming traffic on 123.123.123.123:9180 to 192.168.10.10:80

rule im using

-A PREROUTING -i eth1 -p tcp -m tcp --dport 9180 -j DNAT --to-destination 192.168.10.10:80

where the

--dport 9180 is that of eth1

is this correct or what am i missing , for the life of me i cannot get this to work ?

does my http server need to use my router as the Default gateway ?

any help will be greatly appreciated
im really just trying to get my head around iptables etc
 
Old 08-03-2012, 10:16 PM   #2
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
You have to add rule to firewall to allow the nated packets to be allowed on FORWARD chain
Code:
iptables -A FORWARD -p tcp -i eth1 -o eth0 -d 192.168.10.10 --dport 80 --sport 1024:65535 -m state –state NEW -j ACCEPT
iptables -A FORWARD -t filter -o eth1 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
Old 08-05-2012, 06:36 PM   #3
goossen
Member
 
Registered: May 2006
Location: Bayern, Germany
Distribution: Many
Posts: 224

Rep: Reputation: 41
Is the ip_forward allowed ?
Code:
cat /proc/sys/net/ipv4/ip_forward
Should return 1
 
  


Reply


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 DNAT _TeRmInEt_ Linux - Networking 9 11-24-2009 05:56 PM
iptables with dnat mhm Linux - Networking 3 12-31-2007 07:10 AM
Iptables DNAT ! Please help ! thomaspsimon Linux - Networking 18 08-27-2007 10:03 AM
iptables DNAT pshepperd Linux - Security 1 05-22-2004 03:56 PM
iptables DNAT bentz Linux - Networking 15 05-19-2003 01:17 PM

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

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