Networking Forums

Networking Forums > Computer Networking > Linux Networking > contacting webserver from local network

Reply
Thread Tools Display Modes

contacting webserver from local network

 
 
Chandler Bing
Guest
Posts: n/a

 
      02-28-2004, 03:29 PM
Hi,

I'm a bit messing around with iptables, and it going very well. My
firewallsctipt already has 700 rules. There's only 1 thing that isn't
working right. On the same pc where the firewall is working, is apache
listening on port 80. The problem is that i can't access my webserver on my
external ip adress from my local network. The apache configuration is fine,
my friends can access it and connecting the webserver from behind an
external proxyserver is also working well. Are there any rules to make my
script complete, so i can acces the webserver from the lan on my external
ip?

byebye,

michael


 
Reply With Quote
 
 
 
 
David Cutting
Guest
Posts: n/a

 
      02-28-2004, 07:10 PM
"Chandler Bing" <(E-Mail Removed)> wrote in message
news:4040c189$0$42497$(E-Mail Removed)...
> Hi,
>
> I'm a bit messing around with iptables, and it going very well. My
> firewallsctipt already has 700 rules. There's only 1 thing that isn't
> working right. On the same pc where the firewall is working, is apache
> listening on port 80. The problem is that i can't access my webserver on

my
> external ip adress from my local network. The apache configuration is

fine,
> my friends can access it and connecting the webserver from behind an
> external proxyserver is also working well. Are there any rules to make my
> script complete, so i can acces the webserver from the lan on my external
> ip?


Hi there,

I would /think/ (haven't ever tested it) that something like
this should work:

iptables -t nat -A PREROUTING -s 10.0.0.0/24 -d 1.2.3.4/32 -p tcp
--dport 80 -j DNAT --to 1.2.3.4:80

iptables -t nat -A POSTROUTING -o eth0 -p tcp -s 10.0.0.0/24
-d 1.2.3.4 --dport 80 -j MASQUERADE

Where 10.0.0.0/24 is your local LAN and Subnet and
1.2.3.4 is your external IP address.

HTH, Cheers,

Dave.


 
Reply With Quote
 
Chandler Bing
Guest
Posts: n/a

 
      02-29-2004, 10:37 AM

"David Cutting" <(E-Mail Removed)> schreef in bericht
news:c1qsk9$scs$1$(E-Mail Removed)...
> "Chandler Bing" <(E-Mail Removed)> wrote in message
> news:4040c189$0$42497$(E-Mail Removed)...
> > Hi,
> >
> > I'm a bit messing around with iptables, and it going very well. My
> > firewallsctipt already has 700 rules. There's only 1 thing that isn't
> > working right. On the same pc where the firewall is working, is apache
> > listening on port 80. The problem is that i can't access my webserver on

> my
> > external ip adress from my local network. The apache configuration is

> fine,
> > my friends can access it and connecting the webserver from behind an
> > external proxyserver is also working well. Are there any rules to make

my
> > script complete, so i can acces the webserver from the lan on my

external
> > ip?

>
> Hi there,
>
> I would /think/ (haven't ever tested it) that something like
> this should work:
>
> iptables -t nat -A PREROUTING -s 10.0.0.0/24 -d 1.2.3.4/32 -p tcp
> --dport 80 -j DNAT --to 1.2.3.4:80
>
> iptables -t nat -A POSTROUTING -o eth0 -p tcp -s 10.0.0.0/24
> -d 1.2.3.4 --dport 80 -j MASQUERADE
>
> Where 10.0.0.0/24 is your local LAN and Subnet and
> 1.2.3.4 is your external IP address.
>
> HTH, Cheers,
>
> Dave.
>


hi,

i've tried your rules in my firewall, but i still can't acces my webserver
from inside. Are you sure these rules are right? Thanks anyway for the
reply...

byebye, michael


 
Reply With Quote
 
David Cutting
Guest
Posts: n/a

 
      03-02-2004, 07:44 PM
"Chandler Bing" <(E-Mail Removed)> wrote in message
news:4041cea1$0$49818$(E-Mail Removed)...
>
> "David Cutting" <(E-Mail Removed)> schreef in bericht

[snip]
> > I would /think/ (haven't ever tested it) that something like
> > this should work:
> >
> > iptables -t nat -A PREROUTING -s 10.0.0.0/24 -d 1.2.3.4/32 -p tcp
> > --dport 80 -j DNAT --to 1.2.3.4:80
> >
> > iptables -t nat -A POSTROUTING -o eth0 -p tcp -s 10.0.0.0/24
> > -d 1.2.3.4 --dport 80 -j MASQUERADE
> >
> > Where 10.0.0.0/24 is your local LAN and Subnet and
> > 1.2.3.4 is your external IP address.

>
> hi,
>
> i've tried your rules in my firewall, but i still can't acces my webserver
> from inside. Are you sure these rules are right? Thanks anyway for the
> reply...


Hi there,

No, to be honest I'm not sure those rules would work, I just
modified a very similar couple I have that maps internal traffic
back to another server (not the same machine) and without
setting up a specific host 'service' have no way of easily
testing them ;o(

I'll try to get a chance to have a play and see if I can get a
couple working, I'll let you know if I do.

In the meantime - having /another/ guess, you could change
the 1.2.3.4 'real' address to 10.0.0.1 (the router's
local address). This would then basically be the same as
the lines I have but mapping to a different server.

(Obviously the only one that wouldn't change would be
the first line's -d option which defines what the client
initially asks for). eg:

iptables -t nat -A PREROUTING -s 10.0.0.0/24 -d 1.2.3.4/32 -p tcp
--dport 80 -j DNAT --to 10.0.0.1:80

iptables -t nat -A POSTROUTING -o eth0 -p tcp -s 10.0.0.0/24
-d 10.0.0.1 --dport 80 -j MASQUERADE


Cheers,

Dave.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
internal webserver on home network paul@paulwatt.info Home Networking 1 03-29-2007 08:34 PM
webserver to webserver access via VPN ton de w Windows Networking 3 01-17-2007 08:12 PM
Contacting BT re billing Pip Broadband 10 10-31-2006 08:45 AM
Contacting netgear Allen Wireless Networks 8 08-28-2005 10:25 PM
Access NATted webserver from inside the network sebmil Linux Networking 13 08-11-2004 08:52 PM



1 2 3 4 5 6 7 8 9 10 11