LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-21-2006, 05:43 AM   #1
kevint
LQ Newbie
 
Registered: Dec 2003
Posts: 5

Rep: Reputation: 0
Lightbulb forward port 80 to internal LAN network PC


i have a linux gateway with two NICs eth0 with public ipaddress 203.xxx.xxx.xxx and eth1 with private address 192.168.1.1. i also have a windows server running a website with IPaddress 192.168.1.10. i want any external client request on my public ipaddress will be forward to my internal server 192.168.1.10. i know this can be accomplish by using iptables with PREROUTING and FORWARD rules. i had tried a few of them but it doesn't work, can someone give me a right rules or commands. thanks in advance..
 
Old 04-21-2006, 06:16 AM   #2
UK MAdMaN
Member
 
Registered: Jul 2004
Location: Manchester, England
Distribution: Gentoo
Posts: 211

Rep: Reputation: 30
Oops. Wrong message.

Last edited by UK MAdMaN; 04-21-2006 at 06:18 AM.
 
Old 04-21-2006, 06:33 AM   #3
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Code:
iptables -t nat -A PREROUTING -i eth0 -d 203.xxx.xxx.xxx -p tcp --dport 80 -j DNAT --to-destination 192.168.1.10
iptables -A FORWARD -i eth0 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
Make sure that you have forwarding enabled in the kernel as well:
echo 1 > /proc/sys/net/ipv4/ip_forward
 
Old 04-23-2006, 08:29 PM   #4
kevint
LQ Newbie
 
Registered: Dec 2003
Posts: 5

Original Poster
Rep: Reputation: 0
i had tried this rules previously and now tried it again but it still didn't work.
The browser keeps on browsing without return anything. i ran iptables -vn -t nat -L and i
get
3 144 DNAT tcp -- eth0 * 0.0.0.0/0 10.77.113.39 tcp dpt:80 to:192.168.1.10
and iptables -vn -L
12 576 ACCEPT tcp -- eth0 eth1 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
on the window 2003 server, i did turn off the firewall just for testing but nothing change.
how can i debug this problem??? the system log didn't tell me about it.
 
Old 04-24-2006, 08:22 AM   #5
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Could you post your entire firewall script or the *full* output of "iptables -vnL" and "iptables -t nat -vnL".
 
  


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
Can't forward port to internal linux box NetAX Linux - Networking 2 03-26-2006 07:20 PM
iptables - change port and forward to a internal server leandrok Linux - Networking 0 01-16-2004 09:52 AM
Port forward ftp to windoz server (lan) dulaus Linux - Networking 6 06-11-2003 03:08 PM
Port forward blocking internal lan clients dulaus Linux - Security 1 06-06-2003 06:38 PM
Forward port port 80 to lan web server dulaus Linux - Networking 9 10-04-2002 03:45 AM

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

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