Posts

Showing posts from January, 2009

Reset Cisco router

Image
Send BREAK command when router is booting up. Router went into rommon mode Putty Terminal can send Break command rommon 1 > confreg 0x2142 Reset or power cycle for new config to take effect rommon 2 > reset

LVM commands

This note focuses on manual creation and manipulation of LVM. Create Physical Volume pvcreate /dev/sdax Create Logical Volume Group vgcreate vgx /dev/sdax Create Logical Volume lvcreate -n vmxx --size 6g vgx Create Patition of logical Volume fdisk /dev/vgx/vmxx Map and mount kpartx -v -a /dev/vgx/vmxx mount /dev/mapper/vmxxp1 /foo Remove mapping kpartx -v -d /dev/vgx/vmxx ================================= #Walk through lvcreate -n storage --size 40g vg0 fdisk /dev/vg0/storage ------------------------------ n - new partition p - primary partition 1 - partition number 1 Enter Enter Just create new parition ------------------------------- kpartx -v -a /dev/vg0/storage mkfs.ext3 /dev/mapper/storage1 mkdir /foo <---- THE DIRECOTRY TO MOUNT mount /dev/mapper/storage1 /foo

Migrate physical system to OpenVZ container

In this lab, we already install Openvz container kernel at host system. Create new empty VM mkdir /vz/root/101 /vz/private/101 cat /etc/vz/conf/ve-vps.basic.conf-sample > /etc/vz/conf/101.conf Copy data from Physical to VM directory rsync -arvpz --numeric-ids --exclude dev --exclude proc --exclude tmp --exclude sys --exclude mnt -e "ssh -l root@x.x.x.x" root@x.x.x.x:/ /vz/private/101/ Create /etc/vz/conf/101.conf VE_ROOT="/vz/root/$VEID" VE_PRIVATE="/vz/private/$VEID" OSTEMPLATE="centos-5" IP_ADDRESS="192.168.1.1" HOSTNAME="penguin" NAMESERVER="8.8.8.8" #Making adjustments Edit /vz/private/101/etc/inittab sed -i -e '/getty/d' /vz/private/101/etc/inittab Edit /vz/private/101/etc/mtab rm -f /vz/private/101/etc/mtab ln -s /proc/mounts /vz/private/101/etc/mtab Edit /vz/private/101/etc/fstab cp /vz/private/101/etc/fstab /vz/private/101/etc/fstab.old grep devpts /vz/private/101/etc/f

CentOS 5.1 with Xen Virtualization

At a start, install CentOS minimal installation Update OS using yum yum -y update Install NTP for time sync (Xen HOST only) yum -y install ntp sed -i -e 's/^restrict -6/#restrict -6/' /etc/ntp.conf ntpdate pool.ntp.org hwclock --systohc /etc/rc.d/init.d/ntpd start chkconfig ntpd on Reboot with lastest patches reboot Install Xen and Xen Kernel yum -y install xen kernel-xen Enable booting Xen Kernel sed -i -e 's/^default=1/default=0/' /boot/grub/grub.conf Reboot for new XEN kernel reboot Commands for LVM creation pvcreate /dev/sdax vgcreate vg0 /dev/sdax lvcreate -n vm01 --size 6g vg0 lvcreate -n vm02 --size 6g vg0 Sample config for VM01 to be save to: /etc/xen/vm01 name = "vm01" disk = [ "phy:/dev/vg0/vm01,xvda,w" ] maxmem = 512 memory = 512 vcpus = 2 bootloader = "/usr/bin/pygrub" vif = [ "bridge=xenbr0" ] Populate the Xen VM partition with minimal OS fdisk /dev/vg0/vm01 kpartx -v -a /dev/vg0/

Getting started with Cisco Switch

Default baud rate for Cisco Switch is 9600 Switch to supervisor mode ena(enable) Go into configuration terminal config t (configuration terminal) Set hostname hostname myciscoswitch Enable password and encrypt enable secret p@ssw0rd service password-encry VLAN related show vlan Name VLAN 1 vlan 1 name myvlan1 Configure access port interface fastethernet 0/x switchport access vlan 2 Configure trunk port  interface fastethernet0/x switchport mode trunk switchport trunk encapsulation dot1q switchport trunk allow vlan 10-15,20 Exit from configuration mode exit Write current configuration to startup configuration in order to make it permanent upon reboot. write memory

Backup the whole partition with cpio archive command

cpio is a useful tool to archive Linux system. In this article, we are going to archive / partition which is mounted from sda11 partition. ###Archive ssh root@192.168.1.104 "find / -xdev -print0 | cpio --null --create" > sda11.cpio ###Extract cpio --extract --no-absolute-filenames --file=sda11.cpio For the /dev directory, recommended to be archived by tar command ssh root@192.168.1.104 "tar -c /dev" > dev.tar