cron probl

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.

cron probl

Postby venky145 » Wed Jan 31, 2007 5:43 pm

hi

# this is my firewall
iptables -t nat -F
iptables -F
echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -p tcp -o eth0 --dport 5050 -j MASQUERADE
iptables -I INPUT -p tcp -s 0/0 -d 0/0 --dport 3128 -j DROP
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 5050 -j REDIRECT --to-port 3128

/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.1/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.1/32 -d 0/0 --dport 3128 -j ACCEPT

# this is my night pack script

/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.2/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.2/32 -d 0/0 --dport 3128 -j ACCEPT

# this is my cron job
* 21 * * * exec /bin/night
* 09 * * * exec /bin/fwall


in 20.20.1.1 IP is UNlimited pack and 20.20.1.2 if night 9 to morng 9 pack

cron job is executing night 9 and i am getting internet of 20.20.1.2 but morng 9 it's not stoping internet access of 20.20.1.2

if i manually execute the fwall script its working fine.
pls help me
venky145
Havaldaar
 
Posts: 118
Joined: Thu Jan 13, 2005 2:35 pm
WLM: ranga72
Yahoo Messenger: venky145
Location: qatar

Re:

Postby LinuxFreaK » Wed Jan 31, 2007 5:56 pm

Dear venky145,
Hello,

You should flush you firewall. Night firewall should look like this.

Code: Select all

iptables -t nat -F
iptables -F
echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -p tcp -o eth0 --dport 5050 -j MASQUERADE
iptables -I INPUT -p tcp -s 0/0 -d 0/0 --dport 3128 -j DROP
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 5050 -j REDIRECT --to-port 3128

/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.2/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.2/32 -d 0/0 --dport 3128 -j ACCEPT


Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

cron probl

Postby venky145 » Wed Jan 31, 2007 9:01 pm

hi



20.20.1.1 ip is Unlimited internet pack (24hrs)

20.20.1.2 ip is only night 9 to morng 9 pack

if i flush and execute the night script 20.20.1.1 ip access will stoped ..
venky145
Havaldaar
 
Posts: 118
Joined: Thu Jan 13, 2005 2:35 pm
WLM: ranga72
Yahoo Messenger: venky145
Location: qatar

Re:

Postby LinuxFreaK » Thu Feb 01, 2007 9:50 am

Dear venky145,
Salam,

Describe in detail what you are trying to achieve.

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi


Return to “%s” Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron