Virtual Box and Virtual interfaces on mac os X ( loop back interfaces)

In CategoryMacintosh

GNS3 on mac osx  – connecting gns3 lab to internet on mac osx – loopback interfaces on mac osx



When working with some applications we may need loop back interfaces.( I needed for GNS3 ,on which I could connect my gns3 lab routers to external world (internet) or vmware /virtual box guests on my system.

It is very easy to add a loop back interface on windows. But on macintosh it may appear difficult to get it work.

I am quite familiar with mac os and I consider myself an advanced mac user  ,but  still it took 2 days for me to make gns3 work on macbook with all the features -not less than any of windows gns3 version.  I will breifly write here how I did it.

Though I have dual boot ( windows and mac osx using bootcamp)on my macbok  , I wanted to completeley eliminate the need of running windows for my exam preparation . So i had 3 challanges

1. Running GNS3 on mac osx with the tabbed connections terminal like how we use secure crt on windows ( see my post about tabbed connections with the combination of GNS3&secureCRT on windows).

2.Connecting lab routers to internet or vmware/virtual box guests  on mac osx..

3. Running  .vce files on mac  os x ( vce file can be opened with visual cert exam suite which runs only on windows)


1.On the first day ,I downloaded and installed gns3 ( which, gns3 developers say it is experimental package on mac osx)  on macbook on which i was running mac osx 10.5.8   . After installation when i click on gns3 app  It just stayed without any response. I searched gns3 forums and found many people are having same issue with mac osx 10.5 .

Then i gave a try with mac osx 10.6 on my mac book and it worked well  ,but only thing i needed to do was , changing the directory&configuration paths for net files which are copied from windows environment.

Then I wasted quite some time  with secure CRT on mac osx to make it work for gns labs with tabbed connections , until I found that iTerm can also be used for the tabbed connections. I even changed the look of iTerm  with a downloaded  iTerm profile theme ( download iterm here)

2.I downloaded and installed virtualbox 4.1.2  for my mac osx from here .

Then I wanted to have tap interfaces ( virtual interfaces on my mac) . For this, I downloaded tuntap which comes with tunnel&tap interfaces. But at first time it returned an error saying ” ifconfig : interface tap0 does not exist ”  when i typed in  ifconfig tap0 up



Then I opened the gns3 project net file and added the line f0/0 = NIO_TAP:/dev/tap0 so my net filed looked like ,

model = 2691
console = 2000
x = -119.0
y = -104.0
f0/0 = NIO_tap:/dev/tap0

and then I made dynamips  to run with root permissions with this command

#sudo chown root:wheel /Applications/

( Assuming I have GNS3 app in applications directory and i am running 32bit , if it was 64 bit I could replace with dynamips-0.2.8-RC3-community-OSX.intel64.bin)

But this time GNS3 thrown an error message saying “206-unable to create TAP NIO  .

Finally I understood that 206-unable to create TAP NIO error  is due to file permissions on /dev/tap and /dev/tun devices and I typed the commands which made my day .

#chmod 666 /dev/tap*

#chmod 666 /dev/tun*














Below  is  My gns3 test router which connected to loop-back interface.




3.To run vce files , I downloaded and installed crossover for macosx which allows to run windows applications from mac desktop itself, means no need to run parallel or vmware to run windows applications.

The problem is crossover is not free , If you can spare some time and take it as challenge then try wine  which is free and many people say difficult to install ( Hope I will be writing how to install wine on Macintosh in my next post !).

crossover ( free version is wine) is a kind of emulator , but run cross-platform applications( windows,macintosh,linux) natively without the need of having  actual OS ( on vmware we should have installation disk to install os first).

I created a bottle and installed internet explorer,visual cert exam suite on mac osx  .












Receive Linux command history to mail automatically

In CategoryLinux



Basically i am a tech-enthusiastic.

When we seek for any support, Linux admins used to connect and work remotely on our servers which are hosted in a remote location.

I was so interested to know how they fix the issues , So i came up with this idea of getting the history of terminal commands they typed in to terminal into my mailbox automatically.

I tried this small script and it worked well.

I first created a script which will send a mail with the history contents.

#cd /tmp


and typed the below lines.

mail -s “Log $HOSTNAME @ $NOW” <$HOME/.bash_history

entered !wq to save and quit from vi editor and to make it executable

#chmod -x

Now the script is ready to send email with the bash history.

We can test it by executing the script #./

Now We can add the script to crontab and schedule it to send email periodically .

I wanted make it to send the command history automatically whenever  the .history file is modified whichmeans ,

whenever someone connected to terminal ,I should receive an mail with a copy of the terminal commands history.

To achive this I used incrontab . Incrontab is just like cron scheduler , but with additional capabilities

-which allows us to configure like file ,directory watch etc.,.


I downloaded incron rpm from and



After adding root user to /etc/incron.allow , I typed incrontab -l  which returnded “no table for root’  ,because I dont have any jobs configured yet.

I typed #incrontab -e to create a user table and added this line ~/.bash_history IN_MODIFY /tmp/./

( assuming we have the script file in temp directory) .


Voila thats all ! I just received an email








Installing and configuring ftp on Linux server

In CategoryLinux

Ftp feature is  useful especially when  the linux server is in remote location  and we want to transfer files to server .

Configuring ftp on linux is pretty straight forward  and may be the procedure is almost similar  in all  linux distros (   I should have put the post title as ‘configuring ftp on redhat linux’ for this post  as I am writing about the steps which I followed to install ftp on my redhat server).

1.installed  vsftp ( very secure ftp ) package with  the yum…yum… yummy  command    yum

2. Edited     /etc/vsftpd/vsftpd.conf    file

3.created a  ftp user  and changed  the user home directory


vsftpd installation:

when i typed the command yum install vsftpd i got the error message ‘failed to retrieve repodata/filelists.xml.gz from rhel-x86_64-server-5’

#yum install vsftpd

[Error: failed to retrieve repodata/filelists.xml.gz from rhel-x86_64-server-5
error was [Errno 14] HTTP Error 404: Not Found]
The program package-cleanup is found in the yum-utils package

You could try using –skip-broken to work around the problem
 You could try running: package-cleanup –problems
                        package-cleanup –dupes
                        rpm -Va –nofiles –nodigest


Finally i got vsftpd installed with the commands..

#sudo yum clean all

#sudo rhn-profile-sync    then   

#yum install vsftpd


Added ftp user: 

#useradd demoftp   (create a user with the name demoftp)

#passwd demoftp     (change password for user demoftp)

added the same user name in the file /etc/vsftpd/user_list

# vi /etc/vsftpd/user_list   ( press i to insert and use arrow keys to move the cursor .After typing in the username , press escape and   type   :wq and press enter to save and exit from vim editor)

Modified the vsftpd.conf file  :

#vi /etc/vsftpd/vsftpd.conf



and   changed userlist_enable=YES to userlist_enable=NO

my vsftpd.conf looked like this after editing


# Example config file /etc/vsftpd/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd’s
# capabilities.
# Allow anonymous FTP? (Beware – allowed by default if you comment this out).
# Uncomment this to allow local users to log in.
# Uncomment this to enable any form of FTP write command.
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd’s)
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# Activate directory messages – messages given to remote users when they
# go into a certain directory.
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
# Make sure PORT transfer connections originate from port 20 (ftp-data).
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using “root” for uploaded files is not
# recommended!
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING – changing this filename affects /etc/logrotate.d/vsftpd.log
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
# You may change the default value for timing out an idle session.
# You may change the default value for timing out a data connection.
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command “SIZE /big/file” in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
# (default follows)
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (default follows)
# You may activate the “-R” option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as “ncftp” and “mirror” assume
# the presence of the “-R” option, so there is a strong case for enabling it.
# When “listen” directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!


And finally ,Started the service  with the command service vsftpd start .

#service vsftpd start


And  i tried to login to ftp ,but got the error message   “500 OOPS: cannot change directory” .

I forgot to add selinux exception  ( selinux is a enhanced security policy feauture comes with newer version of kernels).

I did run the command ‘  /usr/sbin/setsebool  -P ftp_home_dir=1 ‘  from root and it fixed the problem.

I could have used  setsebool -P allow_ftpd_full_access 1  to allow  full access to ftp thorugh selinux.




Next, I binded a directory for demoftp user  which is out side of that user’s home directory.


# mount –bind//opt/apache2/htdocs/test/  /home/demoftp/    ( /opt/apache2/htdocs/test/ is the directory i want to access when i login  from ftp with  demoftp account).















# All About My bash #

In CategoryLinux

I am not a linux guru ! . But  in my work ,  I do say hello  at least once everyday  to my Linux servers  from bash .

Bash is a unix/linux command shell to execute commands . You can find different command shells like tcsh,sh,zsh,bash in bin directoryetc., .  But my favourite&default command shell on our servers is ‘BASH‘ .

Controlling bash seems interesting to me .

Typing the command history will display all the commands used previously on the system.

I exported commands to a file this way..

[root@c6 ~]# history > history.txt

you will find a file called  .bashrc in each user’s  home directory .

 I edited my .bashrc file 

[root@cf /]# vi ~/.bashrc

and added below lines

export HISTSIZE=10000                          ( history will remember 10000 commands) 

export HISTCONTROL=erasedups       ( this will erase duplicated commands and keep only one copy of each comamnd )

shopt -s histappend                                     (this line says that commands not to be overwritten but appended) 

Ok.. alright.. , Now what If  I dont like to save the command history ? .I will just use one of the methods below.

method 1#

To clear bash history when i am on terminal  , i use the command history -c 

[root@cf /]# history -c

This will clear entire bash history whereas history -r command will clear the current session history only. 

[root@cf /]# history -r

method 2#

clear bash history when logout the session

edit .bash_logout   file which we can find in every user home directory.

[root@cf ~]# vi ~/.bash_logout    press i  to insert below lines in vim editor



press escape and  type  :wq   and press enter  to save the changes in vim editor.

This method will not  clear the history if you close the window without logging out from the terminal by using the command logout

method 3 #

The command  ln -sf /dev/null ~/.bash_history  will tell bash to send  history of commands to null, so it will not remember any commands that are typed in.

 [root@cf ~]# ln -sf /dev/null ~/.bash_history 

And finally .. one thing I passionate about is ,receiving  bashhistory to my mail automatically . I will write it in my next post .

Disable IPv6 on Exchange server

In CategoryWindows Server Technology

When our complete network is running on ip v4  ,why  do we need ipv6 enabled on our server  2008 ? let us unselect the ipv6  form  the network adapter properties ……  ho .. wait …wait..! I did it on my exchange server 2010 and ran into problems .

If the windows version is  Windows sbs 2008 (Windows Small Business Server 2008) then we may  encounter some  issues  like

“Exchange server services will fail to start ” and the Microsoft Exchange Active Directory Topology service will fail to start .We can see one or more fallowing errors  in event viwer.


Application Log Events

Event ID: 2114 

Process MAD.EXE (PID=2088). Topology discovery failed, error 0x80040a02 (DSC_E_NO_SUITABLE_CDC). Look up the Lightweight Directory Access Protocol (LDAP) error code specified in the event description. To do this, use Microsoft Knowledge Base article 218185, “Microsoft LDAP Error Codes.” Use the information in that article to learn more about the cause and resolution to this error. Use the Ping or PathPing command-line tools to test network connectivity to local domain controllers.





System log events like,

The Microsoft Exchange Address Book service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.

The Microsoft Exchange RPC Client Access service terminated unexpectedly.  It has done this 1 time(s).  The following corrective action will be taken in 5000 milliseconds: Restart the service.

Also Excahnge server installation will fail with error like below .

The execution of: “$error.Clear(); if ($RoleStartTransportService) { start-SetupService -ServiceName MSExchangeTransport }”, generated the following error: “Service ‘MSExchangeTransport’ failed to reach  status ‘Running’ on this server.”


Though IP v 6  is supported  fully on windows 2008 server , If we disable ipv6  in network interface card (NIC) , we may run into some problems  especially if we are running exchange services or trying to install exchange server .

So it is better not to unselect the IPv6 .If we really need to disable ip v6 then unselecting the checkbox is not  enough alone. We  should also change registry modification .

method 1:

  1. Uncheck Internet Protocol Version 6 (TCP/IPv6) on Network Card.
  2. In Registry Editor, locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\
  3. Double-click DisabledComponents to modify the DisabledComponents entry.
    Note If the DisabledComponents entry is unavailable, we must create it. To do this, follow these steps:

    1. In the Edit menu, point to New, and then click DWORD (32-bit) Value.
    2. Type DisabledComponents, and then press ENTER.
    3. Double-click DisabledComponents.
  4. Enter “ffffffff” (eight f’s), and then click OK:









Quick method 2:

open command prompt with administrator privilages ( right click on command prompt and select run as administrator)  , and type the command  c:\>reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 255


Now finally ,  If we want to run vpn from the serevr on which we disbaled ipv6, we must delete the fallowing registry key and retsrat the server (make sure to export the key before deleting it). other wise routing and remote access will fail with event id 20103

  Event ID   : 20103
  Source     : Router
  Description: Unable to load c:\winnt\system32\iprtrmgr.dll