Showing posts with label virtualbox. Show all posts
Showing posts with label virtualbox. Show all posts

Sunday, November 17, 2013

Installing vpnc - Linux VPN Client for Cisco VPN

This tutorial, I will show you how to configure vpnc on Linux and  connect  Cisco devices through vpn using pcf file. The vpnc is an alternative Linux software for Cisco vpn client.
all the things are done on centos 6.3 but steps should be same for any Linux system.


1) Installing EPEL repo

Since centos repo doesn't contain the vpnc, we need to configure additional repo call EPEL.
It is straightforward installation and  document can be found form here.

http://fedoraproject.org/wiki/EPEL/FAQ#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F

Please find "How can I install the packages from the EPEL software repository? " from content and install it. you may need to enable EPEL repo sometime.

2) Installing vpnc

once you enabled the rpmforge repo, type following command to install vpnc  
[root@localhost ~]#yum install vpnc

3)Chang folder permission

I installed the vpnc as root.if you wish to run vpnc as normal user other than root .change file permission of vpnc installaion directory
/etc/vpnc/vpnc-script

4)Download pcf2vpnc

[root@localhost ~]#wget http://svn.unix-ag.uni-kl.de/vpnc/trunk/pcf2vpnc

5)Convert pcf file

[root@localhost ~]#perl pcf2vpnc demopcf.pcf demovpnc.conf
change ownership of *.conf file if you need

6)copy *.conf to /etc/vpnc/ 

[root@localhost ~]#cp demovpnc.conf /etc/vpnc/

7)Start vpnc

[root@localhost ~]#vpnc demovpnc
Enter password for user@A.B.C.D:
(A.B.C.D is public ip address where you need to connect, user is username , you need to enter password )

8)disconnect vpnc

[root@localhost ~]#vpnc-disconnect

Sunday, October 27, 2013

nagios snmptt configuration

Hi folks after long time !. Today I'm going to demonstrate how to configure SNMP trap inside Nagios using SNMPTT. This simulation is done at Virtualbox 4.1.26 using two guest OS ( one guest act as server and running Nagios and snmptt, other is to generate SNMP trap and it is the client)

both guest are running Centos 6.3 32bit.

Server info :- ip 192.168.56.103
Client info :- 1p 192.168.56.104

I hope you have installed and configured the Nagios, If not you can follow installation guide
http://nagios.sourceforge.net/docs/nagioscore/4/en/quickstart-fedora.html

-----

So let's install snmptt. :)
download and extract latest version of SNMPTT. you can find official installation document from here
http://www.snmptt.org/docs/snmptt.shtml#Installation-Overview

For both server and client require net-snmp-lib , net-snmp-util so install them using using yum
yum install net-snmp-lib
yum install net-snmp-util


AT Server


1)Install prerequirement such as net-snmp, perl ,perl modules


[root@nagios ~]# yum install net-snmp
[root@nagios ~]# yum install perl

install perl cpan
[root@nagios ~]# yum install perl-CPAN

launch the CPAN using following command
[root@nagios ~]# perl -MCPAN -e shell

install following perlmodules 
(Getopt::Long,  Text::ParseWords ,SNMP, Config::IniFiles, Time::HiRes , Sys::Hostname , File::Basename, Text::Balanced )
for an instance
cpan[1]> install Text::ParseWords


This demonstration is done with Standard handler – with standlone mode which is straightforward (remember there is daemon mode)


2) Copy snmptt to /usr/sbin/ and ensure it is executable (chmod +x snmptt)

[root@nagios snmptt_1.3]# cp s[root@nagios snmptt_1.3]# chmod +x /usr/sbin/snmptt nmptt /usr/sbin/

3) Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)

[root@nagios snmptt_1.3]# cp snmptthandler /usr/sbin/
[root@nagios snmptt_1.3]# chmod +x /usr/sbin/snmptthandler

4) Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.

[root@nagios snmptt_1.3]# cp snmptt.ini /etc/snmp/

5) Create the log folder /var/log/snmptt/.

[root@nagios snmptt_1.3]# mkdir -p /var/log/snmptt/


6) For standlone mode:  Modify the Net-SNMP snmptrapd.conf file by adding the following line:

[root@nagios ~]# vim /etc/snmp/snmptrapd.conf
traphandle default /usr/sbin/snmptt
disableAuthorization yes

7) Edit the /etc/logrotate.d/snmptt and update the paths and rotate frequency as needed.

[root@nagios snmptt_1.3]# cp snmptt.logrotate /etc/logrotate.d/snmptt


8) Start snmptrapd using the command line:  snmptrapd -On.

[root@nagios snmptt_1.3]# snmptrapd –On

--

9) Convert MIB file


Copy eventhandler
[root@nagios ~]# cp /home/shehan/Downloads/nagios-4.0.1/contrib/eventhandlers/* /usr/local/nagios/libexec/eventhandlers

copy snmpttconvertmib into /usr/sbin/ folder
[root@nagios ~]# cp /home/shehan/Downloads/snmptt_1.3/snmpttconvertmib /usr/sbin/

then issue below command
[root@nagios ~]#snmpttconvertmib --in=/usr/share/snmp/mibs/SNMPv2-MIB.txt --out=/etc/snmp/snmptt.conf.SNMPv2-MIB \
--exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1'


10) Edit /etc/snmp/snmptt.ini, and change below settings

[General]
mode = standalone
net_snmp_perl_enable = 1
unknown_trap_log_enable = 1

At end of file you can find line similar to this Add /etc/snmp/snmptt.conf.NET-SNMP-EXAMPLES-MIB like below

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf
/etc/snmp/snmptt.conf.NET-SNMP-EXAMPLES-MIB
END


11) create host cfg file

[root@nagios ~]# vim /usr/local/nagios/etc/objects/remote-host.cfg
And add below (you may need to change ip host_name)


define host {
        use     linux-server
        host_name       remote-host
        alias           remote-host-alias
        address         192.168.56.104
        }

define service{
        use                        generic-service
        name                       trap-service
        register                   0
        service_description        TRAP
        is_volatile                1
        check_command              check-host-alive
        max_check_attempts         1
        normal_check_interval      1
        retry_check_interval       1
        notification_interval      31536000
        active_checks_enabled      0
        passive_checks_enabled     1
    check_period           24x7
        }

define service{
        use                        trap-service
        host_name                  remote-host
        }



12) Add blow command to nagios.cfg

[root@nagios ~]# vim /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/remote-host.cfg


13)allow snmp trap from firewall

[root@nagios ~]# iptables -I INPUT 1 -p udp --dport snmptrap -j ACCEPT

confirm the changes and then save using below command
[root@nagios ~]# iptabless –list
[root@nagios ~]# service iptables save

14) start service at server

[root@nagios ~]# service snmptrapd start
[root@nagios ~]# service snmpd start

configure to start at boot
[root@nagios ~]#chkconfig snmptrapd on
[root@nagios ~]#chkconfig snmpd on


AT Client,

generate SNMP trap message, this is SNMP v2 message

[root@localhost ~]# snmptrap -v 2c -c public 192.168.56.101 "" SNMPv2-MIB::coldStart coldStart  s "start"


AT Server


check below log messages
/var/log/messages
/var/log/snmptt/snmptt.log
And check nagios web interface.If everything works fine you can have similar output like below


nagios and  snmptt








----


Reference URLS

http://xavier.dusart.free.fr/nagios/en/snmptraps.html
http://hummy.wikidot.com/how-to-send-and-receive-snmp-traps
http://socketubs.org/docs/sysadmin/snmp_traps_nagios.html


Thursday, April 18, 2013

Virtualbox file sharing between guest and host OS

Have you ever try to transfer files between VirtualBox guest OS and host OS ?
unfortunately drag and drop file transferring/sharing is not yet implemented on virtaulbox.so we have to look for alternative method.This is what I have done.my both host and guest OS are windows , remember this is possible on Linux environment with different commands.


[1] Run the guest OS


open Virtualbox then select and run guest OS that you need to transfer file.Here I used Windows XP as my guest OS


[2] Install Guest Additions


On the VirtualBox menu click " Devices " --> " Install Guest Additions... " and follow the instruction, If you get warning similar to below Click " continue anyway" to continue the installation and finally reboot guest OS.









virtualbox guestadditions Hardware installation


























[3] Create shared folder


go Machine --> Settings... you will have Virtual machine setting windows
then select  " shared Folders " ,as below



create Shared folder virtualbox



then click folder with "+" sign (right-hand corner ) to create shared folder on host OS as above screenshot.
Then you will have window called "Add share" like below, Choose the Folder Path and give a Folder Name.


virtualbox shared folder






















[4]Transfer file to guest OS


Start the guest OS (I used windows XP as my guest OS) open " Run " and type the below command
please note I used "sharedfiles" as folder Name. look at above screen shoot

\\vboxsvr\sharedfiles



vboxsvr





















once you type click "OK" , then you can open shared folder of the host machine.
If you reboot the guest OS this shared folder may not available therefore change shared folder setting as required

Happy file sharing !

Friday, January 25, 2013

virtualbox seamless mouse pointer integration and install guest additions

While running the Redhat linux on Virtual box, every time when I want to leave from
guest OS to host system I need to press "Ctrl" key (my Host key is Ctrl) .This is because seamless mouse pointer integration is not enable. This is painful and takes time to jump between guest OS and host system. After reading some forums post and web articles I have come across with a solution.In this method there will be one mouse pointer and pressing the Host key is no longer required to "free" the mouse from being captured by the guest OS and vice-versa. Following steps guide how to enable seamless mouse support on linux based guest system.


[1] install gcc and kernel-devel

install the GNU C compiler and the kernel development packages using

#yum install gcc

followed by

#yum install kernel-devel


[2] Reboot guest system

Reboot your guest system in order to activate the updates.

[3]Install Guest Additions

Click "Devices" --> "Install Guest Additions"




install guest additions

















[4] Follow the installation wizard
you will get window similar to below and click "OK" , you may need provide authentication




VBOXADDITIONS





















[5] It will be prompted with terminal window similar to following, Press Return and close that window... that's all , Now seamless mouse integration should be enabled . have a nice day!




virtualbox guest additions installation














Related Posts