|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using iptables to block address inside my network?
I've checked all the iptables tutorials I could find, but I still can't get my head around this. I want to call a cron job to block a specific host in my internal network from getting through my firewall out to the internet. Then another cron job to allow access to that host again. Can anyone help me figure this out?
Galewind |
|
#2
|
||||
|
||||
|
For clarification: you want a host node to only have access outside the network during a certain period of the day, correct?
__________________
Two things have come out of Berkeley, Unix and LSD. It is uncertain which caused the other. |
|
#3
|
|||
|
|||
|
Quote:
No, I want to block a host node to only have access *inside* the network during a certain period of the day... or no access at all, if that's necessary. Galewind |
|
#4
|
||||
|
||||
|
Ok, cool. What hours do you want that host to have access inside the network? And what are the network and subnet addresses?
|
|
#5
|
|||
|
|||
|
Quote:
I'm not sure of the specific hours yet, I assumed I would just call a script from a cron job & I can handle setting that up. Network address is 192.168.1.0 & subnet is 255.255.255.0 . If you want the specific IP I want blocked, it's 192.168.1.6 . Galewind |
|
#6
|
||||
|
||||
|
You're correct about the cron job. We'll just make up times for the example -- let's say between 4:15 AM and 4:45 AM it can access the network for an upgrade.
Code:
#!/bin/sh # allow.sh -- allows 192.168.1.6 to access the network /sbin/iptables -R OUTPUT -s 192.168.1.6 -d 192.168.1.0/24 -j ACCEPT Code:
#!/bin/sh # deny.sh -- denies 192.168.1.6 to access the network /sbin/iptables -R OUTPUT -s 192.168.1.6 -d 0/0 -j DROP Code:
# crontab 15 4 * * * root /path/to/allow.sh 45 4 * * * root /path/to/deny.sh [edit]: Don't forget to chmod +x the shell scripts. And http://www.netfilter.org/documentat...ng-HOWTO-7.html Last edited by GNUbie : May 15th, 2003 at 03:20 PM. |
|
#7
|
|||
|
|||
|
Thankg GNUbie, I'll try that tonight.
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Using iptables to block address inside my network? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|