LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I need a help with iptables (https://www.linuxquestions.org/questions/linux-newbie-8/i-need-a-help-with-iptables-103590/)

bob/dev 10-13-2003 07:23 PM

I need a help with iptables
 
What is the iptables command to turn forwarding on or off for a specific IP address? I need to block several computers on my home network from forwarding at certain times. I used to do this in ipchains by using two shell scripts and cron. Now I'm using iptables and the scripts no longer work. My teens are staying up too late on school nights.

Thanks,
bob/dev

Hangdog42 10-13-2003 09:18 PM

You should be able to do something similar using iptables and cron. I guess if I were doing it, I would have two iptables scripts, one permissive and one restrictive and then set up cron to run them at appropriate times.

I don't think you have to turn off forwarding to do this though. If you drop the packets on the INPUT chain, it would do the trick as well. So:

iptables -A INPUT -i ethX -s 1.2.3.4 -j DROP

In this case ethX would be replaced by whatever ethernet device they come into your linux box on (I'm assuming the LAN side) and 1.2.3.4 would be replaced by whatever IP address you want shut down. Just be sure to put the rules early in the restrictive script so they get enforced.

bob/dev 10-13-2003 09:44 PM

Thanks, that worked like a charm.

bob/dev


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