LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-16-2013, 08:00 AM   #1
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Rep: Reputation: 12
what is the --kerneltz in iptables command.


Hi all,
I am using iptables for my project but facing some problem as follow.

1.in iptables 1.4.7

Quote:
iptables -A INPUT -s 10.0.4.247 -m time --datestart 2013-5-16T12 --datestop 2013-5-16T16 -j DROP
or

Quote:
iptables -A INPUT -s 10.0.4.247 -m time --localtz --datestart 2013-5-16T12 --datestop 2013-5-16T16 -j DROP
output of date command

Thu May 16 15:52:11 IST 2013


both the commands above is not working. As i can able to ping form 10.0.4.247 to the machine.

why this is not working as default it should be --localtz.(man page of iptables v 1.4.7)

2.in iptables v 1.4.12

Quote:
iptables -A INPUT -s 10.0.4.247 -m time --kerneltz --datestart 2013-5-16T12 --datestop 2013-5-16T16 -j DROP
This is working as I am not able to ping from the ip 10.0.4.247

Quote:
iptables -A INPUT -s 10.0.4.247 -m time --datestart 2013-5-16T12 --datestop 2013-5-16T16 -j DROP
This rule by default set to follow UTC timezone but in man page it showing,the default is --kerneltz.[man of iptables v1.4.12]

can any one tell me what is problem with the iptables ,I need to block some ip/port for a specified time duration,but unable find what to do.

what is actually meaning of --kerneltz and is it safe to use this.

kindly tell some answer

Thanks

Last edited by pradiptart; 05-16-2013 at 08:01 AM.
 
Old 05-16-2013, 10:52 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,488

Rep: Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122
Quote:
Originally Posted by pradiptart View Post
Hi all,
I am using iptables for my project but facing some problem as follow.

1.in iptables 1.4.7
both the commands above is not working. As i can able to ping form 10.0.4.247 to the machine. why this is not working as default it should be --localtz.(man page of iptables v 1.4.7)
Again, trying to look things up first is a good idea. That version of iptables interprets time as UTC by default. So, figure out your time zone offset, and adjust the times accordingly. Also, the time is passed as 24 hour time.
Quote:
2.in iptables v 1.4.12
This is working as I am not able to ping from the ip 10.0.4.247 This rule by default set to follow UTC timezone but in man page it showing,the default is --kerneltz.[man of iptables v1.4.12]

can any one tell me what is problem with the iptables ,I need to block some ip/port for a specified time duration,but unable find what to do.
what is actually meaning of --kerneltz and is it safe to use this.
If you did read the man pages/documentation, you'd have seen what the --kerneltz option is and what it means:
Quote:
Originally Posted by IPTables Docs
Code:
--kerneltz           Work with the kernel timezone instead of UTC
The caveat with the kernel timezone is that Linux distributions may ignore to set the kernel timezone,
and instead only set the system time.
Even if a particular distribution does set the timezone at boot, it
is usually does not keep the kernel timezone offset - which is what changes on DST - up to date.
ntpd will not touch the kernel timezone, so running it will not resolve the issue. As such, one may encounter a
timezone that is always +0000, or one that is wrong half of the time of the year.
As such, using --kerneltz is highly discouraged.
And again, you are not running the latest version of iptables.
 
1 members found this post helpful.
Old 05-17-2013, 02:00 AM   #3
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Original Poster
Rep: Reputation: 12
Thanks for answer,
I will go with UTC as I have to use the older (v1.4.8) of iptables so no use of --kerneltz in that version as it is not present there.

Still I want ask UTC is fine or not.Is it guarenty the rule to apply or any problem in this version of iptables(v1.4.8).

Kindly tell .

Thanks
 
Old 05-17-2013, 09:48 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,488

Rep: Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122
Quote:
Originally Posted by pradiptart View Post
Thanks for answer,
I will go with UTC as I have to use the older (v1.4.8) of iptables so no use of --kerneltz in that version as it is not present there.

Still I want ask UTC is fine or not.
UTC is just a time...why would it not be 'fine'???
Quote:
Is it guarenty the rule to apply or any problem in this version of iptables(v1.4.8). Kindly tell .
Kindly go read the documentation, as you've been directed to before. Again, the 1.4.8 is SEVERAL versions behind, so if you're concerned about problems, then UPDATE IT.
 
1 members found this post helpful.
Old 05-22-2013, 06:28 AM   #5
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Original Poster
Rep: Reputation: 12
Hi,

Thanks for you answer ,

I have some problem with iptables v1.4.7 as follows

Quote:
iptables -A INPUT -s 10.0.4.247 -m time --utc --datestart 2013-5-22T8 --datestop 2013-5-22T11 -j DROP


The above command is not working as I can able to ping form the source Ip

the out put of time as follow in UTC
# date -u
Wed May 22 10:18:15 UTC 2013

Even I used UTC still it is not working in v1.4.7.

I have some dependencies to upgrade to latest.I have to use old one.
Is any thing that I am missing ,setting any value in kernel or any config file before using this utc option.

Kindly give some inputs.
Thanks

Last edited by pradiptart; 05-22-2013 at 07:36 AM.
 
Old 05-22-2013, 10:12 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,488

Rep: Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122Reputation: 8122
Quote:
Originally Posted by pradiptart View Post
Hi,
I have some problem with iptables v1.4.7 as follows
Code:
iptables -A INPUT -s 10.0.4.247 -m time --utc --datestart 2013-5-22T8 --datestop 2013-5-22T11 -j DROP
The above command is not working as I can able to ping form the source Ip

the out put of time as follow in UTC
# date -u
Wed May 22 10:18:15 UTC 2013

Even I used UTC still it is not working in v1.4.7. I have some dependencies to upgrade to latest.I have to use old one. Is any thing that I am missing ,setting any value in kernel or any config file before using this utc option.
Kindly give some inputs.
Well, if you have dependencies to upgrade, then UPGRADE THEM. Again, you need to upgrade to the latest version...from what you've posted, you're using THREE different versions on different machines, none of which is the latest, and one of which you upgraded to another old version(???).

And again, did you read the man page?? The --datestart option is NOT specified correctly.
Quote:
Originally Posted by iptables man page
--datestart YYYY[-MM[-DD[Thh[:mm[:ss]]]]]
--datestop YYYY[-MM[-DD[Thh[:mm[:ss]]]]]

Only match during the given time, which must be in ISO 8601 "T"
notation. The possible time range is 1970-01-01T00:00:00 to
2038-01-19T04:17:07.
Do you see anyplace where you specify the minutes and seconds?? Have you tried specifying it? Tried setting just the day and the time separately?
 
1 members found this post helpful.
  


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
From which version of iptables ,started supporting --kerneltz option. pradiptart Linux - Networking 1 05-15-2013 10:59 AM
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 command cmptrguru7 Linux - Networking 9 03-06-2006 11:08 AM
iptables command/iptables GUI? basketkase999 Linux - Security 5 04-12-2005 03:43 PM
Iptables command ThePlague Linux - Networking 6 02-16-2004 05:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:17 AM.

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
Open Source Consulting | Domain Registration