The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
NIC traffic Frank2004 HP-UX 2 04-12-2007 11:03 PM
How to capture network traffic kayode Security 2 01-28-2005 06:27 AM
monitoring network traffic yls177 UNIX for Dummies Questions & Answers 6 04-03-2003 01:20 PM
Traffic Shaping eNTer UNIX for Advanced & Expert Users 2 10-18-2001 04:22 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-29-2008
J-Fal J-Fal is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 2
LAN traffic rerouting to web server

Hello. I am not sure where to post this and would appreciate any moderator help in moving this to the area where it is most applicable. Thank you.


I've posted these questions in a couple different forums, but have not received any answers about what I am doing wrong. I would appreciate any help you guys could provide me. Even a point to the right direction would be beneficial.

I am trying to set up a LAN web server. This is just a wireless router, a Linksys WRT160N flashed with DD-WRT (done) that users can connect to, and Mac Mini for the web server, running Apache 2.2.6 on OS X 10.5.2. There is no internet access here, just wireless clients connecting to the router.

I have set up DNSmasq on the router to run as the DHCP server (works perfectly), as well as for DNS. DNSmasq is set to be authoritative. I've entered the MAC address and IP address in DNSmasq for the webserver, named localserver.

Okay. So what I am trying to do is set up this so that when wireless clients connect, they can open their web browsers, and assuming they don't have a blank page set, they are redirected to the the index.html page on the web server. That's all. Then of course they can browse around the server. That is the entire function of this wireless network. The users don't know anything about the IP of the web server, nor its name.

Google should resolve as http://localserver/ ANYTHING, other than the router IP, localhost, or specific valid pages on the webserver, like http://localserver/page2.html, I would like to be redirected to http://localserver I will set up ipfw on the Mac so that any packets not destined for the web server (TCP 80) are just dropped. That's no problem.

But rerouting the traffic successfully is quite a task for me. I'm honestly a novice when it comes to networking. Is it possible to set up DNSmasq without needing a LAN domain, so no matter what is present in the client's web browser address bar, it will change to just http://localserver? I've tried forwarding all traffic with a LAN domain, and without, with mixed results.

This would be very similar to going to a library or a cafe and opening your browser once you connect to the router, and being redirected to a login page, only I'm just redirecting people to index.html on a web server. I can't just use port forwarding on the router because I'm forwarding traffic from the LAN, not a WAN.

The /etc/hosts file on the router is:

127.0.0.1 localhost
192.168.1.254 DD-WRT
192.168.1.253 localserver

I have to say here that in DD-WRT, under the DNSmasq options, I have added the line: address=/#/192.168.1.253 which I believe would resolve all entries that aren't found in the hosts file to 192.168.1.253. Is that correct? It does SEEM to work. Is the client then sent to the web server IP?

I can verify that without a LAN domain, under nslookup, I can get anything to resolve as 192.168.1.253, which is what I want, but when I open a web browser, the address bar does not change to http://localserver/. Why is that? I have attempted to do RedirectMatch and 404 redirects to index.html in Apache, but that does not work. If I can't get users to be redirected to http://localserver/, I'd be happy with just http://192.168.1.253 as long as they are actually able to just open their browser and get to the server with no interaction on their part.

Should I just set up a name server on the Mac Mini? I could do that, but then how would I go about it? Name Daemon (named)? I would like to avoid learning BIND if it's not absolutely necessary. And if the Mini is the name server, how would I forward all web traffic from the LAN clients to it?

Would you guys be willing to point me to where I can go to get more help with this? I guess I need direction on how to correctly configure DNSmasq for what I'm trying to do, how the traffic is routed from beginning to the server, and probably how to set up Apache correctly.

Thanks again.
  #2 (permalink)  
Old 03-30-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Google for WLAN + "walled garden"
  #3 (permalink)  
Old 04-04-2008
J-Fal J-Fal is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 2
Thank you for the term era. I'd never heard of a walled garden, but after a search did find out some info about how it could be set up.

What I've decided to do is use DNSmasq to act as a DHCP server on the LAN, then use iptables to do all the routing. I switched the IPs a little bit, but the idea is the same.

Router IP - 192.168.0.254
web server - 192.168.0.253
DHCP IPs - 192.168.0.1 - 192.168.0.8
Rarely connected machine for admin stuff - 192.168.0.171 (I know it's no more secure this way really, just a way to potentially log access)
Subnet - 255.255.255.0

Can you help me out and tell me if I'm going the right direction here?


iptables -t nat -A PREROUTING -p tcp -s 192.168.0.1-192.168.0.8 --dport 80 -j DNAT --to-destination 192.168.0.253:80

iptables -A INPUT -p tcp -s 192.168.0.171 -d 192.168.0.254 --dport 45170 -j ACCEPT

If a wireless client attempts to do anything with TCP, where the destination port is 80 (HTTP) its destination is changed to the web server IP and port, and the packet is routed there. The web server is running on Apache at port 80.

If I use an address outside of the DHCP assigned area ( .171 in this case), and the packet is destined for the router itself at a specific port, the router will allow that packet to go through (still need to know the username and 4096-bit passcode to get in). The firmware on the router allows for wireless clients to be oblivious to each other.

How would I blackhole all packets after this point? I mean, if the packet is anything other than a TCP packet destined for port 80 from a DHCP assigned LAN IP, or from my "special" IP to the router at the special 45170 port for administration, how would I go ahead and just drop that packet at that point? I know there are other things that have to be allowed before packets can just be dropped (ICMP echo requests can be dropped, all IPv6 packets)...

I'm new to iptables and find this a little confusing. I will have to go through the tables already on the router to see how I will need to alter them for what I need.

Thank you for all the help!
  #4 (permalink)  
Old 04-05-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
I'm no authority on iptables. Because of the way these forums work, I'd suggest you post a new, specific question about this.

This is certainly a highly qualified topic, and might be better suited for the IP Networking board than the Unix for Dummies section.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On




All times are GMT -4. The time now is 08:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0