Pages

Welcome to My Blog

This is to share my IT experience with friends all around the world.
I have been working in Linux Fedora Systems for more than 8 years. Its fun to share knowledge and learn..
As everyone knows when a problem arises in your systems "googling" is the way that many depend on..

All the posts here are my working experiences during my working life.. So you can count on it..

I have added the references where I got help in solving IT issues


Thursday, May 26, 2011

Short & Sweeet

Under this topic I would like to state some useful tips in services and systems. Hope this will be a huge collection on commands/shortcuts one day...

  • Finding the DNS bind version of a DNS server
  • Command: dig version.bind txt chaos @dnsserver_ip
  • Stop displaying BIND version to outsiders in version.bind query
  • Just insert ' version "whatever you wan't to display for version queries"; ' to the options{}; E.g. options { directory "/var/named"; version "< HIDDEN >"; };
  • Display the directories (folders) in Linux
  • There are few ways of doing this in Linux.
    • ls -d */
    • This will display the directories in the current working directory
    • tree -d
    • This will list the directories in tree structure
    • echo */
    • This also displays the directories in a line. For example you can give the location as echo /home/* (which lists all the home folders of the users.)
  •   Accessing Zipped/Tar contents in Linux 
         Processing a .tar or .zip file, without decompressing it, is required in many occasions. Following commands are useful to extract data from a compressed archive.
    • tar -t
    • This will display or list the files/directories in the compressed archive.
    • zcat file1 | grep -e "test"
    • This will list all lines containing 'test' in the archived file file1. Similar to gunzip -c
       
File Contents filtering
    • cut 
                Very useful command to display the fields of a file.

    • grep
Few of very rare commands
Following commands are very rarely used but useful. Check whether you are familiar with them
  • ss
       This is very similar to netstat -nr but gives more information
  • pstree
  • This will display all the processes running currently along with associated child processes in tree format 
  • space
  • Space is a command which can be used to cheat history command. If you type the command with a space before the command, that command will not be listed with history command
Useful commands to 
  • check changed files in a directory (including sub directories) within a week and save details in to a file
find /path/to/the/directoty -mtime -7 -ls > changed_files
  • remove unwanted contents and send the details to someone
sed '/contents_to_be_removed/d' changed_files | nail -s "Changed files" -c cc_to@yourdomain someone@yourdomain
     
Here the 'find' command will list the files changed within a week time in the given directory and its subdirectories and the details will be written to the changed_files file. Later if you identifies any unwanted data in the listed file details, you can delete using 'sed' command the the patten of the content which should be deleted. The 'nail' command can be used to send the filtered content to someone and -c switch can be used to cc the mail to some other mail recipient.
 
 
 

Good reference

    Wednesday, May 25, 2011

    IPv6 in Fedora

    We have configured a DNS server to run both IPv4 and IPv6 (Dual Stack). The configuration steps were as follows
    1. Enable IPv6 Address

      • Settings in the /etc/sysconfig/network-scripts/ifcfg-eth0
      • Add following parameters to the file
        IPV6INIT=yes
        IPV6ADDR=
        IPV6_DEFAULTGW=


      • Restart the network
      • /etc/init.d/network restart


      • Check new settings
      • Use command ifconfig


      • Use network utility tools to check the data transfer in IPv6
      • traceroute6 gatewayip

        ping6 gatewayip

        tcpdump -n ip6 ....


    2. Configure DNS (BIND) to listen on IPv6 address as well

      • Edit /etc/named.conf with following parameters
      • listen-on-v6 port 53 { ipv6_address_of_the_server;};

        allow-query { 0.0.0.0/0; ::/0;};

        Note: If this is a caching DNS server for all, above settings are ok, else configure 'allow-query' with your network settings


    3. Enable firewall
      • Edit /etc/sysconfig/ip6tables

      add rules as you did in iptables

    Good references
    http://www.cyberciti.biz/faq/rhel-redhat-fedora-centos-ipv6-network-configuration/#comments
    http://www.sixxs.net/wiki/IPv6_Firewalling

    Wednesday, May 18, 2011

    Postfix Error - Virtual Mailbox Base

    bad string length 0 < 1: virtual_mailbox_base

    I got following error in Postfix main server which was used as a in-relay for few domains. The in-relay used to route all relay domain mails to virus scanner without putting them in to any mail box. It also had virtual domains settings;
    virtual_mailbox_domains = xyz.lk
    virtual_alias_maps = hash:/etc/postfix/virtua

    The error I got is as follows;

    fatal: bad string length 0 < 1: virtual_mailbox_base =
    May 19 11:18:38 malithi postfix/master[2473]: warning: process /usr/libexec/postfix/virtual pid 28307 exit status 1
    May 19 11:18:38 malithi postfix/master[2473]: warning: /usr/libexec/postfix/virtual: bad command startup -- throttling

    I followed several posts regarding the virtual_mailbox_base. Following post give a good understanding on virtual_mailbox_base issues;

    http://archives.neohapsis.com/archives/postfix/2008-02/0898.html
    http://readlist.com/lists/postfix.org/postfix-users/20/100947.html

    What I found was as I have configured virtual settings in master.cf it looks for virtual_mailbox_base parameter even-though I have not used any virtual transport. I commented the virtual settings in master.cf

    #virtual unix - n n - - virtual

    It stopped the error regarding the virtual_mailbox_base and worked fine.

    May be this will useful to you in your postfix configurations and error corrections.