Powerdns: rec_control command

The rec_control get command can be used to query the following statistics, either single keys or multiple statistics at once:

all-outqueries      counts the number of outgoing UDP queries since starting
answers0-1          counts the number of queries answered within 1 milisecond
answers100-1000     counts the number of queries answered within 1 second
answers10-100       counts the number of queries answered within 100 miliseconds
answers1-10         counts the number of queries answered within 10 miliseconds
answers-slow        counts the number of queries answered after 1 second
cache-bytes         Size of the cache in bytes (since 3.3.1)
cache-entries       shows the number of entries in the cache
cache-hits          counts the number of cache hits since starting
cache-misses        counts the number of cache misses since starting
chain-resends       number of queries chained to existing outstanding query
client-parse-errors counts number of client packets that could not be parsed
concurrent-queries  shows the number of MThreads currently running
dlg-only-drops      number of records dropped because of delegation only setting
dont-outqueries	    number of outgoing queries dropped because of 'dont-query' setting (since 3.3)
ipv6-outqueries     number of outgoing queries over IPv6
max-mthread-stack   maximum amount of thread stack ever used
negcache-entries    shows the number of entries in the Negative answer cache
noerror-answers     counts the number of times it answered NOERROR since starting
nsspeeds-entries    shows the number of entries in the NS speeds map
nsset-invalidations number of times an nsset was dropped because it no longer worked
nxdomain-answers    counts the number of times it answered NXDOMAIN since starting
outgoing-timeouts   counts the number of timeouts on outgoing UDP queries since starting
over-capacity-drops Questions dropped because over maximum concurrent query limit (since 3.2)
packetcache-bytes   Size of the packet cache in bytes (since 3.3.1)
packetcache-entries Size of packet cache (since 3.2)
packetcache-hits    Packet cache hits (since 3.2)
packetcache-misses  Packet cache misses (since 3.2)
qa-latency          shows the current latency average, in microseconds
questions           counts all End-user initiated queries with the RD bit set
resource-limits     counts number of queries that could not be performed because of resource limits
server-parse-errors counts number of server replied packets that could not be parsed
servfail-answers    counts the number of times it answered SERVFAIL since starting
spoof-prevents      number of times PowerDNS considered itself spoofed, and dropped the data
sys-msec            number of CPU milliseconds spent in 'system' mode
tcp-client-overflow number of times an IP address was denied TCP access because it already had too many connections
tcp-outqueries      counts the number of outgoing TCP queries since starting
tcp-questions       counts all incoming TCP queries (since starting)
throttled-out       counts the number of throttled outgoing UDP queries since starting
throttle-entries    shows the number of entries in the throttle map
unauthorized-tcp    number of TCP questions denied because of allow-from restrictions
unauthorized-udp    number of UDP questions denied because of allow-from restrictions
unexpected-packets  number of answers from remote servers that were unexpected (might point to spoofing)
uptime              number of seconds process has been running (since 3.1.5)
user-msec           number of CPU milliseconds spent in 'user' mode

In the rrd/ subdirectory a number of rrdtool scripts is provided to make nice graphs of all these numbers. Use rec_control get-all to get all statistics in one go.

It should be noted that answers0-1 + answers1-10 + answers10-100 + answers100-1000 + packetcache-hits + over-capacity-drops = questions.

Every half our or so, the recursor outputs a line with statistics. More infrastructure is planned so as to allow for Cricket or MRTG graphs. To force the output of statistics, send the process a SIGUSR1. A line of statistics looks like this:

Feb 10 14:16:03 stats: 125784 questions, 13971 cache entries, 309 negative entries, 84% cache hits, outpacket/query ratio 37%, 12% throttled

This means that there are 13791 different names cached, which each may have multiple records attached to them. There are 309 items in the negative cache, items of which it is known that don't exist and won't do so for the near future. 84% of incoming questions could be answered without any additional queries going out to the net.

The outpacket/query ratio means that on average, 0.37 packets were needed to answer a question. Initially this ratio may be well over 100% as additional queries may be needed to actually recurse the DNS and figure out the addresses of nameservers.

Finally, 12% of queries were not performed because identical queries had gone out previously, saving load servers worldwide.

Src: http://doc.powerdns.com/recursor-stats.html

Share

Insall cache only powerdns server

I decided to install another caching dns server , after some research I found PowerDNS. it uses MySQL for storing its zones , but hopefully its caching component doesnt need mysql , so great , lets go and install it.
My favourite OS is debian lenny , so I ran the following command :

1 apt-get install pdns-recursor

WOW , it was very simple ! it is already working on localhost , but I needed it to listen on all IPs on my box and accept queries from everyone :D I wanted to serve public :p so I went to /etc/powerdns and opened “recursor.conf” file and made the following changes :

1 allow-from=
2 local-address=0.0.0.0

and restarted the service by :

1 /etc/init.d/pdns-recursor restart

it’s done :D now it is working as a public caching name server.

Share

Upgrading Cacti

  1. Backup the old Cacti database.

    shell> mysqldump -l --add-drop-table cacti > mysql.cacti

    Note: You will probably have to specify the -u and -p flags for the MySQL username and password. This user must have permission to read from Cacti's database or you will end up with an empty backup.

  2. Backup the old Cacti directory.

    shell> mv cacti cacti_old

    Read more

Share

Install GUI ins Ubuntu Server

First you nee to make sure you have enabled Universe and multiverse repositories in /etc/apt/sources.list file once you have enable you need to use the following command to install GUI

sudo apt-get update

sudo apt-get install ubuntu-desktop

The above command will install GNOME desktop

If you wan to install a graphical desktop manager without some of the desktop addons like Evolution and OpenOffice, but continue to use the server flavor kernel use the following command

sudo aptitude install –without-recommends ubuntu-desktop

If you want to install light weight desktop install xfce using the following command

sudo apt-get install xubuntu-desktop

If you want to install KDE desktop use the following command

sudo apt-get install kubuntu-desktop

Share

SCP in linux

In Unix, you can use the scp command to copy files and directories securely between remote hosts without starting an FTP session or logging into the remote systems explicitly. The scp command uses SSH to transfer data, so it requires a password or passphrase for authentication. Unlike rcp or FTP, scp encrypts both the file and any passwords exchanged so that anyone snooping on the network can't view them.

Warning: Be careful when copying between hosts files that have the same names; you may accidently overwrite them.

The syntax for the scp command is:

scp [options] [[user@]host1:]filename1 … [[user@]host2:]filename2

For example, if user dvader is on a computer called empire.gov, and wants to copy a file called file1.txt to a directory called somedir in his account on a computer called deathstar.com, he would enter:

scp file1.txt dvader@deathstar.com:somedir

Likewise, if he wanted to copy the entire contents of the somedir directory on deathstar.com back to his empire.gov account, he would enter:

scp -r dvader@deathstar.com:somedir somedir

Similarly, if he is working on another computer, but wanted to copy a file called file1.txt from his home directory on empire.gov to a directory called somedir in his account on deathstar.com, he would enter:

scp dvader@empire.gov:file1.txt dvader@deathstar.com:somedir

When using wildcards (e.g.,  *  and  ? ) to copy multiple files from a remote system, be sure to enclose the filenames in quotes. This is because the Unix shell, not the scp command, expands unquoted wildcards.

For more information about scp, consult its man page. At the Unix prompt, enter:

man scp

Share

How to enable automatic logon in Windows 2003 Advanced Server

Use Registry Editor (Regedt32.exe) to enable automatic logon

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756  (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows

To enable automatic logon, follow these steps:

  1. Start Regedt32.exe, and then locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  2. Using your account name and password, double-click the DefaultUserName entry, type your user name, and then click OK.
  3. Double-click the DefaultDomainName entry, type the domain name, and then click OK.
  4. Double-click the DefaultPassword entry, type your password, and then click OK.

    Note If the DefaultPassword value does not exist, follow these steps:

    1. Click Add Value on the Edit menu.
    2. In the Value Name box, type DefaultPassword, and then click REG_SZ for the Data Type
    3. Type your password in the String box, and then save your changes.

    Also, if no DefaultPassword string is specified, Windows automatically changes the value of the AutoAdminLogon key from 1 (true) to 0 (false), which disables the AutoAdminLogon feature.

  5. Click Add Value on the Edit menu, enter AutoAdminLogon in the Value Name box, and then click REG_SZ for the Data Type.
  6. Type 1 in the String box, and then save your changes.
  7. Quit Regedt32.
  8. Click Start, click Shutdown, and then click OK to turn off your computer.
  9. Restart your computer and Windows. You are now able to log on automatically.

NOTE: To bypass the AutoAdminLogon process, and to log on as a different user, hold down the SHIFT key after you log off or after Windows restarts.

Src: http://support.microsoft.com/kb/310584

Share

When i installed Debian, i forgot to install GNOME! How to install?

apt-get install x-window-system

Once X installed proceed with gnome, following packages are minimum but gives you gnome gui based interface… so on it's easier to add other packages from synaptic.

apt-get install gnome-core gdm synaptic

Be careful on you /et/apt/source.list file- if the CDROm is un-commented then installation will begin from CDRom otherwise it will download from internet… it's a relatively bigger downloads!

Share

.htaccess tips and tricks

Redirecits

redirectpermanent /training/test.html http://www.example.com/learning/newtest.html

Allow SSI FIles

AddType text/html .shtml .shtm .htm .html

AddHandler server-parsed .shtml .shtm .htm .html

Parsing PHP in HTML

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html 

Allow or prevent directory browing

IndexIgnore */*

Options +Indexes

Password Protection

<Files secret_file.html>
    AuthType Basic
    AuthName "Team Page"
    AuthUserFile path_to_password_file
    Require user username
</Files>
Share

Public DNS Servers List

=> Service provider: Google
Google public dns server IP address:

  • 8.8.8.8
  • 8.8.4.4

=> Service provider:Dnsadvantage
Dnsadvantage free dns server list:

  • 156.154.70.1
  • 156.154.71.1

=> Service provider:OpenDNS
OpenDNS free dns server list / IP address:

  • 208.67.222.222
  • 208.67.220.220

=> Service provider:Norton
Norton free dns server list / IP address:

  • 198.153.192.1
  • 198.153.194.1

=> Service provider: GTEI DNS (now Verizon)
Public Name server IP address:

  • 4.2.2.1
  • 4.2.2.2
  • 4.2.2.3
  • 4.2.2.4
  • 4.2.2.5
  • 4.2.2.6

=> Service provider: ScrubIt
Public dns server address:

  • 67.138.54.100
  • 207.225.209.66
Share

Linux Rescue Mode, recovering from boot

When things go wrong, there are ways to fix problems. However, these methods require that you understand the system well. This chapter will describe the ways that you can boot into rescue mode and single user mode, where you can use your own knowledge to repair the system.

What is Rescue Mode?

Rescue mode provides the ability to boot a small Linux environment entirely from a diskette, CD-ROM, or using some other method.

As the name implies, rescue mode is provided to rescue you from something. During normal operation, your Red Hat Linux system uses files located on your system's hard drive to do everything — run programs, store your files, and more.

However, there may be times when you are unable to get Linux running completely enough to access its files on your system's hard drive. Using rescue mode, you can access the files stored on your system's hard drive, even if you cannot actually run Linux from that hard drive.

Normally, you will need to get into rescue mode for one of two reasons:

  • You are unable to boot Linux.

  • You are having hardware or software problems, and you want to get a few important files off your system's hard drive.

Next, we will take a closer look at each of these scenarios.

Read more

Share