LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-04-2005, 12:21 PM   #1
props666999
Member
 
Registered: Oct 2003
Location: Greece
Posts: 260

Rep: Reputation: 30
DNAT + iptables failure


Hello

i cannot redirect port 80 to the internal computer

eth0 real-external IP
eth2 with ip 192.168.1.2 hosts webserver on 80


unfortunately i can see the apache test page locally not externally

this is my testing script - not a real one
Code:
INET_IP="84.x.x.x" 
INET_IFACE="eth0"

LAN_IP="192.168.1.1"
LAN_IFACE="eth2"


DMZ_HTTP_IP="192.168.1.2"


O_IFACE="lo"
LO_IP="127.0.0.1"


IPTABLES="/usr/sbin/iptables"


/sbin/depmod -a




/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_mangle
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state



echo "1" > /proc/sys/net/ipv4/ip_forward



$IPTABLES -P INPUT ACCEPT 
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT


$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $INET_IP --dport 80 \
-j DNAT --to-destination $DMZ_HTTP_IP:80



$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP
any hell would be very apreaciated
 
Old 11-05-2005, 12:45 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Really don't see anything wrong. You might try it it this way. Not sure if it will make a difference. Currently no access to my books or notes.

$IPTABLES -t nat -A PREROUTING -i $INET_IFACE -p tcp -d $INET_IP --dport 80 \
-j DNAT --to-destination $DMZ_HTTP_IP:80

Only other thought is to make sure there is no firewall on DMZ_HTTP_IP or if there is one that that port is open.
Can you access the web server from the machine?
Can the firewall machine see the web server?

Hope something might help.
Brian1
 
Old 11-05-2005, 01:53 PM   #3
props666999
Member
 
Registered: Oct 2003
Location: Greece
Posts: 260

Original Poster
Rep: Reputation: 30
Thanks for the reply Brian1


My problem sorted

I have eth0 (external IP ) eth1 and eth2

i 've noticed that when i place Apache behind eth1 such as 192.168.0.4

i could publish the website on the net. BUT on eth2 nothing.

What i did was updating kernel and reconfiguring the rooting table for the client on eth2

Now works fine .

Still don't know what the problem was
 
  


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
Help with iptables/DNAT/forwarding lohb1ac Linux - Networking 2 12-05-2005 08:48 AM
iptables DNAT pshepperd Linux - Security 1 05-22-2004 03:56 PM
Iptables DNAT weirdness matta Linux - Networking 3 04-07-2004 03:11 AM
DNAT question (Iptables) wilsonmau Linux - Networking 1 06-06-2003 06:50 AM
iptables DNAT bentz Linux - Networking 15 05-19-2003 01:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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