LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-13-2003, 08:23 PM   #1
bob/dev
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.

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

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

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

bob/dev
 
  


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



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 06:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 03:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 07:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 05: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 08:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration