Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-13-2003, 07:23 PM   #1
LQ Newbie
Registered: Oct 2003
Posts: 2

Rep: Reputation: 0
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.

Old 10-13-2003, 09:18 PM   #2
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 417Reputation: 417Reputation: 417Reputation: 417Reputation: 417
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 -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 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.
Old 10-13-2003, 09:44 PM   #3
LQ Newbie
Registered: Oct 2003
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, that worked like a charm.



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

Similar Threads
Thread Thread Starter Forum Replies Last Post
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/ z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:00 PM.

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