LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-19-2005, 09:41 AM   #1
dsp444
LQ Newbie
 
Registered: Jan 2005
Posts: 10

Rep: Reputation: 0
another httpd port forwarding question


OK - I have set up a webserver (using apache) on one of my machines (192.168.0.5). I have my router/firewall machine forwarding port 80 to to that machine. However, I have one small issue - I cannot access the webserver from my other internal machines.

I have tried to pare down my firewall script to the simplest possible but cannot get it to work. Below is my very simple (insecure) firewall script :

Code:
# Reset to accept
        $IPTABLES -P INPUT ACCEPT
        $IPTABLES -P OUTPUT ACCEPT
        $IPTABLES -P FORWARD ACCEPT

# Flush all rules
        $IPTABLES -F
        $IPTABLES -F -t nat

# Erase all user defined chains
        $IPTABLES -X
        $IPTABLES -X -t nat

# Enable SNAT and forward httpd requests
        $IPTABLES -t nat -A PREROUTING -p tcp -d $STATIC_IP --dport 80 -j DNAT --to-destination 192.168.0.5:80
        $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $STATIC_IP
$EXTIF = eth0 and $STATIC_IP is my ISP supplied static IP address.
(and yes i have ip_forward set to 1)

Here is a summary of what works and what doesn't work:

if I try to go to mydomainname from any external machine, it works
if I try to go to 192.168.0.5 from any intenal machine, it works
if I try to go to mydomainname from any internal machine, it DOESN'T WORK
if I try to go to $STATIC_IP from any internal machine, it DOESN'T WORK

Does that make sense? Do I need another PREROUTING or POSTROUTING rule for the internal machines?

Any help or advice would be greatly appreciated, I've been fighting this one little thing for too long.

Thanks
Dan
 
Old 01-19-2005, 02:28 PM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
The answer is that you cannot look at yourself. You are trying go out and come in on the same route which is not possible. The only way you can do this is by working through a proxy in your browser. If you use Mozilla/Firefox then go to Edit ->preferences -> General and alter the connection settings to a public proxy server. Technically you should ask permission of the owners of the proxy server to use their address before you do this. I have tried this myself to check the behaviour and speed of my own server.

Last edited by TigerOC; 01-19-2005 at 02:29 PM.
 
Old 01-19-2005, 02:32 PM   #3
twsnnva
Member
 
Registered: Oct 2003
Location: Newport News, Va
Distribution: Debian
Posts: 246

Rep: Reputation: 30
Is the linux router/firewall running dnsmasq? If so all you need to do is add this to the /etc/hosts file on the firewall.
Code:
192.168.0.5 yourdomainname
You should then be able to access the server by the domain name from the local network.

Thomas
 
Old 01-19-2005, 07:26 PM   #4
dsp444
LQ Newbie
 
Registered: Jan 2005
Posts: 10

Original Poster
Rep: Reputation: 0
OK - thanks for the info. Guess I've been beating my head against the wall for no reason. Its not that big of deal, but I thought I was completely missing the boat or something. I'll just make internal users use the name of the machine specified in the "hosts" file on each machine. (And no I'm not running dnsmasq )

Thanks again for the help and suggestions
 
  


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
Port Forwarding Question leedsmunich Linux - Networking 1 10-03-2005 09:17 AM
Port forwarding question linuxpyro Linux - Networking 3 10-22-2004 08:13 PM
Port forwarding question GUIPenguin Linux - Networking 1 10-12-2004 01:30 PM
Port forwarding question Doolspin Linux - Networking 2 09-03-2004 10:11 PM
port forwarding question larry Linux - Networking 2 06-10-2004 10:34 AM

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

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