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
NOS-TUN(8)						    BSD System Manager's Manual 						NOS-TUN(8)

NAME
nos-tun -- implement ``nos'' or ``ka9q'' style IP over IP tunnel SYNOPSIS
nos-tun -t tunnel -s source -d destination -p protocol_number [source] target DESCRIPTION
The nos-tun utility is used to establish an nos style tunnel, (also known as ka9q or IP-IP tunnel) using a tun(4) kernel interface. Tunnel is the name of the tunnel device /dev/tun0 for example. Source and destination are the addresses used on the tunnel device. If you configure the tunnel against a cisco router, use a netmask of ``255.255.255.252'' on the cisco. This is because the tunnel is a point-to-point interface in the FreeBSD end, a concept cisco does not really implement. Protocol number sets tunnel mode. Original KA9Q NOS uses 94 but many people use 4 on the worldwide backbone of ampr.org. Target is the address of the remote tunnel device, this must match the source address set on the remote end. EXAMPLES
This end, a FreeBSD box on address 192.168.59.34: nos-tun -t /dev/tun0 -s 192.168.61.1 -d 192.168.61.2 192.168.56.45 Remote cisco on address 192.168.56.45: interface tunnel 0 ip address 192.168.61.2 255.255.255.252 tunnel mode nos tunnel destination 192.168.59.34 tunnel source 192.168.56.45 AUTHORS
Nickolay N. Dudorov <nnd@itfs.nsk.su> wrote the program, Poul-Henning Kamp <phk@FreeBSD.org> wrote the man-page. Isao SEKI <iseki@gongon.com> added a new flag, IP protocol number. BUGS
We do not allow for setting our source address for multihomed machines. BSD
April 11, 1998 BSD
All times are GMT -4. The time now is 11:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy