nothing is impossible!!!!

nothing is impossible!!!!

Wednesday, February 18, 2009

All about : NTP

I had this plan long back that i will keep my own configurations and documents ready for others to use it. My memory is very short, so i forget things very often. One day i came across this blogger and found best way to keep everything at one place and need not to carry single paper anywhere.

Planning to start All about sessions on all servers, topics etc. Anything which is interesting and information about it is scattered everywhere. hope will be able to do that.

NTP (Network Time Protocol)
---------------------------
What is it ?
Used to synchronize the clocks of computers to some time reference.

NTP uses UDP/IP packets for data transfer because of the fast connection setup and response times.

Port number for the NTP (that ntpd and ntpdate listen and talk to) is 123.

how many ntp servers available in Internet?
According to ntp.org there are 175,000 ntp servers are available in the Internet. Among these there were over 300 valid stratum-1 servers. In addition there were over 20,000 servers at stratum 2, and over 80,000 servers at stratum 3.

ntp commands
ntpd - A daemon process that is both, client and server.
ntpdate - A utility to set the time once, similar to the popular rdate command.
ntpq, ntpdc - Monitoring and control programs that communicate via UDP with ntpd.
ntptrace - A utility to back-trace the current system time, starting from the local server.

time references
- A reference clock is some device or machinery that spits out the current time.
- A reference clock will provide the current time, that's for sure.
- NTP will compute some additional statistical values like offset (or phase), jitter (or dispersion), frequency error, and stability.

There are serveral ways how a NTP client will know about NTP servers to use:
- Servers to be polled can be configured manually
- Servers can send the time directly to a peer
- Servers may send out the time using multicast or broadcast addresses

- ntpd's reaction will depend on the offset between the local clock and the reference time.
- For a tiny offset ntpd will adjust the local clock as usual; for small and larger offsets, ntpd will reject the reference time for a while.
- In the latter case the operation system's clock will continue with the last corrections effective while the new reference time is being rejected.
- After some time, small offsets (significantly less than a second) will be slewed (adjusted slowly), while larger offsets will cause the clock to be stepped (set anew).
- Huge offsets are rejected, and ntpd will terminate itself, believing something very strange must have happened.

stratum 1
A server operating at stratum 1 belongs to the class of best NTP servers available, because it has a reference clock attached to it.

Servers synchronized to a stratum 1 server will be stratum 2.

Tuesday, December 30, 2008

RRDtool in short....

Copied notes from: http://oss.oetiker.ch/rrdtool/tut/rrdtutorial.en.html
- RRDtool refers to Round Robin Database tool.
- RRDtool works with with Round Robin Databases (RRDs). It stores and retrieves data from them.
- RRDtool stores all sort of time-series data.
- If you measure some value at several points in time and provide this information to RRDtool. RRDtool will be able to store it.
- RRDtool originated from MRTG.
- RRDtool create graphs in PNG formats.
- We only need sensors to measure the data and able to feed the data into RRDtool.
- Create sample Round Robin Database,
rrdtool create test.rrd --start 920804400 DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10
- Update database,
rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363
rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373
- fetch data from database,
rrdtool fetch test.rrd AVERAGE --start 920804400 --end 920809200
- "NaN" stands for "Not A Number" - Something is wrong.
- "UNKN" stands for "UNKNOWN", which is ok.
- Create graphics,
rrdtool graph speed.png --start 920804400 --end 920808000 DEF:myspeed=test.rrd:speed:AVERAGE LINE2:myspeed#FF0000

There are several ways for RRDtool to get a rate from its input:
* GAUGE: keep it "as is". The input is already a rate. An example would be a speedometer. This is also the type used for keeping track of temperature and such.

* COUNTER: look at the difference between the previous value and the current value (the delta). An example would be an odometer. The rate is computed as: delta(counter) divided by delta(time).

* ABSOLUTE: as the odometer, but now the counter is reset every time it is read. Computed as: value divided by delta(time).

* DERIVE: as COUNTER, but now it can also go back. An example could be something monitoring a bidirectional pump. The resulting rate can be negative as well as positive.

Sunday, December 28, 2008

Redhat Directory Server

Port Numbers:
- The Directory Server instance (LDAP) has a default port number of 389.
- Administration Server port number has a default number of 9830. If the default port number for either server is in use, then the setup program randomly generates a port number larger than 1024 to use as the default.
- For LDAPS (LDAP with TLS/SSL), the default port number is 636.

Directory Manager:
- Directory Server setup creates a special user called the Directory Manager.
- A unique, powerful entry that is used to administer all user and configuration tasks.
- access controls. password policy, and database limits for size, time, and lookthrough limits do not apply to the Directory Manager.
- It is used only for authentication.
- The Directory Server setup process prompts for a distinguished name (DN) and a password for the Directory Manager.
- The default value for the Directory Manager DN is cn=Directory Manager.

Directory Administrator
- The Directory Administrator is the "super user" that manages all Directory Server and Administration Server instances through the Directory Server Console.

Administration Server User
- By default, the Administration Server runs as the same non-root user as the Directory Server.

There are important differences between the Directory Administrator and the Directory Manager:
* The administrator cannot create top level entries for a new suffix through an add operation. either adding an entry in the Directory Server Console or using ldapadd, a tool provided with OpenLDAP. Only the Directory Manager can add top-level entries by default. To allow other users to add top-level entries, create entries with the appropriate access control statements in an LDIF file, and perform an import or database initialization procedure using that LDIF file.
* Password policies do apply to the administrator, but you can set a user-specific password policy for the administrator.
* Size, time, and lookthrough limits apply to the administrator, but you can set different resource limits for this user.

setup-ds-admin.pl
- The Directory Server and Administration Server instances are created and configured through a script call setup-ds-admin.pl.
- to set the machine name, suffix, and Directory Server port of the new instance, the command is as follows:
/usr/sbin/setup-ds-admin.pl General.FullMachineName=ldap.example.com “slapd.Suffix=dc=example, dc=com” slapd.ServerPort=389
- When the setup-ds-admin.pl finishes, it generates a log file in the /tmp directory called setupXXXXXX.log where XXXXXX is a series of random characters.
-

Friday, December 19, 2008

Difference between innodb and myisam.

- MyISAM offers speed where as InnoDB offers reliability.
- Innodb support transactions, MyISAM not.
- InnoDB also supports row-level locking, while MyISAM only supports table locking.
- InnoDB is specifically for high volume, high performance.
- With replication it's even possible to take advantage of both storage engines on one table. For example, the master could store a table as InnoDB which makes it fast for INSERTs, UPDATEs and DELETEs while the slave(s) could store the same table as MyISAM and offer the best performance for SELECTs.
-

Thursday, December 18, 2008

Limiting closed port RST response from 266 to 200 packets/second.

Kernel default setting for icmp response is set to 200.
net.inet.icmp.icmplim sysctl limits.

Possible reasons are,
1. This generally means the system is being portscanned or a similar activity on the machine. In worst case someone trying to do DOS attack.
I suggest that you set the following sysctl variables,
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1

2. But it can also mean that a often-used service on the machine (like http or a database server) is down and you're getting a lot of failed connection requests from clients.