LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
LinkBack Search this Thread
Old 05-05-2006, 02:18 AM   #1
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Rep: Reputation: 15
Restrict access times for specific IP addresses?


Hi,

I have a debian style distro (DSL) running a Linux server box, using 2 NICs: one to receive an ADSL feed and the other to serve it to a home LAN. The users on the LAN have static IP addresses.

I am using a simple IP tables solution for the NAT.

Does anyone know a way (or a debian package) that will allow me to control the connect times (or time periods) for specific users on the LAN?

Can provide full details of the server setup if needed.

Thanks,

Geoff.
 
Old 05-05-2006, 07:17 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 58
POM (iptables patch-o-matic) has a patch to add 'time of day' hooks to your iptables rules. Is this what you mean? Or are you looking for something to control the duration of access?
 
Old 05-05-2006, 07:27 PM   #3
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 264Reputation: 264Reputation: 264
Looks like you could use squid. http://www.linuxdevcenter.com/pub/a/...t_gateway.html

Alternatively, if all the machines are linux and you're the only admin, you could just create a cronjob to ifdown eth0 and ifup eth0 at specific times of day on each machine...

As for IPtables, I'm no expert, but I found this thread which shows a partial solution...
 
Old 05-08-2006, 04:51 AM   #4
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Hi,

Thanks for your replies.

Not sure if the IP tables patch will be suitable, given that I am using a very stripped back distro (Damn Small Linux) because of limited capabilities of the linux server (the whole thing runs off a 256mb usb stick).

But, using IP tables rules via a cron job has appeal. Will give it a go.

However, what I hoped to get was a package/routine that monitored the usage by an individual IP address, limiting the access of that IP to a specfied time period per day.

Thanks again,

Geoff.
 
Old 05-08-2006, 01:33 PM   #5
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 58
Quote:
However, what I hoped to get was a package/routine that monitored the usage by an individual IP address, limiting the access of that IP to a specfied time period per day.
That is exactly what the time-of-day patch adds hooks for. See:
http://www.netfilter.org/projects/pa...#pom-base-time

As long as you can patch and rebuild the kernel you should have no problems, and it seems to me the kernel patch will use way less resources on your server than a user-space solution.
 
Old 05-09-2006, 12:54 AM   #6
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Hi,

Thanks for the further help.

Am currently travelling but when I get home will have a shot at patching the kernel. I am unsure how this will go on the DSL setup, as it is rather "stripped back", ie: it probably doesn't have the utilities required to patch the kernel. But, it sure looks like a solution.

Thanks again,

Geoff.
 
Old 05-09-2006, 12:24 PM   #7
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 58
Quote:
I am unsure how this will go on the DSL setup, as it is rather "stripped back", ie: it probably doesn't have the utilities required to patch the kernel.
I was assuming you would do this on a host system before moving it to the USB drive...
 
Old 05-11-2006, 02:52 AM   #8
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for the continued help.

Yes, I will try the routine on a 'standard' HD-installed version of DSL, with whatever additional packages, etc. are required to try and patch the kernel. Presuming that this goes OK, I will then 're-strip' the installation and write out a new compressed DSL system, to use in my 'frugal' style USB installation.

Looking at the above reminds me of the time (many years ago!) when I thought I would replace the clutch in my old front wheel drive car. The instructions didn't look too daunting until I noticed that the first line read "1) Remove engine."

I am a little surprised, with all the fuss about controlling children's access to the net in particular and to spending too much time on their PC in general, that there are no packages available that will allow easy control of network/internet access by user (or IP address).

Reckon some bright person should write such a package.

Thanks again,

Geoff.
 
Old 11-02-2006, 02:08 AM   #9
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Hi,

Posed the above question some time ago.

Am curious as to whether anyone knows of a package (debian preferably) that allows a lan server to allow/deny access to the lan for particular IP addresses based on time of access and accumulated access time over (say) a 24 hour period?

Regards,

Geoff.
 
Old 11-02-2006, 04:44 AM   #10
hhvv
Member
 
Registered: May 2006
Location: India
Distribution: RHEL,CentOS,BSD,Ubuntu
Posts: 59
Blog Entries: 1

Rep: Reputation: 15
iptables and crontab

Can you think of a crontab that interchanges the iptables rules periodically.
I mean you can prepare two separate rule sets to allow/deny the IPs you need. and then interchange the IPTABLES file periodically using crontab .
 
Old 11-02-2006, 07:16 PM   #11
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for the suggestion.

Had thought of the crontab approach but this will not allow (to my limited understanding) the possibility of limiting particular IP addresses to a set quota of time/downloads per day.

Any ideas on the time/downloads quota?
 
Old 11-02-2006, 10:42 PM   #12
hhvv
Member
 
Registered: May 2006
Location: India
Distribution: RHEL,CentOS,BSD,Ubuntu
Posts: 59
Blog Entries: 1

Rep: Reputation: 15
?????

Could I know what you mean by time/downloads ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To restrict a specific user simi_virgo Linux - Newbie 1 02-26-2005 12:03 AM
How to Restrict User Logon Times in Mandrake 10.0 XtremeNissan Mandriva 0 08-25-2004 09:34 PM
iptables : Restrict access at certain times of day J-Ben Linux - Newbie 1 03-28-2004 09:38 PM
Need to restrict login times for vsftp thebrit123 Linux - Software 0 06-09-2003 09:27 AM
How do I restrict ssh access to certain ip addresses? 360 Linux - Networking 5 04-05-2002 08:04 AM


All times are GMT -5. The time now is 10:12 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration