LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-23-2004, 07:11 PM   #1
pircio
LQ Newbie
 
Registered: Apr 2004
Distribution: Debian
Posts: 15

Rep: Reputation: 0
Intranet traffic restriction/redirection


Here's what I have

A linux system running Debian with the bash client and a DHCP server. I have not done ANY configuration to it whatsoever.

Here's what I want to do.

We're running a LAN party, and I want to enforce computer registration. The way it's supposed to work is, the DHCP recognizes the new computer hooked up, via mac address, and assigns it an IP address within a specified range. THIS IP ADDRESS MUST NOT CHANGE. It then determines if this IP address has been registered by accessing a mysql database.

That's problem 1, I want it to check the database to determine registration, and I have no idea how to prompt it for that, I know how to create/read from the database, I just don't know where it fits in.

Problem 2: If they are NOT registered, I want it to block ALL connections through any port so they cannot gain access to the network EXCEPT port 80. Then they will be redirected (via their browser) to a webpage which they will enter their name, etc, to register their computer.

So what I really need is to check for registration, then an automatic redirection.

Any ideas?
 
Old 02-16-2005, 04:43 PM   #2
ThePlague
Member
 
Registered: Jul 2001
Posts: 34

Rep: Reputation: 15
Wondering the same thing.

Anyone know a way to do this?
 
Old 02-17-2005, 09:24 AM   #3
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

not an answer to your quesitons but a suggestion :
you might handle this with iptables, with the mac-address and logging suport.

The first computer comes for dhcp registration : dport67. you log this with a special keyword :
iptables -A INPUT -p udp --dport 67 -j LOG --log-prefix '##DHCP_REQUEST##'

You use syslog-ng as a syslog daemon, thus, you can :
filter DHCP_REQUEST { match("\#\#DHCP_REQUEST\#\#"); };
destination DHCP_REQUEST_SCRIPT { program( /usr/bin/myscript.pl ); };
log { source(src); filter(DHCP_REQUEST); destination(DHCP_REQUEST_SCRIPT); };

So from now on, each incomming packet to port 67 executes /usr/bin/myscript.pl

This script can, as an exemple, add an iptables rule for the mac address, such as :
iptables -I INPUT -m mac --mac-source $MAC_ADDRESS -j DROP
iptables -I INPUT -m mac --mac-source $MAC_ADDRESS -p tcp --dport 80 -j ACCEPT

The 2 rules are INSERTED (-I) thus they are the first one applied in the INPUT chain.

Thus the new machine can only access the web server.

Then once the web form request is made, you could delete the old rules and add a new one :
iptables -D INPUT -m mac --mac-source $MAC_ADDRESS -j DROP
iptables -D INPUT -m mac --mac-source $MAC_ADDRESS -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -m mac --mac-source $MAC_ADDRESS -j ACCEPT


Beware : these lines are certainly not the best ones....
the logging facilities may be very verbose, don't forget to logrotate if you do this !!


As for the dynamic IP problem, just use _very_ long leases in dhcpd, it should work well.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM
how to find http traffic and mail traffic alone? basbosco Linux - General 1 06-07-2005 10:29 PM
ifconfig traffic != emule traffic bobwall Linux - Networking 0 02-06-2005 09:59 AM
What makes an intranet an intranet? pembo13 Linux - Networking 3 06-21-2004 08:20 PM
Wireless traffic stomps isdn traffic on gateway machine Radix999 Linux - Wireless Networking 0 11-14-2003 12:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration