Sponsored Content
Top Forums UNIX for Dummies Questions & Answers LAN traffic rerouting to web server Post 302182009 by J-Fal on Friday 4th of April 2008 09:40:25 PM
Old 04-04-2008
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! Smilie
 

4 More Discussions You Might Find Interesting

1. IP Networking

LAN server - Proxy, DNS, WEB - I'm lost!!!

Ok! I started to do something and I got lost...and crazy! I got MW2000S gateway device that provides wireless internet access! It is configured to work as NAT. Clients connect to MW and have access to internet and it works beautifully! And now! In the same network I have Ubuntu machine. First I... (0 Replies)
Discussion started by: salvor_hardin
0 Replies

2. Web Development

Cannot access Apache web server from Wan side, only Lan side.

I have installed WAMPSERVER 2.0 on my windows vista x64 system but still am having issues with getting the webserver to be seen outside my local network. It is working fine within my local network. Been through several setup tutorials so far, no dice still. For testing purposes I have... (1 Reply)
Discussion started by: davidmanvell
1 Replies

3. IP Networking

LAN traffic leaking on to WAN

Network map: WAN external interface 192.0.0.0 network | WAN internal interface 192.0.3.0 network | 192.0.3.0 LAN | wireless router 192.0.3.1 | DSL modem 192.0.3.2 The problem I am having is that some traffic from the 192.0.3.0 LAN seems to be "leaking" onto the 192.0.0.0 WAN. I... (0 Replies)
Discussion started by: herot
0 Replies

4. IP Networking

Routing traffic problem between 3G and Office Lan Network

Hi, I would like to ask some networking solution regarding my work LAN and 3G usb network problem. I want to route my internet traffic to the 3G network and sometimes connect to some of my work network for ssh to configure some workstation or print something. Currently my problem is i can't... (0 Replies)
Discussion started by: jao_madn
0 Replies
GUESSNET-SCAN(8)					      System Manager's Manual						  GUESSNET-SCAN(8)

NAME
guessnet-scan - guess network configuration data by looking at network traffic SYNOPSIS
guessnet-scan [options] [ethernet_interface] DESCRIPTION
Guessnet-scan tries to deduce network configuration data by watching network traffic at a given Ethernet interface. After scanning network traffic for some time, guessnet-scan prints a configuration string suitable for inclusion in /etc/network/inter- faces. Note that guessnet-scan uses heuristics and wild guesses and that the resulting data is not guaranteed to be accurate. The program is intended to be used as a first try at getting network configuration data without bothering anyone. OPTIONS
Options follow the usual GNU conventions, --debug Print debugging messages. --help Show a brief summary of commandline options. --init-time=int Time in seconds to wait for the interface to initialize when it is not found already up at program startup. Default: 3 seconds. -t, --timeout=int Time in seconds to watch for network traffic. Default: 5 seconds. -v, --verbose Operate verbosely. --version Show the version number of the program. SCANNING REQUIREMENTS
To correctly identify all data of the local network, guessnet-scan needs to see traffic related to a host in the local network and to the local gateway, if any. To be able to identify the network gateway, guessnet-scan also needs to see some traffic directed to the external network: you can help the detection by generating some outbound IP traffic during the scan, for example by browsing a web page (without proxy) or using telnet to open a connection to some remote host. Note that if you are connected to a switch, guessnet-scan won't probably be able to work, since the switch will isolate it from the network traffic that the other machines are generating. SEE ALSO
guessnet(8), interfaces(5). AUTHOR
Guessnet-scan was written by Enrico Zini <enrico@debian.org>. 10 October 2004 GUESSNET-SCAN(8)
All times are GMT -4. The time now is 06:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy