Monday, May 31, 2010

Reset cisco router to factory default

Sometimes.. you may forget the password for cisco router..
or prefer set back to factory default setting..

Then can use this way to reset back..

1. Connect to the cisco router using hyper terminal..
2. Restart the router..
3. Once see booting, press
Ctrl + break
4. you will access to RONMON
5. In ronmon, type
ronmon 1> confreg 0x2142
6. Hit enter and
ronmon 2> reset
7. Wait the router boot, then press "n" and enter, when asked to enter dialogue wizard.
8. Then start tpe the following command
enable
conf t
config-register 0x2102
exit
write erase
press enter
reload

9. That all, you will see the router in factory default setting

Tested on Router 1841.

Monday, May 24, 2010

rc.local in Suse

Suse do not have any rc.local script..
Which this script useful is..
In RedHat, after the init start, it will invoke the command in rc.local..
It is very useful which almost same function with startup in windows..

I had do some google.. and turn out..
This link is a lot helpful..
HERE

1. create a new file named rclocal at /etc/init.d/
vi /etc/init.d/rclocal

2. Then add the the following in the beginning script..
#!/bin/sh
### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: whatever
### END INIT INFO

3. Change mode for the file
chmod 755 /etc/init.d/rclocal

4. add service
chkconfig --add rclocal

Thank all..
Then add the service you need start at the end of the file.

Below is the sample rclocal file I created..



There is some reason the file I created is rclocal instead of rc.local..
In the man innserv, it does not allow files with .local in used..
The error will appear
insserv: script name rc.local is not valid, skipped!

Friday, May 14, 2010

Installation PHP ssh2 extension on PHP5, Apache2

Here is the way for the installation of ssh2 on php5 and apache2..
Here is the document about the ssh2 php..
Try search around the google..Try doing the compilation..
It is working..So here some guide can be use for the installation

Requirements..Installer file for ssh2 and libssh2
1. "wget http://pecl.php.net/get/ssh2-0.11.0.tgz"
2. "wget http://downloads.sourceforge.net/project/libssh2/old-libssh2-releases/1.1/libssh2-1.1.tar.gz?use_mirror=nchc"

First, install libssh2..
1. tar zxf libssh2-1.1.tar.gz
2. cd libssh2-1.1
3. ./configure
4. make
5. make install

Second, install ssh2..
1. tar zxf ssh2-0.11.0.tgz
2. cd ssh2-0.11.0
3. /usr/local/php/bin/phpize
4. ./configure --with-ssh2 --with-php-config=/usr/local/php/bin/php-config
5. make
6. make install
7. make note on the "Installing shared extensions:" directory path which need in below step
Third, change the php.ini file and restart apache..
1. Edit the php.ini file
vi /usr/local/php/lib/php.ini
2. Add this column to the end of php.ini file..
[ssh2]
extension_dir= ssh2 installed library path
extension=ssh2.so
3. save and exit the php.ini
ctrl + c
:wq
4. restart the apache2
/usr/local/apache2/bin/apachectl restart
# if apache cannot be down..
/usr/local/apache2/bin/apachectl graceful

Check the phpinfo, will see ssh2 is enabled..

Tuesday, May 11, 2010

Clear PuTTY host-key

When a server keep rebuild over and over..
and try access from PuTTY time from time with same server IP and different Host..
May face problem such as..

The password keep wrong.. seem cant be authenticate..
If face this problem.. Try this..

1. Try use another SSH software to ssh to the server.
2. a. If cannot, means the server setting not done properly..
b. If CAN, then clear putty RSA and Host-Key

PuTTY host key can be found at
1. Run > regedit
2. GOTO "HKEY_CURRENT_USER\Software\SimonTatham\PuTTY"
3. If not mind reset all the setting.. Just delete the "SimonTatham".