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
oidentd_masq.conf(5)						File Formats Manual					      oidentd_masq.conf(5)

NAME
oidentd_masq.conf - oidentd IP masquerading/NAT configuration file. DESCRIPTION
If you are using IP masquerading or NAT, oidentd can optionally return a username for connections from other machines. Support for this is specified by calling oidentd with the -m (or --masq) flag and by creating an /etc/oidentd_masq.conf file. oidentd can also forward requests for an IP masqueraded connection to the machine from which connection originates by way of the -f option. This will only work if the host to which the connection is forwarded is running oidentd with the -P (proxy) flag, or if the host's ident daemon will return a valid reply regardless of the input supplied by and the address of the host requesting the info (some ident daemons for windows do this, maybe others). FORMAT
<IP Address|Hostname>[/<Mask>] <Ident Response> <System Type> The first field contains the IP address or the hostname of a machine that IP masquerades through the machine on which oidentd runs. The mask parameter can be either a network mask or a mask in CIDR notation. A mask of 24 is equivalent to 255.255.255.0, a mask of 16 is equivalent to 255.255.0.0, etc. The second field specifies the reply that oidentd will return for lookups to the host matching the IP address specified in the first param- eter. The third field specifies the operating system the machine matching the first parameter is running. EXAMPLES
<Host>[/<Mask>] <Ident Response> <System Type> 192.168.1.1 someone UNIX 192.168.1.2 noone WINDOWS 192.168.1.1/32 user1 UNIX 192.168.1.0/24 user3 UNIX 192.168.0.0/16 user4 UNIX somehost user5 UNIX 192.168.1.0/255.255.255.0 user6 UNIX AUTHOR
Ryan McCabe <ryan@numb.org> http://dev.ojnk.net SEE ALSO
oidentd(8) oidentd.conf(5) version 2.0.8 13 Jul 2003 oidentd_masq.conf(5)
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy