Archive for the ‘Linux’ Category.

Free Secondary DNS and Online DNS Tools

These free tools have been designed to validate and check the health of your public DNS servers.

How is my DNS

Network Tools

Free Secondary DNS for your domains. If your looking for another DNS to put your domain in, this is for you. Providing additional secondary servers can greatly improve the reliability and accessibility of your domain. Should your primary DNS become unavailable due to network problems, your secondary DNS entries come into play, the more DNS servers you have, the greater the resilience to errors.

Free Secondary DNS

How to setup a primary nameservers on a dedicated server

Here are the steps:

  1. Locate named.conf and go to that folder.
  2. Add DNS entries for your nameserver.
  3. Edit the pri.yourname.com file for the domain you are adding nameservers for.
    Add these two lines at the bottom of the file:
    ns1 IN A 10.10.10.10 (replace with your nameserver IP)
    ns2 IN A 10.10.10.10
    By the way, you can host your website and nameservers on the same IP.

  4. Reload the nameserver daemon.
    $ sudo /etc/init.d/bind9 reload
  5. Ping the nameservers, and they should resolve to the correct IP.
    If they do not, edit /etc/resolv.conf and add the following line above all other lines beginning with “nameserver”, add:
    nameserver 127.0.0.1
  6. Go to your registrar of your domain name, and register the nameservers to point to the your nameserver IP.

Keeping the Root Hints Current

To keep the root hints file current, use the following command.

$ dig @a.root-servers.net . ns > db.cache

How to check your DNS configuration and zone files

If you are running BIND 9, you have handy new tools to help maintain your nameserver files: named-checkconf and named-checkzone. These tools reside in /usr/sbin or /usr/local/sbin.

named-checkconf checks the configuration file for syntax errors.
$ /usr/sbin/named-checkconf zonename db.local
zone zonename/IN: loaded serial 1
OK

named-checkzone checks a zone file for syntax errors.
$ /usr/sbin/named-checkzone zonename pri.108.10.20.in-addr.arpa
zone zonename/IN: loaded serial 2004071902
OK

Installing your own DNS Server

This how-to assumes a Debian-type Linux server. 

1)  Install BIND

$ sudo apt-get install bind9

2)  Run BIND chrooted.  For security reasons we want to run BIND chrooted so we have to do the following:

$ sudo /etc/init.d/bind9 stop

Edit the file /etc/default/bind9 so that the daemon will run as the unprivileged user bind, chrooted to /var/lib/named. Modify the line: OPTIONS=”-u bind” so that it reads OPTIONS=”-u bind -t /var/lib/named”:

$ sudo vi /etc/default/bind9

OPTIONS="-u bind -t /var/lib/named"
# Set RESOLVCONF=no to not run resolvconf
RESOLVCONF=yes

3)  Create the necessary directories under /var/lib:

$ sudo mkdir -p /var/lib/named/etc
$ sudo mkdir /var/lib/named/dev
$ sudo mkdir -p /var/lib/named/var/cache/bind
$ sudo mkdir -p /var/lib/named/var/run/bind/run

4)  Then move the config directory from /etc to /var/lib/named/etc:

$ sudo mv /etc/bind /var/lib/named/etc

5)  Create a symlink to the new config directory from the old location (to avoid problems when bind gets updated in the future):

$ sudo ln -s /var/lib/named/etc/bind /etc/bind

6)  Make null and random devices, and fix permissions of the directories:

$ sudo mknod /var/lib/named/dev/null c 1 3
$ sudo mknod /var/lib/named/dev/random c 1 8
$ sudo chmod 666 /var/lib/named/dev/null /var/lib/named/dev/random
$ sudo chown -R bind:bind /var/lib/named/var/*
$ sudo chown -R bind:bind /var/lib/named/etc/bind

7)  We need to modify /etc/default/syslogd so that we can still get important messages logged to the system logs. Modify the line: SYSLOGD=”" so that it reads: SYSLOGD=”-a /var/lib/named/dev/log”:

$ sudo vi /etc/default/syslogd

## Top configuration file for syslogd
##
# Full documentation of possible arguments are found in the manpage
# syslogd(8).
#
#
# For remote UDP logging use SYSLOGD="-r"
#
SYSLOGD="-a /var/lib/named/dev/log"

9)  Restart the logging daemon:

$ sudo /etc/init.d/sysklogd restart

10)  Start up BIND, and check /var/log/syslog for errors:

$ sudo /etc/init.d/bind9 start

How to check if nameserver is valid (NS1.example.com, NS2.example.com)

A.  How to check if nameserver is valid

$ dig ns com
;; ANSWER SECTION:
com. 93009 IN NS a.gtld-servers.net.
com. 93009 IN NS b.gtld-servers.net.
com. 93009 IN NS c.gtld-servers.net.
com. 93009 IN NS d.gtld-servers.net.
com. 93009 IN NS e.gtld-servers.net.
com. 93009 IN NS f.gtld-servers.net.
com. 93009 IN NS g.gtld-servers.net.
com. 93009 IN NS h.gtld-servers.net.
com. 93009 IN NS i.gtld-servers.net.
com. 93009 IN NS j.gtld-servers.net.
com. 93009 IN NS k.gtld-servers.net.
com. 93009 IN NS l.gtld-servers.net.
com. 93009 IN NS m.gtld-servers.net.

$ host NS1.example.com i.gtld-servers.net
Using domain server:
Name: i.gtld-servers.net
Address: 192.10.10.10#53
Aliases:

NS1.example.com has address 69.10.10.180

If the nameserver is invalid, you will not have the last line above.

B.  To check nameserver configuration of a site, do this:

$ nslookup -q=any example.com

Create thumbnails from image in one command

In Linux, issue this command

$ convert -thumbnail 200 INPUT_FILE.png OUTPUT_FILE.png

To convert into another image type, just change the output file extension — as simple as that!

$ convert -thumbnail 200 INPUT_FILE.png OUTPUT_FILE.jpg

For more information please visit Cyberciti.biz Tips on How to create image thumbnails.

How to remove .svn folder

Windows:

Save the following to the folder to clean to a filename with a .cmd extension (cleansvn.cmd).  After that issue the command, eg., C:\www>cleansvn

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( rd /s /q "%%i" )

Linux: 

Cleaning a svn folder:

find . -name .svn -exec rm -rf {} \;

Using svn export:
Export from your working copy (doesn’t print every file and directory):

$ svn export a-wc my-export
Export complete.

Export directly from the repository (prints every file and directory):

$ svn export file:///var/svn/repos my-export
A my-export/test
A my-export/quiz

Exported revision 15.

How To Copy a DVD/VCD Using Mplayer/Mencoder

Here’s the command:

mencoder dvd://4 -oac copy -avc copy

mencoder is the executable program
dvd:// is the name of the input device
4 means the fourth track. You can omit this information to copy the whole disc.
-oac copy means just copy the default audio encoding.
-ovc copy means just copy the default video encoding.

Vi is misbehaving with my arrow keys!

(Note: The following blog entry is for Linux users and may not be of any use to Windows users.  No discrimination intended.)

In my earlier days, I always use nano as my editor of choice whenever I’m on a Linux console because it is easier to use by a person accustomed to using Windows. Later, I have adjusted myself and found vi interesting and easier to use! Ever since, I am solely a vi user until I encountered a difficulty running vi on my hosting server.

The problem is that whenever I open or create a file and start using the arrow keys, I instead got the following:

Up arrow outputs “A” + next line
Down arrow outputs “B” + next line
Right arrow outputs “C” + next line
Left arrow outputs “D” + next line

By googling, I found the solution on Digitalblueprint. So it’s basically creating or editing the .vimrc file on your home folder. Linux home folder is your default folder after logging in to your Linux computer and you can return to the home folder from anywhere by entering the cd, change directory, command without any parameter.

Here’s what you need to have on your .vimrc file:

filetype plugin on
filetype indent on
syntax on

Also after this fix, you would see the normal status messages that shows – INSERT –, – REPLACE – on the bottom of the screen.

Happy vimming!