web analytics
Evan && Or && Id

Belajar IT

Cisco port-channel lacp load balancing and redudance

by on Dec.23, 2011, under Belajar IT, Keseharian, Ngoprek

Kali ini saya coba berbagi pengetahuan dan semoga ini bisa bermanfaat bagi kita semua, dalam kesempatan ini saya coba menjelaskan cara-cara pembuatan port-channel lacp load balancing dan redudance
Apa sih itu LACP ?
LACP adalah kepanjangan dari Link Aggregation Control Protocol yang inti dari artinya adalah penggabungan beberapa port menjadi satu

Lalu apa itu Port-channel ?
Port-channel adalah Ethernet Channel of interfaces

kalau load balancing ?
load balancing adalah membuat seimbang, dimana dalam kasus ini kinerja dari port-nya balance

Lebih detail tentang teori baca aja deh di sini http://en.wikipedia.org/wiki/Link_aggregation

Lalu keuntungannya apa ?
Apa aja boleh… ^,^

Dari pada teori mulu mendingan kita praktek langsung aja ya..
Sekarang kita mulai configurasinya, tahap awal kita configurasi interface-nya, mari kita aktifin interface Port-channel-nya :
SW-Backbone-2#configure terminal
SW-Backbone-2(config)#interface port-channel 1
SW-Backbone-2(config-if)#description ke-SW-Backbone-1
SW-Backbone-2(config-if)#switchport trunk encapsulation dot1q
SW-Backbone-2(config-if)#switchport mode trunk
SW-Backbone-2(config-if)#switchport trunk allowed vlan 90,104,225
SW-Backbone-2(config-if)#CTRL+Z

lanjut aktifin load balance redudance-nya
SW-Backbone-2(config)#port-channel load-balance src-dst-ip

Ok..ini hasil dari configurasi di atas
SW-Backbone-2#show running-config interface po1
Building configuration…

Current configuration : 134 bytes
!
interface Port-channel1
description ke-SW-Backbone-1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 90,104,225
switchport mode trunk
end

SW-Backbone-2#sh ru
Building configuration…

Current configuration : 6063 bytes
!
! Last configuration change at 20:14:18 JKT Fri Dec 23 2011 by evan
! NVRAM config last updated at 19:32:28 JKT Fri Dec 23 2011 by evan
!
version 12.2
no service pad
service tcp-keepalives-in
service timestamps debug datetime msec localtime show-timezone
service timestamps log datetime msec localtime show-timezone
service password-encryption
service unsupported-transceiver
!
hostname SW-Backbone-2
!
port-channel load-balance src-dst-ip
!

lanjutttt… Sekarang kita alokasikan 4 port untuk kita gabungkan :
SW-Backbone-2#configure terminal
SW-Backbone-2(config)#in gi0/25
SW-Backbone-2(config)#description EthCnl-Po1
SW-Backbone-2(config-if)#switchport trunk encapsulation dot1q
SW-Backbone-2(config-if)#switchport mode trunk
SW-Backbone-2(config-if)#channel-group 1 mode active
SW-Backbone-2(config-if)#CTRL+Z
SW-Backbone-2#configure terminal
SW-Backbone-2(config)#in gi0/26
SW-Backbone-2(config)#description EthCnl-Po1
SW-Backbone-2(config-if)#switchport trunk encapsulation dot1q
SW-Backbone-2(config-if)#switchport mode trunk
SW-Backbone-2(config-if)#channel-group 1 mode active
SW-Backbone-2(config-if)#CTRL+Z
SW-Backbone-2#configure terminal
SW-Backbone-2(config)#in gi0/27
SW-Backbone-2(config)#description EthCnl-Po1
SW-Backbone-2(config-if)#switchport trunk encapsulation dot1q
SW-Backbone-2(config-if)#switchport mode trunk
SW-Backbone-2(config-if)#channel-group 1 mode active
SW-Backbone-2(config-if)#CTRL+Z
SW-Backbone-2#configure terminal
SW-Backbone-2(config)#in gi0/27
SW-Backbone-2(config)#description EthCnl-Po1
SW-Backbone-2(config-if)#switchport trunk encapsulation dot1q
SW-Backbone-2(config-if)#switchport mode trunk
SW-Backbone-2(config-if)#channel-group 1 mode active
SW-Backbone-2(config-if)#CTRL+Z

Di sini saya tidak memasukkan Allow Vlan ( filter vlan ) pada port yg kita gabung, melainkan cukup pada interface Port-channel-nya saja
Setelah di connectin semua maka hasilnya seperti ini :
SW-Backbone-2#show int status

Port      Name               Status       Vlan       Duplex  Speed Type
———- CUT —————-
Gi0/25    EthCnl-Po1         connected    trunk      a-full a-1000 1000BaseSX SFP
Gi0/26    EthCnl-Po1         connected    trunk      a-full a-1000 1000BaseSX SFP
Gi0/27    EthCnl-Po1         connected    trunk      a-full a-1000 1000BaseSX SFP
Gi0/28    EthCnl-Po1         connected    trunk      a-full a-1000 1000BaseSX SFP
Po1       ke-SW-Backbone-1   connected    trunk      a-full a-1000

SW-Backbone-2#sh ru in gi0/25
Building configuration…

Current configuration : 151 bytes
!
interface GigabitEthernet0/25
description EthCnl-Po1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 90,104,225
switchport mode trunk
channel-group 1 mode active
end

SW-Backbone-2#sh ru in gi0/26
Building configuration…

Current configuration : 151 bytes
!
interface GigabitEthernet0/26
description EthCnl-Po1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 90,104,225
switchport mode trunk
channel-group 1 mode active
end

SW-Backbone-2#sh ru in gi0/27
Building configuration…

Current configuration : 151 bytes
!
interface GigabitEthernet0/27
description EthCnl-Po1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 90,104,225
switchport mode trunk
channel-group 1 mode active
end

SW-Backbone-2#sh ru in gi0/28
Building configuration…

Current configuration : 151 bytes
!
interface GigabitEthernet0/28
description EthCnl-Po1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 90,104,225
switchport mode trunk
channel-group 1 mode active
end

Sekarang kita liat Speed-nya pada Interface Port-channel-nya sudah sebesar 4Gb ( MTU 1500 bytes, BW 4000000 Kbit, DLY 10 usec, ), dan di sini juga terlihat port berapa aja yg kita gabung ( Members in this channel: Gi0/25 Gi0/26 Gi0/27 Gi0/28 )

SSW-Backbone-2#show interfaces Po1
Port-channel1 is up, line protocol is up (connected)
Hardware is EtherChannel, address is 0012.0161.1719 (bia 0012.0161.1719)
Description: ke-SW-Backbone-1
MTU 1500 bytes, BW 4000000 Kbit, DLY 10 usec,
reliability 255/255, txload 101/255, rxload 26/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 1000Mb/s, link type is auto, media type is unknown
input flow-control is off, output flow-control is unsupported
Members in this channel: Gi0/25 Gi0/26 Gi0/27 Gi0/28
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of “show interface” counters 1w3d
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 422306000 bits/sec, 182790 packets/sec
5 minute output rate 1598643000 bits/sec, 246533 packets/sec
124709349643 packets input, 39994852902325 bytes, 0 no buffer
Received 15963398 broadcasts (8718778 multicasts)
0 runts, 0 giants, 0 throttles
778973 input errors, 5589 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 8718778 multicast, 0 pause input
0 input packets with dribble condition detected
165597102019 packets output, 132050835252807 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out

SW-Backbone-2#show interfaces gi0/25
GigabitEthernet0/25 is up, line protocol is up (connected)
Hardware is Gigabit Ethernet, address is 0012.0161.1719 (bia 0012.0161.1719)
Description: EthCnl-Po1
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 103/255, rxload 29/255
Encapsulation ARPA, loopback not set
Keepalive not set
Full-duplex, 1000Mb/s, link type is auto, media type is 1000BaseSX SFP
input flow-control is off, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:22, output hang never
Last clearing of “show interface” counters 1w3d
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 116336000 bits/sec, 48788 packets/sec
5 minute output rate 406893000 bits/sec, 63369 packets/sec
33031920919 packets input, 11535121696360 bytes, 0 no buffer
Received 8751836 broadcasts (8484111 multicasts)
0 runts, 0 giants, 0 throttles
779637 input errors, 5602 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 8484111 multicast, 0 pause input
0 input packets with dribble condition detected
42145656820 packets output, 33357023523376 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out

Kelar deh… gimana ? ada pertanyaan ?

Thanks to kawan-kawan seperjuangan, Lasta Yani, Daddy Yustiadi dan Ahmad Hidayat yang sudah sudi ngoprek bareng.

Share on Facebook
2 Comments more...

Backup Switch Cisco

by on Dec.06, 2011, under Belajar IT, Keseharian, Ngoprek, Note

Kadang kita suka males kalo mau backup switch, kalau hanya satu atau dua switch cisco sih ga begitu masalah.. kalau ada lebih dari 20 switch ? pasti merepotkan juga kan….

Nah karena dasar itu saya coba iseng-iseng bikin program asal-asalan, sebenernya ni program cuman buat ngebantu kita meng exekusi beberapa printah di cisco, seperti memasukkan user name, password, enable password, password enable, printah-printah backup seperti :

copy runing-config tftp:

copy vlan.dat tftp:

copy config.text tftp:

Nah untuk membuat tools ini memerlukan beberapa program yaitu :

1. Telnet client ( by default sudah ada pada windows anda, kecuali windows 7 harus di aktifkan program telnet cliant-nya )

2. AutoIT ( bisa di download di sini )

3. TFTP-Server ( bisa di download di sini )

Setelah Telnet Client , AutoIT dan TFTP-Server  di install sekarang ke proses selanjutnya yaitu pembuatan tools-nya contoh scrip-nya :

——————————START————————-

;;++++++++++++++++++++++++++++++++++
;+++++++++++++++++++++++++++++++++++
;++                                                                                  ++
;++        Program Sederhana Back-UP Cisco         ++
;++            Create-By AutoIt                                      ++
;++        For More Question email me AT              ++
;++              evan@bhomert.com                              ++
;;++++++++++++++++++++++++++++++++++
;;++++++++++++++++++++++++++++++++++

; Ganti ip.cisco.xxx.xxx dengan IP cisco yg akan di backup
Run(“telnet.exe ip.cisco.xxx.xxx”)
Sleep(1000)
; Ganti username dengan username kamu
Send(“username”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti password dengan password kamu
Send(“password”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
Send(“en”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti enablepassword dengan enable password  switch kamu
send(“enablepassword”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
Send(“copy running-config tftp:”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti ip.TFTP-Server.xxx.xxx dengan IP TFTP-Server kamu
Send(“ip.TFTP-Server.xxx.xxx”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti namahost dengan hostname Switch
Send(“namahost-config”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
Send(“copy vlan.dat tftp:”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti ip.TFTP-Server.xxx.xxx dengan IP TFTP-Server kamu
Send(“ip.TFTP-Server.xxx.xxx”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti namahost dengan hostname Switch
Send(“namahost-vlan.dat”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
Send(“copy config.text tftp:”)
Send(“{ENTER}”)
Sleep(200)
; Ganti ip.TFTP-Server.xxx.xxx dengan IP TFTP-Server kamu
Send(“ip.TFTP-Server.xxx.xxx”)
Sleep(200)
Send(“{ENTER}”)
Sleep(200)
; Ganti namahost dengan hostname Switch
Send(“namahost-config.text”)
Sleep(200)
Send(“{ENTER}”)
Sleep(1000)
Send(“q”)
Send(“{ENTER}”)
Sleep(1000)
Send(“{ENTER}”)

——————————AND————————-

Ikuti petunjuk di scrip itu dan compile scrip tersebut dengan menekan CTRL+F7, setelah selesai siapkan TFTP-Server dan arahkan directory penyimpanannya. setelah semua selesai jalankan .exe yang tadi di compile.

Selamat Mencoba, semoga catatan kecil ini bisa bermanfaat buat kawan-kawan semua.

Silakan Download Contoh Script dan contoh telnet ke route-server

note: – untuk mendownload klik kanan lalu save-as

Share on Facebook
1 Comment more...

Address list routing OIXP APJII dan MCSIX

by on Jul.16, 2011, under Belajar IT, Ngoprek, Note

Update per Tgl 19 Oktober 2011

bagi temen-temen yang butuh address-list guna pembagian Bandwidth IIX, OIXP dan MCSIX, silakan download

Address-list MCSIX , OIXP dan APJII

and langsung aja upload ke dua file tersebut ( mcsix.rsc dan nice.rsc ) ke mikrotik => new terminal =>

/import mcsix.rsc

/import nice.rsc

Oh iya.. di dalam address-list tersebut untuk penamaan MCSIX adalah mcsix dan untuk OIXP+APJII adalah nice.

kalo mau generate sendiri silakan pake script ini :

:local bhomert [/ip route pr count-only];
:local bho 0;
:local mer 0;
:local mert;
:for bho from=0 to=$bhomert step=1 do={
:set mert [/ip route get $bho dst-address]
:if ($mer = 0) do={
/ip firewall address-list add list=nice address=$mert;}
}

nah kalo mau ngejalanin tinggal lewat telnet.. jangan lewat winbox :) suka ga dapet full, oh iya.. sebelum-nya naikin dulu bgp / ospf buat dapetin prefix dari router mcsix dan router iix ( oixp+apjii )

[evan@mix-prefix] /routing bgp peer> print  detail status
Flags: X – disabled, E – established
0 E name=”ke-MIX” === CUT ====
uptime=11h5m14s prefix-count=19813 updates-sent=9699

1 E name=”ke-IIX” === CUT ====
uptime=14h19m43s prefix-count=8584 updates-sent=41719
[evan@mix-prefix] /routing bgp peer>

 

Untuk Contohnya bisa di liat seperti ini :

Mangle :

[evan@sample-router] /ip firewall mangle> pr detail
Flags: X – disabled, I – invalid, D – dynamic
0   ;;; Mark-Internasional
chain=prerouting action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!nice in-interface=ether10

1   chain=prerouting action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!mcsix in-interface=ether10

2   chain=forward action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!nice in-interface=ether10

3   chain=forward action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!mcsix in-interface=ether10

4   chain=prerouting action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!nice in-interface=ether5

5   chain=prerouting action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!mcsix in-interface=ether5

6   chain=forward action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!nice in-interface=ether5

7   chain=forward action=mark-connection new-connection-mark=Conn-INTL passthrough=yes dst-address-list=!mcsix in-interface=ether5

8   ;;; Mark-IIX
chain=prerouting action=mark-connection new-connection-mark=Conn-IIX passthrough=yes dst-address-list=nice in-interface=ether10

9   chain=forward action=mark-connection new-connection-mark=Conn-IIX passthrough=yes dst-address-list=nice in-interface=ether10

10   chain=prerouting action=mark-connection new-connection-mark=Conn-IIX passthrough=yes dst-address-list=nice in-interface=ether5

11   chain=forward action=mark-connection new-connection-mark=Conn-IIX passthrough=yes dst-address-list=nice in-interface=ether5

12   ;;; Mark-MCSIX
chain=prerouting action=mark-connection new-connection-mark=Conn-MCSIX passthrough=yes dst-address-list=mcsix in-interface=ether10

13   chain=forward action=mark-connection new-connection-mark=Conn-MCSIX passthrough=yes dst-address-list=mcsix in-interface=ether10

14   chain=prerouting action=mark-connection new-connection-mark=Conn-MCSIX passthrough=yes dst-address-list=mcsix in-interface=ether5

15   chain=forward action=mark-connection new-connection-mark=Conn-MCSIX passthrough=yes dst-address-list=mcsix in-interface=ether5

16   ;;; Paket-INTL
chain=prerouting action=mark-packet new-packet-mark=INTL passthrough=yes connection-mark=Conn-INTL

17   chain=output action=mark-packet new-packet-mark=INTL passthrough=yes connection-mark=Conn-INTL

18   ;;; Paket-MCSIX
chain=prerouting action=mark-packet new-packet-mark=MCSIX passthrough=yes connection-mark=Conn-MCSIX

19   chain=output action=mark-packet new-packet-mark=MCSIX passthrough=yes connection-mark=Conn-MCSIX

20   ;;; Paket-IIX
chain=prerouting action=mark-packet new-packet-mark=IIX passthrough=yes connection-mark=Conn-IIX

21   chain=output action=mark-packet new-packet-mark=IIX passthrough=yes connection-mark=Conn-IIX

[evan@sample-router] /ip firewall mangle>

Simple Queue :

1    ;;;         Radar TV MCSIX
name=”client-66-MCSIX” target-addresses=xxx.xxx.xxx/32 interface=all
packet-marks=MCSIX direction=both priority=8
queue=default-small/default-small limit-at=0/0 max-limit=22M/22M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
total-queue=default-small

2    ;;;         Radar TV IIX
name=”client-66-IIX” target-addresses=xxx.xxx.xxx/32 interface=all
packet-marks=IIX direction=both priority=8
queue=default-small/default-small limit-at=0/0 max-limit=40M/40M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
total-queue=default-small

2    ;;;         Radar TV INTL
name=”client-66-INTL” target-addresses=xxx.xxx.xxx/32 interface=all
packet-marks=INTL direction=both priority=8
queue=default-small/default-small limit-at=0/0 max-limit=3M/3M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
total-queue=default-small

 

Semoga bisa membantu..

Share on Facebook
Leave a Comment more...

Create and Remove Symlink

by on May.31, 2011, under Belajar IT

Create symlink
ln -s /chosenFolder/orFile /symbolicLinked/file/orFolder

Remove symlink
rm -r /symbolicLinkedFolder

Share on Facebook
Leave a Comment more...

Arch Commands:

by on May.31, 2011, under Belajar IT, Copas


pacman -Sy alsa-lib alsa-utils
pacman -S alsa-oss

install sound control

pacman -Ss xpdf
search pacman repository for xpdf


pacman -Si packageName
pacman -Qi packageName


get more info about package by name

pacman -Su
update all packages on system

pacman -Syu
sync repository database and update system

yaourt -Sf xorg-server
force install

pacman -Ql package
retrieve list of files installed by package

options snd-pcsp index=2
add to /etc/modprobe.conf to load pcsp last

MODULE=(… !snd_pcsp)
add to /etc/rc.conf
to stop pcsp from loading

pacman -S pulseaudio
needed to get sound in flash

gpasswd -a lust audio
add user lust to audio group for playing purposes

gpasswd -d [user] [group]
remove user from group

usermod -aG [group] [user]
add user to a group

adduser
add user to system

userdel
delete user

cat /etc/group

list all groups on system

groups
list groups your user is in

find /* -group groupName
list files owned by a group

groupadd groupName
create new group

groupdel groupName
remove group

alsamixer
bring up sound control


amixer set Master 90% unmute
amixer set PCM 85% unmute

set volume from command line

alsactl store
save audio settings

arch=(‘x86_64′)
can be added to PKGBUILD to try to support 64bit


/home/rladams/.mozilla/firefox/6yq6uxu4.default/extensions/VMwareVMRC@vmware.com/plugins/vmware-vmrc -h localhost:8333 -u root

start vmware from command line

mplayer -v -nocache -playlist “http://yp.shoutcast.com/sbin/tunein-station.pls?id=9768″

play song of shoutcast with mplayer

nitrogen /path/to/pic/dir/
set wallpaper

nitrogen –restore &
add to .xinitrc for restore of bkgrndPic

date –set =’+60 minutes’
move time ahead 60 minutes

setterm -blength 0
turn off annoying beep in bash

wodim -v dev=/dev/cdrw isoImage.iso
burn an iso

aumix

volume controls from a command in app

——-vmwareServer2———-
/etc/init.d/vmware-mgmt start
start vmware server 2 * wrong

/etc/init.d/vmware start
start vmware server 2
——-vmwareServer2———-

—–apvlv—–
pdf viewer with vi commands
—–endApvlv—–

Share on Facebook
Leave a Comment more...

freeBSD commands:

by on May.31, 2011, under Belajar IT, Copas

update freebsd ports
--------------------
*** if first time using portsnap use:
portsnap fetch extract

else use:
portsnap fetch update

then run:
pkgdb -F
portsdb -Uu
portupgrade -a
update and upgrade freebsd ports, portugrade must be installed to use pkgdb -F,
may have to type: rehash after installing portugrade if using default shell (csh) as root

end update freebsd ports
------------------------

other ways to update ports
---------------------------
portsnap fetch update
pkgdb -F

portsdb -Uu
updates version info in ports database
this needs to be ran after cvsup or csup

make fetchindex
portsdb -u
portversion -l "<"
portupgrade -arR
run this to update with portupgrade

portversion | grep "<"
list packages that are out of date

portupgrade -a

pkgdb -F
portupgrade -a
Updates ports that are installed

portsdb -Fu
fetch INDEX and rebuild portsdb

portmaster -a
Updated ports that are installed
------------

---------
error when installing portsnap:
Warning: Object directory not changed from original
had to go into dome of the subdirectories and do a:
make obj
---------

portupgrade package-name
update specific port

portversion -l '<'
list outdated ports

cvsup /root/ports-supfile
update ports tree with created file

end other ways to update freebsd ports
--------------------------------------

make config
make config file (can be done after install to reconfigure options)

make deinstall
make install APR_UTIL_WITH_BERKELEY_DB=yes
fix an error for a dependency option

make index
/usr/ports updates index

make readmes
creates readmes /usr/ports

cd /usr/ports
make search name=pptp
search ports by name

cd /usr/ports
make search key=pptp
searches ports for keyword

freebsd package manager (use ports or pkg not both, so stick with one)
----------------------------------------------------------------------

pkg_info
show packages installed

ls /var/db/pkg
show packages installed

pkg_info -R apache-1.3.37_2
show dependencies of apache

pkg_fetch nagios-3.0.3
fetches a port

pkg_version
show versions of packages installed vs available via ports

pkg_deinstall packageName
remove package

pkg_add name.tar.gz
adds package from ports ??

pkg_add -r name
downloads package and then adds it

pkg_info -IX font
show installed fonts

end pkg info
------------

pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.3/packages/i386/filename.tgz
adds package openBSD

env
print environment variables

locale -a
print names of all available locales

cntrl - i
equivalent to tab

xset b off
turn off system beep in X

sysctl hw.syscons.bell=0
turn off beep globally until a reboot

hw.syscons.bell=0
add this line to /etc/sysctl.conf, turns off system beep globally for good

sysctl hw.acpi.baterry
Show info about battery

sysctl -a | grep -i memory
show memory stats

(sysctl hw.acpi.battery.life|cut -d "," -f2|cut -d "%" -f1|cut -d " " -f2)
show battery juice

du -h -d 1
disk usage of directories

du -sh
disk usage of directory and files

du -x
tells what is using space

du -sk *
show disk usage

for each in `ls -1`;do du -sh $each;done
show file size of each folder in current directory

tar -zcvf newArchive.tar /folderToCompress
tar a folder

tar -zxf newArchive.tar -C /tmp
extract folder to tmp directory

tar -cjvf www042309.tar.bz2 ./www
backup website -j for bz2

tar -xjf www042309.tar.bz2
untar website

tar -jxvf file.tar.bz2
untar bz2

tar -zxvf file.tar.gz
untar gz

tar -xvzf file.tar.gz -C directory
untar specific directory

tar -xzvf phpMyAdmin_x.x.x.tar.gz
tar -z auto recognize gzip

(cd /home/username/lrn && tar cf - . ) | (cd /mnt/usb && tar xBf -)
or
tar cf - ./lrn | (cd /mnt/usb; tar xf -)
copy files from one directory to another including symlinks

(cd /home/username/lrn && tar cf - . ) | "(cd /mnt/usb/ && tar xvpf -)"
remotely copy files from one directory to another including symlinks

cd ..
go up one directory

cd ~
or
cd
go to home directory

cd -
go to last directory you were in
echo $OLDPWD ,will show where this will take you

mount -t msdosfs /dev/da0s1 /mnt/usb
mount usb drive

umount /mnt/usb
unmount disk

mount -t cd9660 /dev/acd0 /mnt/dvd
mount dvd

umount /mnt/dvd
unmount dvd

mdconfig -a -t vnode -f /path/to/image.iso -u 1
mount -t cd9660 /dev/md1 /mnt/cdrom
mount -t msdos /dev/nc0c /cdrom
creates virtual cdrom drive and mounts it

mount -u /mnt/cdrom
mdconfig -d -u 1
unmounts and undoes virtual drive

mount -a -t ufs
mount file systems read/write ??

camcontrol devlist
list usb devices

fusepod
ipod program

camcontrol eject 1:0:0
ejects ipod

xev
this will capture keypress events and give the names of the keys

last
shows who logged in and when

last -20
show last 20 logins

last username
indicate last logins of users and ttys

ndisgen
generate a FreeBSD driver module from a Windows(R) NDIS driver distributio

ndiscvt -i bcmwl5.inf -s bcmwl5.sys -o ndis_driver_data.h
convert Windows(R) NDIS drivers for use with FreeBsd, (broadcom ethernet)

kldload ./bcmwl5_sys.ko
load linksys ndisDriver

kldstat
shows custom loaded kernel modules

pciconf
diagnostic utility for the pci bus

ifconfig bge0 down
disable network card bge0

killall -SIGUSR1 conky
restart conky

aterm -e hw.acpi.battery
open aterm and execute command

more /etc/group
show all groups

xmodmap
utility for modifying keymaps and pointer button mappings in X

rehash
only when using sh. tells system about newly installed programs

iconv
character set conversion

ndisgen
generate a FreeBSD driver module from a Windows(R) NDIS driver distribution

wicontrol
configure Lucent, Intersil, and Atheros wireless devices

pciconf -lv
diagnostics utility for the PCI bus

fstat
identify active files

smb://domain\user@computerName/C$

jobs
listjobs

bg programName
send program to background

^Z
suspend current job

fg
bring job/program to foreground

sftp -oPort=22222 user@ip-address
sftp to port 2222

fbsetroot -solid black
set fluxbox background to black

session.screen0.rootCommand: fbsetbg ~/background/ricci.jpg
set backgorund in fluxbox

ps -aux
list running processes

Mysql
-----
mysqladmin shutdown
--

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/bin/mysqladmin -u root password 'new-password'
/usr/local/bin/mysqladmin -u root -h ishbsd.houston.rr.com password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local ; /usr/local/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/local/bin/mysqlbug script!
+++++++++

roxFiler
--------
~/.config/rox.sourceforge.net/Templates
Adds to rightClick new

/home/username/.config/rox.sourceforge.net/SendTo
Adds to sendTo

end roxFiler
------------

dmesg | grep -i memory
show total and available mem

#ls
man page of ls in konqueror

/etc/rc.d/sshd restart
restart ssh (can also use start,stop, forcestop,etc

sed -i.bak s/e/o/g foo
replace every "e" with "o" in file foo (makes a backup)

sed -i '' s/e/o/g foo
does not make a backup

htpasswd .pwdFile userName
change password or add user "-c to create file"

pw user mod lust -G wheel
add lust to wheel group

whereis pptp
echo /usr/ports/*/*pptp*
alternate ways to find a port

whereis programName
display one or more mathces of program you are looking for

which bash
will show which bash will be called first

locate aProgramName
display every file that matches a programs name

kill -9 #####
force kill

aterm -bl
borderless

visudo
edit /etc/sudoers (usage: visudo)

sudo crontab -e
edit current crontab

config.log
after running ./configure log is stored in same folder

ls -R / | more (use less on linux)
show all directories on system

ls -alAR
recursively list directories, including .directories

ls -G
show file, folder, executables in color

dig -x 192.168.3.3
find hostname by address

tail -100 filename
view last 100 lines of a file

head filename
view first 10 lines of a file

vpnc --debug 99 --enable-1des --dpd-idle 0
vpnc with debug options all the way and weak encryption set no idle

vpnc-disconnect
disconnect vpnc

wget -r -l1 -H -t1 -nd -N -np -A.png,.jpg,.gif -erobots=off -i ~/getPics.txt
-r -H -l1 -np = recursive download, span domain, one level, no parent.
-A = attributes
-N = turns on timestamping so same files are not downloaded
-nd = puts everything in one directory rather than sites directories
-erobots.txt = igonre robots.txt
-i /fileName = lets you put urls inside text file

wget -mirror -w3 -p htt://www.whatever.com
-w = wait
-p = get all required elements (useful with mirror)

wget -i file-with-links.txt
download links in a file

dmesg | grep ndis
scrub dmesg for ndis info

ifconfig | ndis0
shows status of ndis ip

ifconfig ndis0 inet 192.168.3.70 netmask 255.255.255.0 ssid joetest wepkey 0x43DB5804CD weptxkey 1 wepmode on
connects wpcg54g to wlan with wep (weptxkey 1 picks first wep key)

ifconfig ndis0 up scan
scans for wireless access points

gdb /usr/local/bin/beaver/beaver.core
shows core dump of beaver with gdb

df
show partitions

uptime
show how long its been since a reboot

w
show who is logged in, from where, and what they are running

who
show who is logged int

finger
displays other users logged in system

last
last users logged in

ac
show how long you have been logged in.. in total

top
shows what's running

ps -aux
shows what is running in detail

uname -a
shows system information

uname -mrs
show current version

netstat
displays current network connections

netstat -an
display current connections, source, destination and ports

netstat -rn
display routing table for ips bound to server

hostname
shows hostname

aterm -sl 32000
saveline buffer 32000 lines

ls -1 | wc -l
count files in a directory

awk 'sub("$", "\r")' unixfile.txt > winfile.txt
convert file from unix to windows

awk '{ sub("\r$", ""); print }' winfile.txt > unixfile.txt
convert file from windows to unix

tr -d '\15\32' < winfile.txt > unixfile.txt
remove carraige return and ^Z's from a file

perl -p -e 's/\r$//' < winfile.txt > unixfile.txt
convert win file to unix

perl -p -e 's/\n/\r\n/' < unixfile.txt > winfile.txt
convert unix file to win

set -o vi
set ksh to vi mode

shift + insert
paste what mouse has copied

cal
shows calendar of this month

rdesktop -f
fullscreen rdesktop

rdesktop -g 1024x768 servername
set geometry of rdesktop

man 3 printf
shows section 3 of printf (3 seems to be summary????)

mixer
shows current volume settings

mixer vol 95:95
mixer pcm 95:95
mixer speaker 95:95
mixer -s vol 10
change volume

date 0811041331
change time nov0408 1:30

date +"%T %p"
shows date with am/pm

history
shows history of commands

cat .bash_history | grep ssh
list history matches to ssh

cat > cat.txt
create file cat.txt and input text, ^D to get out and write file

cat < cat.txt
same as cat cat.txt, reads file

cat < cat.txt > newCat.txt
cp contents of cat.txt to newCat.txt

cat cat.txt newCat.txt > bigCat.txt
copy contents of cat.txt and newCat.txt into bigCat.txt

----
bash

cntrl-r
search bash history

cntrl-w
delete word backwards

cntrl-k
delete rest of line forward

cntrl-d
delete char under cursor

alt-d
delete word forward

cntrl-a
cursor to beginning of line

cntrl-e
cursor to end of line

alt-f
one word forward

alt-b
one word back

cntrl-l
clears screen

alt-l
lowercase current word

alt-u
uppercase current word

PROMPT_COMMAND='history -a && history -n'
collects history from current open terminals

cp ./test.txt{,.bak}
copies test.txt to test.txt.bak

cp -a ./directory/* /anotherDirectory/
copies all files in a folder and keeps permissions

echo $_
echos last arguemnet passed to console

bashEnd
-------

----win4bsd----
winpro -ws maximized
runs win4BSD max size

winpro -ws 1152x864

winpro -h
shows help for win4bsd

shift+F12
opens menu

----endwin4BSD----

whatis
apropos
searches whatis database for keyword, gives description of programs
try apropos '\(6\)'

apropos editor
shows programs that have editor in their description

scp -P 22 ./test.txt username@192.168.2.102:/usr/home/username/test.txt
copy files to remote machine -P to specify port.

scp ./test.txt username@192.168.2.102:/usr/home/username/test.txt
copy files to remote machine

scp -r ./folderToCopy username@192.168.2.102:/usr/home/username/destinationFolder/
copy directory to remote machine

scp -r '-P 1234' ./folderToCopy username@192.168.2.102:/usr/home/username/destinationFolder/

xwd -out 3rdDesktop01.xwd -root
saves screen shoot

distclean
cleans out ports files. fixes this error:
local modification time does not match remote

mkisofs -J -o out.iso -r -V volume_name directory
create iso image

/etc/netstart
restart network

-----
rc.conf

ifconfig_dc0="inet 192.168.1.2 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="whatever.what"
set static ip

dhclient ndis0
gets dynamic ip

/usr/local/etc/nagios
/usr/local/www/nagios/docs
nagios files

/usr/local/bin/nagios -v /usr/local/etc/nagios/nagios.cfg
test nagios configs

/usr/local/bin/nagios /usr/local/etc/nagios/nagios.cfg &
start nagios

shift insert
paste with keyboard

ispell
simple command line spell checker

aspell
command line spell checker

source ~/.bash_profile
reparse bash shell configuration

nspluginwrapper -v -a -i
install all plugins from their default locations (netscapePluginWrapper)

nspluginwrapper -i path/to/plugin.so
install from specific locations

nspluginwrapper -r pat/to/plugin.so
remove specific plugin

nspluginwrapper -l
list all currently installed plugins

---------
elinks
enhanced txt based browser

ESC - shows menu

endElinks
---------

ssh -D 8080 -f -C -q -N myuser@myserver.com
tunnel web traffic through ssh

fgrep word file.name
searches for word in file

ls | egrep '(wordOne|wordTwo)'
greps ls for two words

ls -1
shows files in one column

id
show userId, groupId, and groups of current user

feh --bg-scale /path/to/image.jpg
set wallpaper

echo $TERM
displays terminal type

korean
-------
export XMODIFIERS=@im=Ami
export LC_CTYPE=ko_KR.eucKR
ami &

start korean keyboard

end korean
----------

lua-5.1
start lua

rmuser dust
remove user dust

unrar x test.rar
uncompress rar

/usr/local/sbin/httpd -v
check version of apache

/usr/local/etc/rc.d/lighttpd start
start lighttpd (stop,restart,start)
killall lighttpd (if no script)

find / -type f -exec grep -H 'joemammy' {} \;
find joemammy inside files on /

grep hello ./*
find word hello in all files in current directory

vi /boot/grub/menu.lst
edit grub menu file

usbdevs -v
show usb devices

mount -t msdosfs /dev/da0s1 /mnt/camera
mounts nikon coolpix L11, must be set to mass storage under ???

---------
To install mono-merge, download it, then install with:
make install

svn must be installed to use mono-merge

mono-merge -D
merges development version from BSD# into /usr/ports

mono-merge
merges BSD# version of mono into the ports system
---------

wget -m -k -K -E http://url/of/web/site
mirror a website

wget --spider --force-html -i bookmarks.html
use wget to check validity of bookmarks

ls -l | grep '^d'
list directories in current folder ('^d' looks for lines starting with a d)

ls -l | grep '^d' | awk '{ print $NF }'
shows on the folder names of the directories

chmod u+x ./scriptFile
add executable permission to scriptFile for current user

find ./ -type f | xargs perl -pi -e 's!/usr/bin/ruby!/usr/local/bin/ruby!g'
search all files in a folder and replace: /usr/bin/ruby with: /usr/local/bin/ruby

ls | awk '{print "<a href=\""$1"\">"$1"</a>"}' > index.html
make html links to every file in the current directory inside index.html

ls | awk '{print "<a href=\""$1"\">"$1"</a>"}' >> index.html
same as above except appends the links to index.html

ls | awk '{print "<img src=\""$1"\">"$1"<br>"}' > index.html
create img tags for every file in directory and write to index.html

grep ruby ./*
look for any files in current folder that contain the word: ruby

tar -zcvf nameOfTarFileToCreate.tar.gz ./DirectoryWantedCompressed
tar a file to a .tar.gz

tar -zxvf ./nameOfFileToExtract
untar a file

mysql_install_db
run this after first install to finish setup

GRANT ALL ON dbName.* TO 'testuser'@'localhost' IDENTIFIED BY 'testpassword';
give user rights to a mysql database

insert into grid (x, y) values ('-98', '-98');
add x and y to table grid

delete from settlements where id='61';
deletes the row/record in table settlements that has id matches 61

update users set x='-98', y='-98' where id='2292';
update record x,y in table users with -98,-98 that matches id 2292

mysql -u user-name -p db-name < db-template.sql

transfer mysql database
-----------------------
mysqldump --quick db_name | gzip > db_name.gz
dump database to a gzip file to transfer to new machine

mysqladmin create db_name
create databse on new machine

gunzip < db_name.gz | mysql db_name
unzip and databse and throw it in mysql
--------------------------

xconsole
if installed can show what syslogd is writing to ttyv0, inside of X

grep "^    :" 00_data.txt  | sed '$!N;s/\n/ /'  | awk '{print $1 $2 $5}' > 00data.txt
greps for 4 spaces the : at the beginning of each line. sed combines every two lines. awk prints the 1st 2nd and 5th field of each line. > writes it to 00data.txt

Crontab
-------
crontab -e
edit the crontab for the user you are logged in as

Mutt
-----
$
purges deleted messages

end mutt
--------

tmux
----
attach -d -t0
attatch to session 0

end tmux
--------

tcpdump -s0 -X -i bge0 port 80
watch what is happening on port 80

javascript:alert(unescape(document.cookie))
type this in as a browser url, to see the cookies on a webpage

pstree
list processes as a tree (must be installed)

tree -a
show directories in a tree view. (must be installed)

mogrify -resize 75x75 ./*.jpg
resize all jpg in current directory to 75x75 (requires imagemagick to be installed)            

xwininfo -tree
show info abou twindows
(xwininfo and xininfo show info about windows)

grep
----
grep -r "jowdaddy" /home
recursively search for jowdaddy inside files located in your /home

grep -v notmeplease
show all lines that do not match notmeplease

find
----
find /home /tmp -name yasister.txtme
search /home and /tmp directories for yasister.txtme

find ./learn -ls
displays inode number (inode serial), size in 512-byte blocks, file permissions, number of hard links, owner, group, size in bytes, last modification time, and pathname.
**very similar output as (ls -igls)

find `script-that-chooses-dirs` -name choosenFile
uses a script to choose which files to search for chosen file

find ./learn -type f -size 0 -ls
search learn folder for a regular file that has file size of 0 and display in long format

find /usr/home /var/html /usr/local/www -name "*.htm*" -print
find all files with names containing .htm (-print is the default and prints to standard out) so the previous command is equivelant to:
find /usr/home /var/html /usr/local/www -name "*.htm*"
**all regex need to be quoted or they will be passed to the shell rather than find

find ./ -iname RECIPE.txt
case insensitive search for recipe.txt in current folder

find $HOME -mtime -1
find files in the home directory modified in the last 24 hours

find $HOME -mtime +365
find files that have not been modified in the last year

find /home/username -mtime -7 -name "*.htm*"
find htm/html files that have been modified in the last week (7 24hour)

find /home/user/www -mtime 7 -name "*.php*"
search for files that were modified exactly a week ago

find /var/log -mtime +7 -name "*.log"
find files that have not been modified for at least a week

find /$HOME/pics -newer $HOME/scripts/resize-pics.rb
find files in pics folder that have been modified more recently than resize.pics.rb

find /home -name "*.txt" -size 100k
find /home -name "*.txt" -size +100k
find /home -name "*.txt" -size -100k
display files that are 100k in size / more than 100k in size / less than 100k in size

find . -name '*.jpg' -exec ls {} \;
find all jpgs in current directory and use ls to display them

find $HOME/. -name '*.jpg' -ok rm {} \;
find all jpgs in current directory and ask for confirmation before deleting each

touch thisNewFile
creates a new empty file named thisNewFile

ls -s /someDirectory/originalFile /anotherDirectory/linkedToOriginalFile
creates a file that is linked to another. Editing the linked file changes the original

rm -f aFileThatNeedsDeleting
deletes a file without asking

rm -rf byeByeDirectory
deletes a directory and everything in it without asking

file somefile
attempts to guess type of file by its content

file *
guess filetypes of all files in a directory

wc filename
counts lines, words, and characters in a file

wc -l filename
counts lines in a file

ls -al > ./saveLsOutput.txt
overwrites text file with ls' output or creates an new file

ls -al >> ./saveThis.txt
appends output to file or creates new one if it does not exist

<
send input from a file back into a command

mplayer -vo xv dvd://1
play dvd

mplayer -nocache -playlist "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=15364&file=filename.pls"
play shoutcast stream

baobab
gui that shows disk usage

mail
----
d 1-5
deletes messages 1 through 5

t <message list>                type messages
n                                  goto and type next message
e <message list>                edit messages
f <message list>                give head lines of messages
d <message list>                delete messages
s <message list> file           append messages to file
u <message list>                undelete messages
R <message list>                reply to message senders
r <message list>                reply to message senders and all recipients
pre <message list>              make messages go back to /var/mail
m <user list>                   mail to specific users
q                               quit, saving unresolved messages in mbox
x                               quit, do not remove system mailbox
h                               print out active message headers
!                               shell escape
? print this help message
# display message number #
- print previous
+ next (no delete)
! cmd execute cmd
<CR> next (no delete)
a position at and read newly arrived mail
d [#] delete message # (default current message)
dp delete current message and print the next
dq delete current message and exit
h a display all headers
h d display headers of letters scheduled for deletion
h [#] display headers around # (default current message)
m user mail (and delete) current message to user
n next (no delete)
p print (override any warnings of binary content)
P override default 'brief' mode and display ALL header lines
q, ^D quit
r [args] reply to (and delete) current letter via mail [args]
s [files] save (and delete) current message (default mbox)
u [#] undelete message # (default current message)
w [files] save (and delete) current message without header
x exit without changing mail
y [files] save (and delete) current message (default mbox)
Share on Facebook
Leave a Comment more...

HTML Code for Date

by on May.31, 2011, under Belajar IT

<Script type=”text/javaScript”>

// Get today’s current date.
var now = new Date();

// Array list of days.
var days = new Array(‘Sunday’,'Monday’,'Tuesday’,'Wednesday’,'Thursday’,'Friday’,'Saturday’);

// Array list of months.
var months = new Array(‘January’,'February’,'March’,'April’,'May’,'June’,'July’,'August’,'September’,'October’,'November’,'December’);

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? “0″ : “”)+ now.getDate();

// Calculate four digit year.
function fourdigits(number)   {
return (number < 1000) ? number + 1900 : number;
}

// Join it all together
today =  days[now.getDay()] + “, ” +
months[now.getMonth()] + ” ” +
date + “, ” +
(fourdigits(now.getYear())) ;

// Print out the data.
document.write(today);

//  End –>
</script>

Share on Facebook
Leave a Comment more...

CHMOD

by on May.31, 2011, under Belajar IT, Note

chmod = change file modes

Permissions Owner Group Others
chmod 777 rwx rwx rwx
chmod 666 rw- rw- rw-
chmod 555 r-x r-x r-x
chmod 444 r– r– r–
chmod 333 -wx -wx -wx
chmod 222 -w- -w- -w-
chmod 111 –x –x –x
chmod 000

After chmoding a file you can use ls -l to view the permissions.

Using the above chart you can combine permissions.

chmod 644 = rw-r–r–

chmod 731 = rwx-wx–x

Owner = user that created the file

Group = users in the same group as owner

Others = the rest of the users on the system

Share on Facebook
Leave a Comment more...

Upgrade IOS CISCO

by on May.26, 2011, under Belajar IT

#Cek versi dan cek space storage :
Switch#dir flash:/
Directory of flash:/

2 drwx 10240 Mar 01 1993 00:06:25 html
4 —x 346 Jan 01 1970 00:00:10 env_vars
5 -rwx 1750311 Mar 01 1993 00:04:28 c2900XL-c3h2s-mz.120-5.3.WC.1.bin
6 -rwx 98833 Mar 01 1993 00:05:09 c2900XL-hdiag-mz.SA6_8_2
166 -rwx 25 Mar 01 1993 00:05:16 snmpengineid
167 -rwx 1177 Mar 01 1993 00:02:40 config.text

#Delete file boot lama ( Kalo pas cek space masih muat proses ini bisa terakhir jalaninnya ):
Switch#delete flash:/c2900XL-c3h2s-mz.120-5.3.WC.1.bin
Delete filename [c2900XL-c3h2s-mz.120-5.3.WC.1.bin]?
Delete flash:/c2900XL-c3h2s-mz.120-5.3.WC.1.bin? [confirm]

#Coppy drom Tftp server :
Switch#copy tftp: flash:/
Address or name of remote host [10.10.10.216]?
Source filename [c2900xl-c3h2s-mz.120-5.WC17.bin]?
Destination filename [c2900xl-c3h2s-mz.120-5.WC17.bin]?
Accessing tftp://10.10.10.216/c2900xl-c3h2s-mz.120-5.WC17.bin…
Loading c2900xl-c3h2s-mz.120-5.WC17.bin from 10.10.10.216 (via VLAN1): !!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 1811903 bytes]

1811903 bytes copied in 68.787 secs (26645 bytes/sec)
Switch#dir flash:/
Directory of flash:/

2 -rwx 1811903 Mar 01 1993 00:14:11 c2900xl-c3h2s-mz.120-5.WC17.bin
3 -rwx 105970 Jul 18 2000 01:26:29 c2900XL-diag-mz-120.5.2-XU
4 drwx 6784 Jul 18 2000 01:26:30 html
111 -rwx 1153 Mar 01 1993 00:06:44 config.text
112 -rwx 286 Jan 01 1970 00:00:24 env_vars

#verify file :
Switch#verify flash:/c2900xl-c3h2s-mz.120-5.WC17.bin
Verified flash:/c2900xl-c3h2s-mz.120-5.WC17.bin

#jadikan file bin yang baru menjadi boot system :
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#boot system flash:/c2900xl-c3h2s-mz.120-5.WC17.bin
Switch(config)#^Z
Switch#wr mem
Building configuration…
[OK]
Switch#reload
Proceed with reload? [confirm]

Share on Facebook
Leave a Comment more...

HOWTO: Backup files with tar

by on Feb.09, 2011, under Belajar IT, Copas, Note

Posted by Jason on Sunday July 01, @12:37PM
from the It’s-Sticky-Fun-Fun-Fun dept.
TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball file- somewhat like a pkzip file, only compression is optional.
Source

[The basics]

In these examples, I will use the following file structure: a top level directory called DIR1 containing the files picture.jpg, document.doc and database.db.

DIR1/

DIR1/picture.jpg
DIR1/document.doc
DIR1/database.db

[Creating a tarball]

If we were in the directory DIR1 and wanted to backup all the files to a tarball called backup.tar, we could issue this command:

$ tar cvf backup.tar .

./
picture.jpg
doucment.doc
database.db
tar: backup.tar is the archive; not dumped

Note:
c=create (an archive)
v=verbose (just because)
f=filename (the name of our tarball)
.=current directory (what’s going to be backed up)

Also worth mentioning is that by default tar is recursive- meaning it will back up all files and subdirectories recursively unless you otherwise specify with the n flag (non-recursive)

[Displaying the Contents of a Tarball]

The current directory will now contain a file called backup.tar. To display the contents of the tarball file, we could issue this command:

$ tar tvf backup.tar

drwxr-xr-x root/gci 0 Jun 29 10:10 ./
-rw-r–r– root/gci 1 Jun 29 10:10 picture.jpg
-rw-r–r– root/gci 1 Jun 29 10:10 document.doc
-rw-r–r– root/gci 1 Jun 29 10:10 databse.db

Note:
t=table of contents (list)
v=verbose (display all info)
f=filename (backup.tar)

[Extracting Data from a Tarball]

To extract the entire contents of the tarball to the current directory, we can type:

$ tar xvf backup.tar

./
picture.jpg
doucment.doc
database.db

Note:
x=extract
v=verbose
f=filename (backup.tar)

To extract only the picture.jpg file from the archive, type the following command:

$ tar xvf backup.tar picture.jpg

Alternatively, you can use wild cards in either the creation or extraction of a tarball. To extract all jpg files from our archive, we can use a command like this:

$ tar xvf backup.tar *.jpg

[Using Compression]

If you would also like to add compression to your tarballs, you can combine the gzip utility with tar on the command line by adding the z switch to the command. Usually when this is done, we change the suffix of our tarball filename from .tar to either .tgz or .tar.gz. This will let whoever sees the file know that it is a gzipped tarball.

$ tar zcvf tarball.tgz .

Note:
z=gzip compression
c=create
v=verbose
f=filename (backup.tgz)
.=current directory (what to backup)

[Permissions with tar]

If you would like to preserve the permissions of the files you backup, use the p option with the tar command. This will save the uid, gid as well as the specific permission attributes of the files (read, write, execute etc.)

$ tar pzcvf tarball.tgz .

You should also use the p option with the tar extraction command:

$ tar pxvf tarball.tgz .

[Using tar with a Tape Drive]

I use tar in conjunction with my Seagate DAT drive. If you issue any of the previous commands in this HOW-TO without the f option and a tarball filename, you will find that tar will default to writing the files to the device /dev/rsa0 (raw sequential access device 0). Basically this is your first SCSI tape drive. If you have more than one tape drive you would like to use, you can issue the f option and the device name (rsa0, rsa1 etc.) of your specific tape drive instead of a filename.

Examples:
Backing up the current directory to Tape:

$ tar cv . <- default tape drive (rsa0)

$ tar cvf /dev/rsa1 . <- second tape drive (rsa1)

Restore files from Tape:

$ tar xv .
$ tar xvf /dev/rsa1

So, there are the basics of tar. If you would like more information on the tar command, try the man pages.

man tar

Share on Facebook
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!