OpenWrt Forum Archive

Topic: Noob in need of help with webserver behind router

The content of this topic has been archived on 7 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Ok so I'm relatively new to linux, about 2 weeks into it, I got my router setup the way I want it for my personal machine, bit torrent, battlenet.  I am able to ssh via WAN to both my linux box and my router, everything is great till I installed apache on my linux box!

LAN it works fine I see my test page @ 192.168.1.10 however via WAN I get a 404 error. I finally fiqured out that the router has a httpd service running, I disabled it (/etc/init.d/httpd disable) and started the script over and even rebooted the router.  I'm using updatedd to configure my dyndds account. I know my port 80 is open because I scanned it via an online tool and when I had httpd running router side I can access via WAN (ssh'd into a buddies box typing links http://****.ath.cx/test.htm) on a test page I wrote for it.

I'm using /etc/config/firewall

#Webserver
forward:dport=80:192.168.1.10

I've tried also
accept:proto=tcp dport=80
forward:dport=80:192.168.1.10

and...
forward:proto=tcp dport=80:192.168.1.10

I know it is route side because I hooked up my old dlink router forward port 80 to my linux box running apache and boom WAN working like that. Please, please help me!

This may not be a router problem... couple more things you can try:

- Check for virtual host configurations on your Linux box.  It may be treating LAN access (when it gets requests for http://192.168.1.10) different than WAN access (when it gets requests for http://222.222.222.222, for example).
- Check with tcpdump.  tcpdump will get to the nitty gritty of network communication and let you know if it gets ANYTHING on port 80.  On your Linux box, get the name of the interface you use to connect to the Internet.  It's likely "eth0" for wired, or "wlan0" for wireless.  Run /sbin/ifconfig and look for the interface name that has the 192.168.1.10 IP address.  Then try something similar to the following from the command line:

  tcpdump -i eth0 tcp port 80

I've only spent a lifetime total of a few hours with tcpdump but it's saved my sanity more than a few times. smile.

Anyways, while tcpdump is running, try accessing your web server from the WAN.  If tcpdump is SILENT, it's probably a router problem.  If it prints stuff, then the router's probably routing all the packets properly and it's likely something to do with your LAN machine.

- Silvaran

EDIT: Heh what kind of interface name is www0? It's wlan0 I think (d'oh)... smile

(Last edited by silvaran on 15 Sep 2007, 00:14)

The discussion might have continued from here.