星期六, 8月 21, 2010

海綿寶寶- a motto

ㄟ! 海綿寶寶

嗯?

不知道為什麼,這段話我看了有點不高興耶

別這樣派大星,別這麼憤世嫉俗~~
你要知道,並不是每次有人提到愚蠢,都是在說你的~~

嗯...可是我並不是為了這個才不高興的...

那你究竟是怎麼啦?派大星,我最好的朋友。

為什麼裡頭沒有提到我的膨膨小褲褲?

喔~~別這樣派大星。別這麼憤世嫉俗。
你要知道,畢竟,這世界不是繞著你的小褲褲轉動的。

是嗎?我倒不覺得。
滴溜溜溜......(派大星原地轉了一圈)
你看,這世界剛剛就繞著我的小褲褲轉了一圈。

噢~~派大星。
雖然你的說法很有道理,可是我還是懷疑你可能有點走火入魔了。

星期一, 7月 05, 2010

moto milestone

GTalk Service Monitor
*#*#8255#*#*
工程模式
*#*#4636#*#*

  1. Display IMEI:
    *#06#
  2. Voice Dialer Logging Enabled
    *#*#8351#*#*
  3. Voice Dialer Logging Disabled
    *#*#8350#*#*
  4. Phone Setting
    *#*#4636#*#*
  5. FieldTest
    *#*#7262626#*#*

星期二, 5月 25, 2010

a motto

蘇格拉底名言︰「智慧意味著自知無知。」除了無知,還有什麼能促使我們進行探索?


傑斐遜
(Thomas Jefferson)︰無知和自由兼具者,過去沒有,將來也不可能有

If a Nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be... if we are to guard against ignorance and remain free, it is the responsibility of every American to be informed."

-- Thomas Jefferson

linux note

 Open Office is pretty slow and painful to use out of the box.  This simple step by step procedure speeds up the software, making it much more pleasant to use.

Open OOo (I use writer for this process). Select Tools -> Options. Select Memory.

Number Of Steps: 20
Use for OpenOffice.org: 128
Memory Per Object: 20
Number Of Objects: 20
Enable Quickstarter: Checked

Select Java.
Use a JRE: Checked (Alternately, Uncheck if you do not have Sun Java installed)
Select the radio button of the appropriate Java Engine if needed.

Click OK
Close OOo


 P5Q-EM
Sensor Properties:
Sensor Type    Winbond W83627DHG (ISA 290h)

modprobe w83627ehf force_id=0x8860


ssh -R 2215:localhost:22 icarus@X.X.X.X -N -f sleep 20
ssh edward@localhost -p 2215


mencoder -profile svi -vf scale=480:800,harddup

sysctl vm.max_writeback_pages=8192

VBoxManage   modifyvdi vmxpd.vdi compact

vmware-modconfig -–console -–install-all


mkfs.ext3 -b 4096 -j -E stride=32 -m 1  -O dir_index,filetype  /dev/md15
mkfs.ext4 -b 4096 -j -E stride=64,stripe-width=128 -m 1  -O dir_index,filetype
#Create xfs filesystem with a 64 megabyte log
mkfs.xfs -f -l size=64m /dev/hda3
#Mount filesystem with 8 log buffers, and atime and diratime disabled
mount -o noatime,nodiratime,logbufs=8 /dev/hda3 /mnt/gentoo/


rpmbuild --target=i686-redhat-linux --define 'dist .el5'   --define '_without_speex 1'  --rebuild ffmpeg-0.5-2.rf.src.rpm



find ../ -name "*rar" -print0 | xargs -0 -Iname unrar -o-  x name


mv /usr/lib/vmware/modules/binary /usr/lib/vmware/modules/binary.old
vmware-modconfig -–console -–install-all --validate-kernel-headers --validate-gcc


with 11.2: Found out that ipv6 is no longer a module, it is in the
kernel, so you can administratively disable with a kernel option in
grub's menu.lst of ipv6.disable=1 but individual applications can
still send out v4 and v6 queries. In my case yast2 -> software ->
online update still sends out both, until I find out how to disable.



http://wiki.centos.org/HowTos/OS_Protection


ALSA Driver
I got a simple solution for this compile problem.
Just open the ”./include/adriver.h” file in a text editor, go to line 100 and do one of the following :
Comment out the typedef : //typedef unsigned int fmode_t;
Change the kernel number : #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
(I've got the 2.6.27-xxxx so this effectively cancels the typedef without breaking compat with older kernels)
No if only I could get this laptop to make some noise … :(



VMWARE E1000 NIC QUICK HOW TO:

The steps are for VMWare Server 1.0, but may be similar
for other versions of VMWare.  Use at your own risk.
No warranty is expressed or implied.

Some users have reported problems with the Lance (default)
and VMXNet network card drivers with FreeBSD 6.x.  If these
occur, it is recommended to use the E1000 driver in their place.

1. In /etc/rc.conf, change ifconfig_lnc0 to ifconfig_em0
2. Make the same change in /usr/local/etc/conftemplates/rc.conf
3. shutdown -h now
4. (On host) Edit the /FreeBSD.vmx
5. Add a line:
    ethernet0.virtualDev = "e1000"
   Just below:
    ethernet0.present = "TRUE"
6. Boot the VM


ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg

把 Linux 桌面錄製為視頻。

cmake CMAKE_C_FLAGS=Release -DQTC_MODIFY_MOZILLA=true  -DQTC_DEFAULT_TO_KDE3=true ..

cmake -DQTC_DEFAULT_TO_KDE3=true  -DQT_PLUGINS_DIR=/usr/lib/qt-3.3/plugins -DQTC_BUILD_CONFIG_MODULE=true ..

cmake CMAKE_C_FLAGS=Release COMPILE_FLAGS="-O3 -march=core2 -mtune=core2 -mmmx -msse -msse2"  -DQT_PLUGINS_DIR=/usr/lib/qt-3.3/plugins -DQTC_BUILD_CONFIG_MODULE=true ..





:h motion.txt
:h syntax.txt
:h encoding
:h map.txt
:h tabpage.txt
:tabnew
:tabedit  /etc/hosts

Backup and restore


# dd if=/dev/hda of=/dev/hdc bs=16065b                # Copy disk to disk (same size)
# dd if=/dev/sda7 of /home/root.img bs=4096 conv=notrunc,noerror # Backup /

# dd if /home/root.img of=/dev/sda7 bs=4096 conv=notrunc,noerror # Restore /
# dd bs=1M if=/dev/ad4s3e | gzip -c > ad4s3e.gz                  # Zip the backup
# gunzip -dc ad4s3e.gz | dd of=/dev/ad0s3e bs=1M                 # Restore the zip

# dd bs=1M if=/dev/ad4s3e | gzip | ssh eedcoba@fry 'dd of=ad4s3e.gz' # also remote
# gunzip -dc ad4s3e.gz | ssh eedcoba@host 'dd of=/dev/ad0s3e bs=1M'
# dd if=/dev/ad0 of=/dev/ad2 skip=1 seek=1 bs=4k conv=noerror    # Skip MBR

    # This is necessary if the destination (ad2) is smaller.

守護者 / 守望者 Watchmen

昨日死比如今日生,今日生然後明日死,
生生死死,昨日今日明日很難分!

歌名:Hallejujah        原唱:Leonard Cohen

John Cale - Hallelujah Lyrics



I've heard there was a secret chord
That David played and it pleased the Lord
But you don't really care for music, do you?
It goes like this
The fourth, the fifth
The minor fall, the major lift
The baffled king composing Hallelujah

Hallelujah

Your faith was strong, but you needed proof
You saw her bathing on the roof
Her beauty and the moonlight overthrew you
She tied you
To a kitchen chair
She broke your throne, she cut your hair
And from your lips she drew the Hallelujah

Hallelujah

Baby I've been here before, I know this room
I've walked this floor
I used to live alone before I knew you
I've seen your flag on the Marble Arch
Love is not a victory march
It's a cold and it's a broken Hallelujah

Hallelujah

There was a time you let me know
What's really going on below
But now you never show it to me, do you?
I remember when I moved in you
And the holy dove was moving too
And every breath we drew was Hallelujah

Hallelujah

Maybe there's a God above, all I ever learned from love
Was how to shoot at someone who out drew you
And it's not a cry you can hear at night
It's not somebody who's seen the light
It's a cold and it's a broken Hallelujah

Hallelujah
Hallelujah

星期二, 12月 22, 2009

moonlight shadow

作者:自行車司機


這首歌最初是英國的Mike Oldfield創作的,很多網上的資料都說這首歌是紀念被槍殺的John Lennon On December 8th 1980, in front of the Dakota, a supposed fan, Mark David Chapman, fired five shots, hitting John in the chest. By the time he arrived at the hospital, John Lennon was dead. 1980年12月8日,馬克.查普曼偽裝成一個歌迷,在列儂的公寓旁邊徘徊了很久。那天晚上,當列儂從錄音棚返回家中的時候,查普曼請列儂在他的簽字本上籤名。當時他內心曾進行過激烈的鬥爭,但最後仍然舉起手槍朝著列儂的後背連開了5槍。和Moonlight Shadow中所寫的He was shot six times by a man on the run倒是有點類似;但看了原版的MTV之後,我卻覺得這首歌應該和John Lennon的被刺並沒有直接聯繫

似乎男主角死於一場決鬥中,這倒像是普希金,但不知道普希金的妻子娜達麗亞會不會這樣來懷念他.查了一下資料,曾經有國外的歌迷透露,Oldfield說起這首歌的靈感來源於Tony Curtis主演的電影Houdini,霍迪尼傳(Houdini)是美國派拉蒙公司於1953年7月2日上映的電影,故事梗概如下:在舉世聞名的幻覺大師哈利胡迪尼逝世十年後,他的遺孀貝絲找上一位靈媒,來為她召喚亡夫的鬼魂,之後便以倒敘手法回顧胡迪尼傳奇的一生

但我覺得創作這首歌的才華出眾但卻憂鬱無比的Mike Oldfield未必有所特指,或許沒必要多去考證了,只需要靜靜溶入歌中空靈純淨的月光中即可

今天早上起來翻譯了一遍這首歌,英文能力有限,不知道能否和原文的意境相符.在翻譯的時候,不由得想起了普希金,那個死於丹特斯槍下的天才詩人,嘆息

The last that ever she saw him 那是她最後一次見到他

Carried away by a moonlight shadow 因月之陰影而悄然離去

He passed on worried and warning 他消逝於憂慮和警示中

Carried away by a moonlight shadow.因月之陰影而悄然離去

Lost in a river last saturday night 他沉溺於上週末的河中

Far away on the other side. 在遙遠的那邊消遁無形

He was caught in the middle of a desperate fight 他就這樣死於這場決鬥中

And she couldn't find how to push through 而她不知道之後該如何度過

The trees that whisper in the evening 樹林在黃昏時分的低語

Carried away by a moonlight shadow 因月之陰影而悄然遠去

Sing a song of sorrow and grieving 唱一首悲傷的輓歌吧

Carried away by a moonlight shadow 因月之陰影而悄然遠去

All she saw was a silhouette of a gun 她看到的是一隻槍的側影

Far away on the other side. 在遙遠的那邊慢慢舉起

He was shot six times by a man on the run 一個逃跑的男人向他開了六槍

And she couldn't find how to push through 而她不知道之後該如何度過

I stay I pray 我止步 我祈禱

I see you in heaven far away 我看到你在天堂漸漸遠去

I stay I pray I see you in heaven far away

Four am in the morning 凌晨四點鐘的時間

Carried away by a moonlight shadow 因月之陰影而悄然逝去

I watched your vision forming 我彷彿看見你的幻像

Carried away by a moonlight shadow 因月之陰影而悄然逝去

Star was light in a silvery night 銀色的夜裡星光熠熠

Far away on the other side 在遙遠的那邊靜靜閃爍

Will you come to talk to me this night 今天晚上你還會回來找我嗎?

But she couldn't find how to push through 而她不知道之後該如何度過

I stay I pray 我止步 我祈禱

See you in heaven far away 我看到你在天堂漸漸遠去

I stay I pray See you in heaven far away

Far away on the other side. 一直到遙遠的那邊

Caught in the middle of a hundred and five 悲傷的人群伴隨著他

The night was heavy but the air was alive 夜色凝重而空氣仍在流動

She couldn't find how to push through 而她不知道之後該如何度過

Carried away by a moonlight shadow 因月之陰影而遠去

Carried away by a moonlight shadow 因月之陰影而遠去

Far away on the other side. 一直到遙遠的那邊


4. Mike Oldfield,英國作曲家/製作人,14歲時就與姐姐合組民謠二重唱,1973年出版的《tubular bells》,為恐怖經典電影《大法師》增添陰森懾人的氣氛。專輯中Mike Oldfield親自演奏了近30項的樂器,不僅被譽為樂器天才,其中電子合成器的運用,也被視為日後新世紀音樂的起源之一,《tubular bells》成為他不朽的代表作,1992與1998年更出版了《tubular bells》的第二、三集續作。70年代,他尚有一些演奏專輯出版,不過由於憂鬱的個性與壓力雙重影響,Mike Oldfield處於精神崩潰邊緣,因此他過著隱士的生活甚至接受治療。80年代,專輯《qe2》是他另一張代表作品,而從《five miles out》、《crises》專輯之後,流行的元素再加入女歌手的客串主唱都使他的音樂聽來爽朗,似乎已走出陰霾、詭譎的心理狀態。 moonlight shadow這首歌因為groove coverage的翻唱和樂隊的走紅,這首歷久不衰的老歌又被大家重提。moonlight shadow是Mike Oldfield嘗試加入人聲演唱來豐富旋律情感寫出的暢銷佳作之一

其實Mike Oldfield 演唱版的歌曲都是做出來請別人唱,不過都不是掛演唱者的名字,因為都發表在Mike Oldfield的專輯中,只有專輯內頁的介紹才會說vocal是誰.moonlight shadow的最早原唱是Maggie Reilly.


這首歌共有13個版本
A. Maggie Reilly
Maggie Reilly,蘇格蘭人,moonlight shadow最早版本原唱歌手。1992年,她發佈了她的首演獨奏冊Echoes,1993年Midnight Sun,1996年Elana

B. Fiorella Pierobon
Fiorella Pierobon演唱的moonlight shadow可以說是柔情版中的佼佼者了,在純淨清澈的聲線中帶出一種悲傷的感覺,逝去的戀人永遠也無法挽留,只能追隨著月亮的影子,沉浸在自己心中過去的一個個美好回憶中...

C. Annie Haslam 專輯: Live Under Brazilian Skies(1998)
Annie Haslam是一個傑出音樂創作人,同時也是一個藝術家。多數唱片的封面都是由她以油畫方式繪製,實力非同少可,而這版本的風格也顯示出了她的才華。 Annie Haslam可說又是個一夕成名的女歌手。據說小時候在唱詩班曾因歌聲過於宏亮而被迫退出,原先在倫敦打算從事服飾設計而曾學過聲樂技巧的Annie因緣際會下看到刊登在在melodymaker的廣告前去應徵,在試音時重新演繹kingsandqueens令人驚豔。經過短暫的赴歐實際演唱訓練後,由 JohnTout擔任鍵盤手,RobHendry吉它,JohnCamp貝斯,TerrySullivan敲擊樂器,全新的組合新專輯(1972)果然也名副其實是場美輪美奐饗宴的序幕。

D. Dana Winner 專輯: Unforgettable (2001-10)
Dana Winner翻唱的moonlight shadow是比較有代表性的。這版本充滿歐陸民謠風,節奏由慢而快,開始的時候是很柔和舒服,當漸漸步入高潮時,節奏就開始輕快,輕快的節奏會讓人隨著節奏而翩翩起舞。dana winner的聲線很適合moonlight shadow,因為很甜美柔和,很適合這首歌要代表的寓境
Dana Winner,比利時女歌手,音色純淨,音域寬廣的她1988年在一次混音競賽中,以一首由Mireille Mathieu唱的"Amour Défendu"獲勝.次年,發行了第一張單曲翻唱卡朋特的"Top of the World"(Op het dak van de wereld),從此走上演藝事業。1992年末,另一首單曲"Woordenloos"發行,立即收到樂迷們的青睞,上榜之後,排名更是居高不下,達數月之久。2001年10月,Unforgettable專輯發行,再次引起轟動,專輯收錄了許多經典翻唱曲目,例如:Moonlight Shadow、Morning has Broken、I'll Always Be There等等

E. Aselin Debison 專輯 :Sweet is the Melody (2003-03)
Aselin Debison ,1990年出生。來自加拿大新斯科細亞省的布里頓岬島,一個充滿著無限風情的小島,在艾絲琳的身上,你可以強烈感受到當地人們的純樸善良。自小喜愛唱歌的她,並未受過任何專業的音樂訓練,但她希望能藉由歌聲為大家帶來歡娛。單曲moonlight shadow發行時間是2002/11/20,當時她年僅12歲「甜美旋律」,是艾絲琳的第一張專輯,曲風是自然清新的鄉村民謠,也是她最想唱的歌。最特別的是三首大家熟悉的曲目「Moonlight Shadow」、「Over the Rainbow」和「What a Wonderful World」,全在艾絲琳重新詮釋下,透露出來自原野的芳香,這是其它少女歌手望塵莫及的。另外「The Island」一曲,是布里頓岬島的民俗島歌,艾絲琳甜美可人的風貌再次體現,就連台灣史上最受歡迎的暢銷繪畫作家幾米,在聽了艾絲琳的歌聲後,也不禁大為感動,讚譽她的音樂有一種大人沒有的純真與可愛,並將她的歌曲收錄在音樂專輯「月亮忘記了」中。

F. 盧巧音 專輯:Candy Lo True Music 1st Flight Live (2003)
在音樂上,盧巧音始終是自我的,她說得很堅決,不想因為發片而發片,也不想過多地去迎合市場。憑著實力派的唱功來,憑著唯美的嗓音,盧巧音堅信著會有那麼一些永遠喜歡她的歌的耳朵。在每一次選歌的時候,盧巧音總是會有一個不變的標準,必須是一些在她看來可以聽很久的東西,真正經得起時間蕩滌的音樂。有時候,在這樣的年代裡這份堅持會有一點艱難,所以盧巧音只能說自己不會是一個非常多產的歌手,不期望唱很多,但希望唱很久。聽每張唱片的時候都會有新的感覺,每張都有新的意義。只有在現場而不是商業發行的專輯唱片裡,盧巧音才能做到即興的遊走於搖滾,電子,瘋克,雷吉甚至金屬等豐富廣闊的領域,翻唱Mike Oldfield的"Moonlight Shadow"是非常悅耳的作品

G. KOKIA
KOKIA,日本歌手,生於 1976/07/22。KOKIA這個藝名,其實是她的真名亞紀子(AKIKO)反過來念,發行過7張單曲2張專輯,鄭秀文曾翻唱她的歌,讓她在香港的知名度大增。她被河村隆一列為RKS計劃中最重要的藝人,擁有驚人的創作力,自己填詞譜曲。她的歌聲就像恩雅一般空靈,愛寫歌作詞的她,編織了迪士尼的美麗童話,她以歌聲及想像所構築的飄渺仙境,吸引著許多樂迷。這版本的風格比起以上的版本有著截然不同的感覺,強烈的電子guitar要素在裡面,配合著歌手野性般的聲線,給人的感覺是狂野的

H. Mixture Vokale
Mixture Vokale,一看就知道是個合唱團了,就連合唱團也翻唱moonlight shadow了。關於Mixture Vokale,可能大家認識不多,不過這合唱團是很有名堂的,去過很多的國家演出,很多的音樂學習者都夢想自己能去這個合唱團不過這版本應該沒什麼人知道,風格大家也該猜到,就像是教堂每週開幕儀式的合唱一樣莊嚴

I. Groove Coverage 專輯:Covergir
Groove Coverage,中文名字叫舞動精靈王族,這個德國新晉樂隊現在應該被很多人認識了吧。2002年出道,兩人組合,主唱:verena(女),1984 年5月14日出生,dj及創作:dj novus 原名markus schaffarzyk,1976年11月7日出生。出道時間雖然不早,不過以其混合多種元素的舞曲風格迅速走紅,馳名全歐,略帶沙啞顆粒狀的聲線非常獨特,讓人流下深刻的印象,翻唱的moonlight shadow更是這樂隊的代表作之一。一共翻唱了兩個版本,一個是舞曲版,一個是鋼琴版。先說舞曲版,這版本節奏感很強,混雜著強烈的電子音樂,不過雖然是舞曲風格,但聽起來卻覺得感覺有一點的迷惘。鋼琴版的風格就截然不同了,很溫和。但我認為verena唱舞曲風格比較有天賦,可能是和她的沙啞聲線有關

J. Missing Heart
Missing Heart是一個德國的音樂專業製作組,成員來自bros隊(david brandes,felix j.gauder,domenico labarile,gary jones等等),組合成立於1994年。他們在1994年發行了第一個單曲作品"wild angels",就此開始了他們的音樂製作路程。在1996年發行了第二單曲"charlene",從這時候開始這組合開始被人慢慢認識,在歐洲的舞曲樂壇和俱樂部流行起來。組合在1997年再次發行了第三張單曲"moonlight shadow",這次的作品是重新混音。之後moonlight shadow被日本音樂公司收錄在的舞曲專緝"dance mania 7" (1997)和"dance mania extra" (1998)裡面,專緝推出之後引起了Missing Heart風潮。Missing Heart 製作的moonlight shadow在日本非常受歡迎,被引用在其他影像裡製作mtv的情況不記其數,動漫方面浪客劍心星霜篇可是這些同人作品裡的代表作。為組合演唱的歌手一共有兩個,最初的歌手是來自電子舞曲組合e-rotic裡的女歌手Lyane Leigh,2000年之後就改由音樂界新星Manu More女歌手來演唱,演唱的moonlight shadow也分別由兩個歌手唱出各自的版本
由Lyane Leigh演唱的moonlight shadow是moonlight shadow (radio edit),發行時間為1997年。這版本被很多人認為是groove coverage唱的,其實不是。大家應該在kugoo裡下載過一首groove coverage唱的moonlight shadow[dance remix]版吧,其實就是這個版,美妙的旋律配上具有穿透力的沙啞聲線,衝擊力一流.不過因為某些原因lyane leigh離開了樂隊。Lyane Leigh原來來自於另外一個組合e-rotic。e-rotic也是一個德國電子舞曲組合,組合成員有兩個,一男一女,男是dj,女是主唱
由Manu More演唱的moonlight shadow是為了日本遊戲公司konami製作的音樂遊戲dance dance revolution 5thmix而推出的,時間是1999年。這版的聲線很甜美,很有吸引力.Manu More擁有一頭黑褐色的頭髮和一雙黑色的眼睛,美麗的外貌下隱藏著強大的實力,她的聲音非常的悅耳動聽,甜美的聲線就如同她的外貌一樣成為了自己的有力武器,在歐洲舞曲界引起了轟動。雖然Manu身在德國,但她的出生地可是在中國的香港,出生於1978年10月29日。她的音樂事業在德國裡可以寫下光輝的一頁,她的舞曲音樂給歐洲定下了新的標準,她為歐洲的club和disco houses注入了新的力量,但她仍然對自己的音樂定下一次比一次高的標準

K. Diatonica
Diatonica是一個樂隊,樂隊主唱Anna,電子混音成熟,節奏感很強

L. my will版本,男版,感覺和前面的截然不同

M. jim branning版本,超惡搞版








Tricks Of The Light


I have a crazy man
Waiting for a confirmation.
Signs keep a-changing up.
I need some more information.


Some are tricks of the light, you'll never know.
Make a flickering midnight light into a glow.
It's a trick of the light.
It's a trick of the light.


Something that tells me how,
Her bright blue eyes are shining.
She turns up her head now,
Where she walks, she's and I am.


[ Chorus ]

Some are tricks of the light, you'll never know.
Make a flickering midnight light into a glow.
And the spot that you saw so bright was just for show.
Could it ever have turned out right? You'll never know.
It's a trick of the light.
It's a trick of the light.


She turns, she takes his hand,
Breaking his concentration.
She burns at his command,
That ends some man's recollection.


[ Repeat Chorus ]

Could it ever have turned out right, now?
It's a trick of the light.
That is something you'll never know.
It's a trick of the light.


Could it ever have turned out right, now?
It's a trick of the light.
That is something you'll never know.
It's a trick of the light.


Could it ever have turned out right, now?
It's a trick of the light.
That is something you'll never, something you'll never,
Something you'll never, something you'll never,
Something you'll never, something you'll never,
Something you'll never, something you'll never....

星期二, 2月 19, 2008

設定 GRUB 單次重新開機到特定作業系統

這兩日為了2.6 裡面的幾個核心的安全問題 (DSA-1494-2),包含 Multiple Memory Access Vulnerabilities 與影響 VServer 的 『/proc' Local Memory Access Vulnerability 等,於是開始著手升級手上的一些伺服器。

由於許多伺服器都在機房中,大部分機器都沒有裝 HP Integrated Lights-Out 、 IBM RSA 或 Intelligent Platform Management Interface 之類的工具,遠端管理不易,萬一出了甚麼狀況只能去電請求機房人員協助處理。

最麻煩的是若是新核心開機失敗,還要拜託值班人員協助查看 console 錯誤訊息後,才能決定是否要換回原本的核心重新開機。比較簡單的作法是如果重新開機失敗,就請人按一下重開機鍵,自動載入舊版的核心即可。

新核心開機出錯的有兩種可能性,

  • 一個是 kernel image/ram disk image (initrd) 格式錯誤
  • 另一個則是 kernel modules, kernel 參數設定錯誤,以至於系統無法載入特定驅動程式或掛載檔案系統

為了排除這兩種可能發生的錯誤,在 GRUB (大部份新版的套件系統 都已經停止使用 LILO 而改用 GRUB) 中可以參考 How to make your system robust 中的設定修改 menu.lst。

首先,為了防止核心格式錯誤、核心參數或 menu.list 中的路徑設定問題造成 GRUB 根本無法載入新核心,可以使用 fallback 參數設定若預設開機設定失敗時,應採用那一組設定。

另外,若是核心載入後,才發生的驅動程式、核心模組錯誤,導致系統重新 開機,就必須改採另外一個設定,因為系統重新開機後, GRUB 還是會使用預設的開機設定,因此系統就會陷入不停重新開機的無窮迴圈。因此,我們必須使系統只嘗試載入新核心一次,第二次重新開機則改為舊版核心,因此萬 一出了意外,只要重新開機就可以透過舊版核心先行開機。

在 grub shell 中下達以下指令,就可以使系統使用新版核心重新開機一次

grub> savedefault --once --default=1
grub> quit

新的 GRUB 套件中亦提供了一個指令叫做 grub-reboot (8), 可以協助你完成以上的設定。這個指令只吃一個參數,就是 GRUB 開機設定序號。如上述設定,就是 grub-reboot 1,該指令執行後,會詢問你是否重新開機,如果重新開機後沒有問題,即可更改 menu.list 或利用 grub-set-default (1) 將新核心開機設定為永久預設開機設定。(你也可以透過修改 menu.list 的方式達到同一目的,唯手續較為繁複)

星期六, 2月 16, 2008

扥爾斯泰

『我想要的是躍動的、而非安逸的生命歷程﹔
為了所愛,我寧可冒險犯難、犧牲自己。
我感到自己有著豐沛無比的精力,
但在我們寧靜的生活中,卻找不到宣洩之處。
     -扥爾斯泰』

星期三, 8月 29, 2007

建立https的SSL憑證

建立https的SSL憑證(適用RHEL 4及FC 3)

一、RHEL4 及 FC3 版本

 1. 到 /etc/httpd/conf/ 目錄下來建立憑證,目錄下有許多 ssl.* 的目錄,建立後的憑證要各別放入所屬的目錄中。

  # cd /etc/httpd/conf/


 2. 建立 server.key 使用 1024-bit key 加密,一般也可使用 512-bit key 或 2048 -bit key,使用越大的 bit 數加密,解密的時間越長,雖然安全性越高,但所花的連線時間也會越長,所以建議使用 1024-bit 即可。

  # openssl genrsa -out server.key 1024

   Generating RSA private key, 1024 bit long modulus

   ..++++++

   .......++++++++

   e is 65537 (0x10001)


  每次執行時上面的訊息都會有些許不同,檢查執行後目錄下是否有產生 server.key 的檔案。

genrsa generate an RSA private key.


 3. 建立 server.crt 憑證,有效時間為 365 天,使用 X.509 憑證格式。

  # openssl req -new -key server.key -out server.crt -x509 -days 365

   You are about to ....................................................................................

   ...................................................................................................................

   If you enter '.', the field will be left blank.

   -----

   Country Name (2 letter code) [GB]:
TW <輸入國家簡稱(兩個字母)

   
State or Province Name (full name) [Berkshire]:Taiwan <輸入省或州

   Locality Name (eg, city) [Newbury]:
Taipei <輸入城市名稱

   Organization Name (eg, company) [My Company Ltd]:XYZ <輸入公司名稱

   Organizational Unit Name (eg, section) [ ]:ABC <輸入部門

   Common Name (eg, your name or your server's hostname) [ ]:www.xyz.com.tw <建議輸入主機的FQDN

   Email Address [ ]:service@mail.xyz.com.tw <輸入管理者的mail

  檢查執行後目錄下是否有產生 server.crt 的檔案。

req - PKCS#10 certificate request and certificate generating utility.

-new

this option generates a new certificate request. It will prompt the user for
the relevant field values. The actual fields prompted for and their maximum
and minimum sizes are specified in the configuration file and any requested
extensions.

If the -key option is not used it will generate a new RSA private key using
information specified in the configuration file.

-x509
this option outputs a self signed certificate instead of a certificate
request. This is typically used to generate a test certificate or a self
signed root CA. The extensions added to the certificate (if any) are speci-
fied in the configuration file. Unless specified using the set_serial option
0 will be used for the serial number.

 在Linux下只要兩行指令即可產生憑證及key。


 4. 接下來只要將 server.crt 及 server.key 搬移到相關的目錄中即可。

  # mv server.key /etc/httpd/conf/ssl.key/

  # mv server.crt /etc/httpd/conf/ssl.crt/


 5. 若不知道你的 httpd 所放置 crt 及 key 的位置,可檢查 httpd.conf 裡,SSLCertificateFile 及 SSLCertificateKeyFile 的參數。

  #vi /etc/httpd/conf/httpd.conf

   SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt

   SSLCertificateKeyFile
/etc/httpd/conf/ssl.key/server.key


 6. 最後只要重新啟動 httpd 新的憑證即可生效。

  # service httpd restart


二、網路版本(應適用舊版本Linux,也適用FC3及REL4)

 1. 先建立 server.csr

  # openssl req -new > server.csr

   Generating a 1024 bit RSA private key

   .++++++

   .........................................++++++++

   writing new private key to 'privkey.pem'

   Enter PEM pass phrase: <輸入四碼以上的 password

   Verifying - Enter PEM pass phrase: <再輸入一次四碼以上的 password

   -----

   You are ....................................

   -----

   Country Name (2 letter code) [GB]:
TW <輸入國家簡稱,以下與方法一相同。

   .............................

   Please enter ..................

   A challenge password [ ]:
 <直接按"Enter"

   An optional company name [ ]: 
<直接按"Enter"

   
執行後會產生兩個檔案 server.csr 及 privkey.pem。


 2. 接下來產生加密的 key

  # openssl rsa -in privkey.pem -out server.key

   Enter pass phrase for privkey.pem: <輸入上一個指令中phrase 的 password,必須要與上一個指令中所輸入的 phrase 密碼一樣,輸入後會寫入 server.key 中。

   執行後會產生 server.key
的檔案。


 3. 最後產生 server.crt 的憑證

  # openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365

  執行後會產生 server.crt 的憑證。


 4. 接下來只要將 server.crt 及 server.key 搬移到相關目錄中,然後將 httpd 重新啟動即可生效。


三、由第三方產生憑證

 1. 若要由第三方公信單位授發憑證,則需產生 server.csr 檔案

  # openssl genrsa -out server.key 1024

  # openssl req -new -key server.key -out server.csr

  執行後會產生 server.csr 的檔案,並將 server.csr 寄給第三方公信單位產生 server.crt 憑證即可。

星期六, 6月 09, 2007

Tips and Tricks: Building rpms without being root

Do the following:

mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo 「%home %(echo $HOME)」 >> $HOME/.rpmmacros

echo 「%_topdir %{home}/rpmbuild」 >> $HOME/.rpmmacros

Now when you install a src.rpm it will go to $HOME/rpmbuild/ instead of /usr/src/redhat/.

星期四, 3月 15, 2007

多鍵式滑鼠

※參考資料
http://wshlab2.ee.kuas.edu.tw/personal/yurenju/archives/000727.php
http://fanqiang.chinaunix.net/system/linux/2005-03-24/3019.shtml

※多鍵式滑鼠
筆者的滑鼠比一般的滑鼠多了兩個鍵,在windows下那兩個鍵是當成
瀏覽網頁時的上一頁及下一頁,但在linux下就不是了
經過一番研究終於讓這功能重現成功了

※xev
xev是個小程式,請在終端機下使用,如圖

在小框內的動作都會顯示在終端機中,包含按鍵
可以看見每個按鍵的值(包含鍵盤)
在預設下,原來的滑鼠其他鍵的值和滾輪是重覆的(滾輪算是兩個鍵)
所以要修改按鍵的數量

※第一步
修改XF86Config-4或xorg.conf的mouse部份。
~~~~~~~~
Section 「InputDevice」
Identifier 「Mouse1〞
Driver 「mouse」
Option 「Protocol」 「ExplorerPS/2〞
Option 「Device」 「/dev/psaux」
Option 「ZAxisMapping」 「6 7〞
EndSection
~~~~~~~~
此法會讓按鍵數變為7個,而左右鍵會變成滾輪,
原來的滾輪會變成上一頁及下一頁,
於是要進行下一步,修改按鍵的配置順序

※第二步
執行xmodmap
xmodmap -e 「pointer = 1 2 3 6 7 4 5〞
它就會將滑鼠的順序設定好
不過xmodmap必須是在進入xwindow後設定,不能放在rc*中
筆者建議放在Desktop/Autostart中
這樣就會在進入xwindow後啟動

星期三, 3月 14, 2007

RPM Tips English Version

RPM Tips

Traditional Chinese Version

Be forewarned, I am not going to write anything on how to create an RPM spec file. There are enough howtos in the Internet on this regard. Writing an RPM spec file can be very simple, but it can also be very complicated, depending on the program you want to write an RPM spec file for. No matter what, this requires quite a lot of time.

When I do write an RPM spec file, my main references are:

http://www.rpm.org/max-rpm/
http://www.rpm.org/RPM-HOWTO/

I never ever want to install a program from source. It is not because it is difficult. On the contrary, it is quite easy to install from source. It is just that I do not want to mess up my system. When I update a program installed from source, quite often enough, there are old files around not deleted. And sometimes, this may cause some problems. If I want to uninstall this program, where do you go to make sure that all the installed files are really removed?

If at all possible, I would rather install an RPM. RPM updates and uninstalls programs very cleanly.

So, what I want to talk about is when you only have a source program available, are there ways to convert it to an RPM package?

If I need a particular program, I would first go to the installation CD to check if this program is already available. If not, I would then go to freshmeat, to sourceforge.net or maybe google.

If there is no RPM package available, I would search rpmfind.

But, if I am unable to find an RPM package of the program, what to do then? The following discussion might solve the problem, i.e., building the RPM package is possible after all.

But before you can build or rebuild an RPM, you need to install the rpm-build package:

rpm -Uvh rpm-build-4.3.2-21.i386.rpm

Note: I am using Fedora Core 3, so I will be using RPM packages available in this distribution.

It is always recommended to build/rebuild an RPM package as a regular, not root, user. You also need to create the RPM build directories. Now login as a regular user and do the following:

mkdir rpmbuild
mkdir rpmbuild/BUILD
mkdir rpmbuild/RPMS
mkdir rpmbuild/RPMS/athlon
mkdir rpmbuild/RPMS/i386
mkdir rpmbuild/RPMS/i486
mkdir rpmbuild/RPMS/i586
mkdir rpmbuild/RPMS/i686
mkdir rpmbuild/RPMS/noarch
mkdir rpmbuild/SOURCES
mkdir rpmbuild/SPECS
mkdir rpmbuild/SRPMS

Now create the file .rpmmacros (look closely it is a dot file, i.e., the filename is preceded by a period) and the content is:

%_topdir /home/username/rpmbuild

Replace username with the actual user account name.

We are ready ready to build an RPM package.

Source RPM

If you want to install ClamAV anti-virus program, you may download the RPM package from crash-hat. It also provides a source rpm (.src.rpm). I prefer to download the source RPM and then rebuild it against my own server.

To do this, just execute the following command:

rpmbuild --rebuild clamav-0.83-1.src.rpm

After rebuilding the source RPM, you have the RPM files in:

rpmbuild/RPMS/i386/clamav-0.83-1.i386.rpm
rpmbuild/RPMS/i386/clamav-milter-0.83-1.i386.rpm
rpmbuild/RPMS/i386/clamav-devel-0.83-1.i386.rpm

Source Tarball with spec file

If, for example, you want to install SpamAssassin. No RPM package is made available. But what is provided contains the RPM spec file (Mail-SpamAssassin-3.0.2.tar.bz2 and Mail-SpamAssassin-3.0.2.tar.gz).

How do you know if an RPM spec file is included in the source tarball? Taking the two files above as an example, execute the following:

tar fzt Mail-SpamAssassin-3.0.2.tar.gz | grep .spec
tar fjt Mail-SpamAssassin-3.0.2.tar.bz2 | grep .spec

Build the RPM packaged this way:

rpmbuild -tb Mail-SpamAssassin-3.0.2.tar.gz
rpmbuild -tb --define "srcext .bz2" Mail-SpamAssassin-3.0.2.tar.bz2

Source tarball without spec file

I mentioned above that I do not want to install from source. So, what to do? Install CheckInstall and let it make an RPM for you.

The procedure for creating an RPM program is as follows:

tar xvfz program_name-version.tar.gz
cd program_name-version
./configure
make

Now instead of executing:

make install

Execute instead:

checkinstall

Perl Modules

How I hate perl! It is very difficult to manage the perl module packages installed in your system. I absolutely refuse to install perl modules from source. It has been a cause of many problems. If you upgrade to a newer version from source, you might find that your application does not work anymore.

But I need a particular perl module package. What can I do? For example, we are using OpenWebMail in our school to access our emails. It requires a perl module Text-Iconv. As I do not want to install from source, I searched the Internet and found an RPM perl-Text-Iconv package. I downloaded and installed it. But OpenWebMail was still complaining that it could not find Text-Iconv. After a few days of scratching my head, I found out that the RPM perl-Text-Iconv that I downloaded and installed was compiled against a different version of perl. So it does not work. Now what to do?

I finally found the program cpan2rpm that solved my problem. Download and install it. And then just execute:

cpan2rpm Text-Iconv-1.4.tar.gz

And it will create the following files:

rpmbuild/RPMS/i386/perl-Text-Iconv-1.4-1.i386.rpm
rpmbuild/SRPMS/perl-Text-Iconv-1.4.1.src.rpm

Now you can install the RPM package without any problem.

Fr. Visminlu Vicente L. Chua, S.J.
2005/03/21

RPM Tips

RPM Tips

English Version

首先,我不會寫有關如何撰寫 RPM 的 spec 檔案。有關這個題目在網際網路已經有很多的 howto。撰寫一個 RPM spec 檔案可能很簡單或可能很複雜。這要看你要撰寫 RPM spec 檔案的程式本身。無論如何,這會需要蠻 多時間。

如果我要撰寫一個 RPM spec 檔案的話,我主要參考資料如下:

http://www.rpm.org/max-rpm/
http://www.rpm.org/RPM-HOWTO/

我從來不願意從來源程式安裝。不是因為難。相反的,蠻容易。只是,我不願意搞亂我的系統。如果我將從source安裝 的程式更新,常常會發生的問題是還有一些檔案沒有被刪除的乾淨。有時候這種情況會產生問題。如果要刪除這個程式, 你怎麼保證所有被安裝的檔案都被刪除?

盡可能,我寧願用 RPM 來安裝。用 RPM 來更新和刪除,RPM 做的很乾淨。

所以,我在這邊想談的是:如果你只有source程式,是否有辦法將來源程式轉換成 RPM 包裝?

如果我需要一個特定的程式,我會先到安裝 CD 找這程式。找不到的話,我會到 freshmeat,然後到 sourceforge.net 或者 google去找。

如果找不到 RPM 包裝,我會去找 rpmfind.

問題是:如果還是找不到這程式的 RPM 包裝呢?該怎麼辦才好?以下討論可能會解決這個問題,就是建 RPM 包裝終究是可能的。

你要建或重建 RPM 之前,你必須先安裝 rpm-build 包裝:

rpm -Uvh rpm-build-4.3.2-21.i386.rpm


要建或重建 RPM 的話,專家建議以一般使用者﹝不是 root﹞的身分來做這個工作。但做這個工作之前, 你必須建所謂的 RPM build directories ﹝建 RPM 所需要的子目錄﹞。現在以一般使用者身分登入, 然後建以下子目錄:

mkdir rpmbuild
mkdir rpmbuild/BUILD
mkdir rpmbuild/RPMS
mkdir rpmbuild/RPMS/athlon
mkdir rpmbuild/RPMS/i386
mkdir rpmbuild/RPMS/i486
mkdir rpmbuild/RPMS/i586
mkdir rpmbuild/RPMS/i686
mkdir rpmbuild/RPMS/noarch
mkdir rpmbuild/SOURCES
mkdir rpmbuild/SPECS
mkdir rpmbuild/SRPMS

現在建一個檔案,檔名為 .rpmmacros ﹝請注意這是所謂的 dot file,就是檔案名稱第一個字元是一個句點﹞,內容為:

%_topdir /home/username/rpmbuild

username 應該改為真正一個使用者的帳號名稱。

我們現在已經就緒建 RPM 包裝了。

Source RPM

如果你想安裝 ClamAV 防毒程式,從 crash-hat 你可以下載 RPM 包裝。 這個地方也提供 source rpm (.src.rpm)。我自己喜歡下載 source RPM 然後重建一個 RPM。這樣的做法是 完全針對我的系統來編譯。

重建就執行以下指令:

rpmbuild --rebuild clamav-0.83-1.src.rpm

重建 source RPM 之後,會建三個檔案如下:

rpmbuild/RPMS/i386/clamav-0.83-1.i386.rpm
rpmbuild/RPMS/i386/clamav-milter-0.83-1.i386.rpm
rpmbuild/RPMS/i386/clamav-devel-0.83-1.i386.rpm

Source Tarball with spec file

假如你想安裝 SpamAssassin。 在這網頁沒有提供 RPM 包裝。但是所提供的 source tarball 已包含了 RPM spec 檔﹝Mail-SpamAssassin-3.0.2.tar.bz2 和 Mail-SpamAssassin-3.0.2.tar.gz﹞。

你怎麼知道在 source tarball 裡有 RPM spec 檔?拿上段兩個檔案做例子,執行以下指令就會知道的:

tar fzt Mail-SpamAssassin-3.0.2.tar.gz | grep .spec
tar fjt Mail-SpamAssassin-3.0.2.tar.bz2 | grep .spec

用這種方式建 RPM 包裝:

rpmbuild -tb Mail-SpamAssassin-3.0.2.tar.gz
rpmbuild -tb --define "srcext .bz2" Mail-SpamAssassin-3.0.2.tar.bz2

Source tarball without spec file

我上面已提過,我不喜歡從source程式安裝。但是來源程式沒有 spec 檔案,怎麼辦?請你安裝 CheckInstall 讓它幫你建 RPM。

建 RPM 包裝的程序如下:

tar xvfz program_name-version.tar.gz
cd program_name-version
./configure
make

下一部本來要下:

make install

但是,這一次應該下:

checkinstall

星期四, 3月 01, 2007

a motto

Rocky對兒子的一段對白:
生命並非永遠充滿光明,這個世界殘酷而陰險,隨時會把你擊得永不翻身。如果把受到的打擊通通歸罪於別人身上,那是懦夫的行為。因為最重要不是你出拳有多重,而是你能夠捱得了多重的拳。你只有在重拳的攻擊全力支撐並奮戰不懈,你才可能贏。

The world ain't all sunshine and rainbows. It is a very mean and nasty place and it will beat you to your knees and keep you there permanently if you let it. You, me, or nobody is gonna hit as hard as life. But it ain't how hard you hit; it's about how hard you can get hit, and keep moving forward. How much you can take, and keep moving forward. That's how winning is done.


告訴我,有誰不是激情的奴隸?
--哈姆雷特

傑斐遜
(Thomas Jefferson)︰無知和自由兼具者,過去沒有,將來也不可能有

If a Nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be... if we are to guard against ignorance and remain free, it is the responsibility of every American to be informed."

-- Thomas Jefferson


“Knowledge and human power are synonymous,” once said the great philosopher
Francis Bacon.



沒有音樂,人生將會是一場錯誤~~~~尼采



蘇格拉底名言︰“智慧意味著自知無知。”除了無知,還有什么能促使我們進行探索?



小品賞析
距離 泰戈爾

世界最遙遠的距離不是生與死,
而是 我就站在你面前 你卻不知道我愛你
世界上最遙遠的距離不是我就站在你面前 
你卻不知道我愛你 而是 明明知道彼此相愛 卻不能在一起
世界上最遙遠的距離不是明明知道彼此相愛 卻不能在一起
而是 明明無法抵擋這一股氣息 卻還得裝作毫不在意
世界上最遙遠的距離不是明明無法抵擋這一股氣息 卻還得裝作毫不在意
而是 用自己冷漠的心 對愛你的人所築起的一道鴻溝……

星期日, 12月 17, 2006

Linux server memory check

Posted by nixcraft in Linux, Troubleshooting, Sys admin, Tips

If your server crashes regularly it could be a buggy kernel, a driver, power supply or any other hardware part. Memory (RAM) is one of the critical server parts. Bad memory can cause various problems such as random Linux server restart or program segfaults.

Generally, I recommend using memtester command. It is an effective userspace tester for stress-testing the memory subsystem. It is very effective at finding intermittent and non deterministic faults under Linux.

Recently Rahul shah email me another interesting method for testing memory. His idea is based upon md5 checksum and dd command.

First find out memory site using free command.
$ free
Output:

 total       used       free     shared    buffers     cached
Mem: 768304 555616 212688 0 22012 270996
-/+ buffers/cache: 262608 505696
Swap: 979956 0 979956

In above example my server has 768304K memory. Now use dd command as follows:
$ dd if=/dev/urandom bs=768304 of=/tmp/memtest count=1050
$ md5sum /tmp/memtest; md5sum /tmp/memtest; md5sum /tmp/memtest

According to him if the checksums do not match, you have faulty memory guaranteed. Read dd command man page to understand all options. dd will create /tmp/memtest file. It will cache data in memory by filling up all memory during read operation. Using md5sum command you are reading same data from memory (as it was cached).

Look like a good hack to me. However I still recommend using memtester userland program. Another option is to use memtest86 program ISO. Download ISO, burn the same on a CD, reboot your system with it test it (it may take more time). From project home page:
Memtest86 is thorough, stand alone memory test for x86 architecture computers. BIOS based memory tests are a quick, cursory check and often miss many of the failures that are detected by Memtest86.

星期日, 11月 12, 2006

Howto: Configure Linux Virtual Local Area Network (VLAN)

Howto: Configure Linux Virtual Local Area Network (VLAN)

Posted by LinuxTitli in Linux, Networking

VLAN is an acronym for Virtual Local Area Network. Several VLANs can co-exist on a single physical switch, which are configured via software (Linux commands and configuration files) and not through hardware interface (you still need to configure switch).

Hubs or switch connects all nodes in a LAN and node can communicate without a router. For example, all nodes in LAN A can communicate with each other without the need for a router. If a node from LAN A wants to communicate with LAN B node, you need to use a router. Therefore, each LAN (A, B, C and so on) are separated using a router.

VLAN as a name suggest combine multiple LANs at once. But what are the advantages of VLAN?

  • Performance
  • Ease of management
  • Security
  • Trunks
  • You don't have to configure any hardware device, when physically moving server computer to another location etc.

VLAN concepts and fundamental discussion is beyond the scope of this article. I am reading following textbooks. I found these textbooks extremely useful and highly recommended:

  • Cisco CNNA ICND books (part I and II)
  • Andrew S. Tanenbaum, Computer Networks book

Configuration problems

I am lucky enough to get couple of hints from our internal wiki docs :D .

  • Not all network drivers support VLAN. You may need to patch your driver.
  • MTU may be another problem. It works by tagging each frame i.e. an Ethernet header extension that enlarges the header from 14 to 18 bytes. The VLAN tag contains the VLAN ID and priority. See Linux VLAN site for patches and other information.
  • Do not use VLAN ID 1 as it may be used for admin purpose.

Ok now I need to configure VLAN for RHEL. (note due to some other trouble tickets I was not able to configure VLAN today, but tomorrow afternoon after lunch break ill get my hands on dirty with Linux VLAN ;) )

VLAN Configuration

My VLAN ID is 5. So I need to copy file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.5

# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.5

So I have one network card (eth0) and it needs to use tagged network traffic for VLAN ID 5.

Above files will configure Linux system to have:

  • eth0 - Your regular network interface
  • eth0.5 - Your virtual interface that use untagged frames

Do not modify /etc/sysconfig/network-scripts/ifcfg-eth0 file. Now open file /etc/sysconfig/network-scripts/ifcfg-eth0.5 using vi text editor:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0.5

Find DEVICE=ifcfg-eth0line and replace with:

DEVICE=ifcfg-eth0.5

Append line:

VLAN=yes

Also make sure you assign correct IP address using DHCP or static IP. Save the file. Remove gateway entry from all other network config files. Only add gateway to /etc/sysconfig/network file.

Restart network:

# /etc/init.d/network restart

Please note that if you need to configure for VLAN ID 2 then copy the copy file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.2 and do the above procedure again.

Using vconfig command

Above method is perfect and works with Red hat enterprise Linux w/o problem. However you will notice that there is a command called vconfig. The vconfig program allows you to create and remove vlan-devices on a vlan enabled kernel. Vlan-devices are virtual ethernet devices which represents the virtual lans on the physical lan.

Please note that this is yet another method of configuring VLAN. If you are happy with above method no need to follow following method.

Add VLAN ID 5 with follwing command for eth0:

# vconfig add eth0 5

add command creates a vlan-device on eth0 which result into eth0.5 interface. You can use normal ifconfig command to see device information:

# ifconfig eth0.5

Use ifconfig to assigne IP address:

# ifconfig eth0.5 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up

Get detailed information about VLAN interface:

# cat /proc/net/vlan/eth0.5

If you wish to delete VLAN interface delete command:

# ifconfig eth0.5 down
# vconfig rem eth0.5

If you enjoyed this article, grab our feed OR subscribe to the nixCraft email newsletter or use Technorati to track all updates.

NFSv4 delivers seamless network access


developerWorks

Level: Introductory

Frank Pohlmann (frank@linuxuser.co.uk), Linux user and developer, Freelance
Kenneth Hess (kenneth.hess@gmail.com), Linux user, advocate, and author, Freelance

12 Sep 2006

Network File System (NFS) has been part of the world of free operating systems and proprietary UNIX® flavors since the mid-1980s. But not all administrators know how it works or why there have been new releases. A knowledge of NFS is important simply because the system is vital for seamless access across UNIX networks. Learn how the latest release of NFS, NFSv4, has addressed many criticisms, particularly with regard to security problems, that became apparent in versions 2 and 3.

We take file systems for granted. We work on computers that give us access to printers, cameras, databases, remote sensors, telescopes, compilers, and mobile phones. These devices share few characteristics -- indeed, many of them became a reality only after the Internet became universal (for example, cameras and mobile phones that combine the functions of small computers). However, they all need file systems of some type to store and order data securely.

Typically, we don't really ask how the data, the applications consuming it, and the interfaces presenting the data to us are stored on the computers themselves. Most users would (not unjustifiably) regard a file system as the wall separating them from the bare metal storing bits and bytes. And the protocol stacks connecting file systems usually remain black boxes to most users and, indeed, programmers. Ultimately, however, internetworking all these devices amounts to enabling communication between file systems.

Networking file systems and other holy pursuits

In many ways, communication is little more than a long-distance copying of information. Network protocols were not the only means by which universal communications became possible. After all, every computer system must translate datagrams into something the operating system at the other end understands. TCP is a highly effective transmission protocol, but it's not optimized to facilitate fast access to files or to enable remote control of application software.

Distributed vs. networked computations

Traditional networking protocols don't have much to contribute to the way in which computations are distributed across computers and, indeed, networks. Only foolish programmers would rely on transmission protocols and fiber-optic cables to enable parallel computations. Instead, we typically rely on a serial model, in which link-level protocols take over after connections are initiated and have performed a rather complex greeting between network cards. Parallel computations and distributed file systems are no longer aware of IP or Ethernet. Today, we can safely disregard them as far as performance is concerned. However, security problems are a different matter.

One piece of the puzzle is the way file access is organized across a computer system. Now, it's irrelevant to the accessing system whether the accessed files are available on one or on several presumably rationally distributed computers. File system semantics and file system data structures are two very different topics these days. File system semantics on a Plan 9 installation or on an Andrew File System (AFS)-style distributed file system hide the way in which files are organized or how the file system maps to hardware and networks. NFS does not necessarily hide the way in which files and directories are stored on remote file systems, but it doesn't expose the actual hardware storing the file systems, directories, and files, either.



Back to top


NFS: A solution to a UNIX problem

Distributed file system access, therefore, needs rather more than a couple of commands enabling users to mount a directory on a computer networked to theirs. Sun Microsystems faced up to this challenge a number of years ago when it started propagating something called Remote Procedure Calls (RPCs) and NFS.

The basic problem that Sun was trying to solve was how to connect several UNIX computers to form a seamless distributed working environment without having to rewrite UNIX file system semantics and without having to add too many data structures specific to distributed file systems. Naturally, it was impossible for a network of UNIX workstations to appear as one large system: the integrity of each system had to be preserved while still enabling users to work on a directory on a different computer without experiencing unacceptable delays or limitations in their workflow.

To be sure, NFS does more than facilitate access to text files. You can distribute "runnable" applications through NFS, as well. Security procedures serve to shore up the network against the malicious takeovers of executables. But how exactly does this happen?

NFS is RPC

NFS is traditionally defined as an RPC application requiring TCP for the NFS server and either TCP or another network congestion-avoiding protocol for the NFS client. The Internet Engineering Task Force (IETF) has published the Request for Comments (RFC) for RPCs in RFC 1832. The other standard vital to the functioning of an NFS implementation describes data formats that NFS uses; it has been published in RFC 1831 as the "External Data Representation" (XDR) document.

Other RFCs are relevant to security and the encryption algorithms used to exchange authentication information during NFS sessions, but we focus on the basic mechanisms first. One protocol that concerns us is the Mount protocol, which is described in Appendix 1 of RFC 1813.

This RFC tells you which protocols make NFS work, but it doesn't tell you how NFS works today. You've already learned something important by knowing that NFS protocols have been documented as IETF standards. While the latest NFS release was stuck at version 3, RPCs had not progressed beyond the informational RFC stage and thus were perceived as an interest largely confined to Sun Microsystems' admittedly huge engineering task force and proprietary UNIX variety. Sun NFS has been around in several versions since 1985 and, therefore, predates most current file system flavors by several years. Sun Microsystems turned over control of NFS to the IETF in 1998, and most NSF version 4 (NFSv4) activity occurred under the latter's aegis.

So, if you're dealing with RPC and NFS today, you're dealing with a version that reflects the concerns of companies and interest groups outside Sun's influence. Many Sun engineers, however, retain a deep interest in NFS development



Back to top


NFS version 3

NFS in its version 3 avatar (NFSv3) was not stateful: NFSv4 is. This fundamental statement is unlikely to raise any hackles today, although the TCP/IP world on which NFS builds has mostly been stateless -- a fact that has helped traffic analysis and security software companies do quite well for themselves.

NFSv3 had to rely on several subsidiary protocols to seamlessly mount directories on remote computers without becoming too dependent on underlying file system mechanisms. NFS has not always been successful in this attempt. To give you a better example, the Mount protocol called the initial file handle, while the Network Lock Manager protocol addressed file locking. Both operations required state, which NFSv3 did not provide. Therefore, you have complex interactions between protocol layers that do not reflect similar data-flow mechanisms. Now, if you add the fact that file and directory creation in Microsoft® Windows® works very differently from UNIX, matters become rather complicated.

NFSv3 had to use several ports to accommodate some of its subsidiary protocols, and you get a rather complex picture of ports and protocol layers and all their attendant security concerns. Today, this model of operation has been abandoned, and all operations that subsidiary protocol implementations previously executed from individual ports are now handled by NFSv4 from a single, well-known port.

NFSv3 was also ready for Unicode-enabled file system operation -- an advantage that until the late 1990s had to remain fairly theoretical. In all, it mapped well to UNIX file system semantics and motivated competing distributed file system implementations like AFS and Samba. Not surprisingly, Windows support was poor, but Samba file servers have since addressed file sharing between UNIX and Windows systems.



Back to top


NFS version 4

NFSv4 is, as we pointed out, stateful. Several radical changes made this behavior possible. We already mentioned that subsidiary protocols must be called, as user-level processes have been abandoned. Instead, every file-opening operation and quite a few RPC calls are turned into kernel-level file system operations.

All NFS versions defined each unit of work in terms of RPC client and server operations. Each NFSv3 request required a fairly generous number of RPC calls and port-opening calls to yield a result. Version 4 simplifies matters by introducing a so-called compound operation that subsumed a large number of file system object operations. The immediate effect is, of course, that far fewer RPC calls and data have to traverse the network, even though each RPC call carries substantially more data while accomplishing far more. It is estimated that NFSv3 RPC calls required five times the number of client-server interactions that NFSv4 compound RPC procedures demand.

RPC is not really that important anymore and essentially serves as a wrapper around the number of operations encapsulated within the NFSv4 stack. This change also makes the protocol stack far less dependent on the underlying file system semantics. But the changes don't mean that the file system operations of other operating systems were neglected: For example, Windows shares require stateful open calls. Statefulness not only helps traffic analysis but, when included in file system semantics, makes file system operations much more traceable. Stateful open calls enable clients to cache file data and state -- something that would otherwise have to happen on the server. In the real world, where Windows clients are ubiquitous, NFS servers that work seamlessly and transparently with Windows shares are worth the time you'll spend customizing your NFS configuration.



Back to top


Using NFS

NFS setup is generically similar to Samba. On the server side, you define file systems or directories to export, or share; the client side mounts those shared directories. When a remote client mounts an NFS-shared directory, that directory is accessed in the same way as any other local file system. Setting up NFS from the server side is an equally simple process. Minimally, you must create or edit the /etc/exports file and start the NFS daemon. To set up a more secure NFS service, you must also edit /etc/hosts.allow and /etc/hosts.deny. The client side of NFS requires only the mount command. For more information and options, consult the Linux® man pages.

The NFS server

Entries in the /etc/exports file have a straightforward format. To share a file system, edit the /etc/exports file and supply a file system (with options) in the general format:

directory (or file system)   client1 (option1, option2) client2 (option1, option2)

General options

Several general options are available to help you customize your NFS implementation. They include:

  • secure: This option -- the default -- uses available TCP/IP ports below 1024 for NFS connections. Specifying insecure disables this option.
  • rw: This option allows NFS clients read/write access. The default option is read only.
  • async: This option may improve performance, but it can also cause data loss if you restart the NFS server without first performing a clean shutdown of the NFS daemon. The default setting is sync.
  • no_wdelay: This option turns off the write delay. If you set async, NFS ignores this option.
  • nohide: If you mount one directory over another, the old directory is typically hidden or appears empty. To disable this behavior, enable the hide option.
  • no_subtree_check: This option turns off subtree checking, which performs some security checks that you may not want to bypass. The default option is to have subtree checks enabled.
  • no_auth_nlm: This option, also specified as insecure_locks, tells the NFS daemon not to authenticate locking requests. If you're concerned about security, avoid this option. The default option is auth_nlm or secure_locks.
  • mp (mountpoint=path): By explicitly declaring this option, NSF requires that the exported directory be mounted.
  • fsid=num: This option is typically used in NFS failover scenarios. Refer to the NFS documentation if you want to implement NFS failover.

User mapping

Through user mapping in NFS, you can grant pseudo or actual user and group identity to a user working on an NFS volume. The NFS user has the user and group permissions that the mapping allows. Using a generic user and group for NFS volumes provides a layer of security and flexibility without a lot of administrative overhead.

User access is typically "squashed" when using files on an NFS-mounted file system, which means that a user accesses files as an anonymous user who, by default, has read-only permissions to those files. This behavior is especially important for the root user. Cases exist, however, in which you want a user to access files on a remote system as root or some other defined user. NFS allows you to specify a user -- by user identification (UID) number and group identification (GID) number -- to access remote files, and you can disable the normal behavior of squashing.

User mapping options include:

  • root_squash: This option doesn't allow root user access on the mounted NFS volume.
  • no_root_squash: This option allows root user access on the mounted NFS volume.
  • all_squash: This option, which is useful for a publicly accessible NFS volume, squashes all UIDs and GIDs and only uses the anonymous account. The default setting is no_all_squash.
  • anonuid and anongid: These options change the anonymous UIDs and GIDs to specific user and group accounts.

Listing 1 shows examples of /etc/exports entries.


Listing 1. Example /etc/exports entries
 
/opt/files 192.168.0.*
/opt/files 192.168.0.120
/opt/files 192.168.0.125(rw, all_squash, anonuid=210, anongid=100)
/opt/files *(ro, insecure, all_squash)

The first entry exports the /opt/files directory to all hosts in the 192.168.0 network. The next entry exports /opt/files to a single host: 192.168.0.120. The third entry specifies host 192.168.0.125 and grants read/write access to the files with user permissions of user id=210 and group id=100. The final entry is for a "public" directory that has read-only access and allows access only under the anonymous account.

The NFS client

A word of caution

After you have used NFS to mount a remote file system, that system will also be part of any total system backup that you perform on the client system. This behavior can have potentially disastrous results if you don't exclude the newly mounted directories from the backup.

To use NFS as a client, the client computer must be running rpc.statd and portmap. You can run a quick ps -ef to check for these two daemons. If they are running (and they should be), you can mount the server's exported directory with the generic command:

mount server:directory  local mount point

Generally speaking, you must be running under root to mount a file system. From a remote computer, you can use the following command (assume that the NFS server has an IP address of 192.168.0.100):

mount 192.168.0.100:/opt/files  /mnt

Your distribution may require you to specify the file system type when mounting a file system. If so, run the command:

mount -t nfs 192.168.0.100:/opt/files /mnt

The remote directory should mount without issue if you've set up the server side correctly. Now, run the cd command to the /mnt directory, then run the ls command to see the files. To make this mount permanent, you must edit the /etc/fstab file and create an entry similar to the following:

192.168.0.100:/opt/files  /mnt  nfs  rw  0  0

Note: Refer to the fstab man page for more information on /etc/fstab entries.



Back to top


NFS criticisms

Criticism drives improvement

Criticisms leveled at NFS security have been at the root of many improvements in NSFv4. The designers of the new version took positive measures to strengthen the security of NFS client-server interaction. In fact, they decided to include a whole new security model.

To understand the security model, you should familiarize yourself with something called the Generic Security Services application programming interface (GSS-API) version 2, update 1. The GSS-API is fully described in RFC 2743, which, unfortunately, is among the most difficult RFCs to understand.

We know from our experience with NFSv4 that it's not easy to make the network file system operating system independent. But it's even more difficult to make all areas of security operating systems and network protocols independent. We must have both, because NFS must be able to handle a fairly generous number of user operations, and it must do so without much reference to the specifics of network protocol interaction.

Connections between NFS clients and servers are secured through what has been rather superficially called strong RPC security. NFSv4 uses the Open Network Computing Remote Procedure Call (ONCRPC) standard codified in RFC 1831. The security model had to be strengthened, and instead of relying on simple authentication (known as AUTH_SYS), a GSS-API-based security flavor known as RPCSEC_GSS has been defined and implemented as a mandatory part of NFSv4. The most important security mechanisms available under NFSv4 include Kerberos version 5 and LIPKEY.

Given that Kerberos has limitations when used across the Internet, LIPKEY has the pleasant advantage of working like Secure Sockets Layer (SSL), prompting users for their user names and passwords, while avoiding the TCP dependence of SSL -- a dependence that NFSv4 doesn't share. You can set NFS up to negotiate for security flavors if RPCSEC_GSS is not required. Past NFS versions did not have this ability and therefore could not negotiate for the quality of protection, data integrity, the requirement for authentication, or the type of encryption.

NFSv3 had come in for a substantial amount of criticism in the area of security. Given that NFSv3 servers ran on TCP, it was perfectly possible to run NFSv3 networks across the Internet. Unfortunately, it was also necessary to open several ports, which led to several well-publicized security breaches. By making port 2049 mandatory for NFS, it became possible to use NFSv4 across firewalls without having to pay too much attention to what ports other protocols, such as the Mount protocol, were listening to. Therefore, the elimination of the Mount protocol had multiple positive effects:

  • Mandatory strong authentication mechanisms: NFSv4 makes strong authentication mechanisms mandatory. Kerberos flavors are fairly common, and Lower Infrastructure Public Key Mechanism (LIPKEY) must be supported, as well. NFSv3 never supported much more than UNIX-style standard encryption to authenticate access -- something that led to major security problems in large networks.
  • Mandatory Microsoft Windows NT-style access control list (ACL) schemes: Although NFSv3 allowed for strong encryption for authentication, it did not push Windows NT-style ACL access schemes. Portable Operating System Interface (POSIX)-style ACLs were sometimes implemented but never widely adopted. NFSv4 makes Windows NT-style ACL schemes mandatory.
  • Negotiated authentication styles and mechanisms: NFSv4 makes it possible to negotiate authentication styles and mechanisms. Under NSFv3, it was impossible to do much more than determine manually which encryption styles were used. The system administrator then had to harmonize encryption and security protocols.

Is NFS still without peers?

NFSv4 is replacing NFSv3 on most UNIX and Linux systems. As a network file system, NSFv4 has few competitors. The Common Internet File System (CIFS)/Server Message Block (SMB) could be considered a viable competitor given that it's native to all Windows varieties and (today) to Linux. AFS never made much commercial impact, and it emphasized elements of distributed file systems that made data migration and replication easier.

Production-ready Linux versions of NFS had been around since the kernel reached version 2.2, but one of the more common failings of Linux kernel versions was the fact that Linux adopted NFSv3 fairly late. In fact, it took a long time before Linux fully supported NSFv3. When NSFv4 came along, this lack was addressed quickly, and it wasn't just Solaris, AIX, and FreeBSD that enjoyed full NSFv4 support.

NFS is considered a mature technology today, and it has a fairly big advantage: It's secure and usable, and most users find it convenient to use one secure logon to access a network and its facilities, even when files and applications reside on different systems. Although this might look like a disadvantage compared to distributed file systems, which hide system structures from users, don't forget that many applications use files from different operating systems and, therefore, computers. NFS makes it easy to work on different operating systems without having to worry too much about the file system semantics and their performance characteristics.



Back to top


Resources

Learn

Get products and technologies
  • OpenAFS is the open source version of AFS, another distributed file system.

  • SAMBA can be regarded as a file system and can fulfill some of the roles of NFS.



Back to top


About the authors

Frank Pohlmann

Frank Pohlmann dabbled in the history of Middle Eastern religions before various funding committees decided that research in the history of religious polemics was quite irrelevant to the modern world. He has focused on his hobby -- free software -- ever since. He admits to being the technical editor of the U.K.-based LinuxUser and Developer.


Ken Hess author photo

Ken Hess is a long-time Linux user and enthusiast. He started the Linux User's Group in Tulsa, Oklahoma, in 1996 and writes on a variety of Linux and open source topics. Ken stays busy with his day job, his family, and his art.

星期四, 10月 12, 2006

Bash 提示五則

Bash 提示五則


這是我所見過的 Bash 提示當中非常 Cool 的幾個,使用它們能夠讓你充分地享受到 CLI 的高效,並免除重複輸入的麻煩,從而節省大量地時間。

  1. 清屏

    一般來講,為了清屏,我們通常使用 clear 命令。你有沒有試過它的快捷鍵 Ctrl+L?個人認為使用組合鍵操作更快捷。

  2. 逆向搜索

    有時候我們需要重新執行先前輸入的命令。那麼,在使用快捷鍵 Ctrl+R 後輸入命令,Bash 將為你自動完成。

  3. 命令置換

    誰都避免不了輸入錯誤命令的情況,不要緊,可以使用 ^texttosobstitute^sobstitution 來置換。比如,你輸入了一個 sudo apt-get updkte 的錯誤命令,Bash 當然無法執行它了,這時可以通過輸入 ^updkte^update(或 ^k^a)來糾正錯誤。

  4. 重複上次的操作

    如果你想要重複執行上次的命令,那麼只需輸入 !! 即可。

  5. 重複上次的參數

    如果你想要重複使用上次所用命令的參數,則可以使用 !$。舉個例子,假如你上次執行的命令為 ls -lsh,那麼,現在可以用 ls !$ 來達到同樣的目的。

(Via kratorius::code, thanks!)

星期一, 10月 09, 2006

在 Windows* XP 下全自動安裝說明

在 Windows* XP 下全自動安裝說明

全自動安裝方法適用於 Microsoft* Windows* XP、Windows* 2000 和 Windows* Server 2003。它是用於安裝 RAID 或 AHCI 驅動程式,如 Microsoft 文件《Windows NT 自動化安裝部署指南》中所概述。

若要進行 RAID 或 AHCI 驅動程式的全自動安裝,請執行下列步驟:

  1. 從安裝檔案解壓縮 IAAHCI.INF、IAAHCI.CAT、IASTOR.INF、IASTOR.CAT、IASTOR.SYS 和 TXTSETUP.OEM 檔案。

    若要解壓縮這些檔案,請使用下列指令行選項執行可執行檔 (例如,Intel® 組合儲存管理員的 IATA50_ENU.EXE): -A -A -PC:\<路徑>,如 README.TXT 的進階安裝說明一節中所述。

    系統是否含有 32 位元或 64 位元處理器?
    • 如果系統具有 32 位元處理器,檔案在解壓縮後會位於 Drivers 資料夾中。
    • 如果系統具有 64 位元處理器,檔案在解壓縮後會位於 Drivers64 資料夾中。

  2. 視適用狀況,將下列指令行插入 UNATTEND.TXT 檔案:

    RAID 模式設定的系統:

    注意︰ 使 用 Intel® 82801ER SATA RAID 控製器、Intel® 6300ESB SATA RAID 控製器、Intel® 82801FR SATA RAID 控製器或 Intel® 82801GR/GH SATA RAID 控製器、Intel® 82801GHM SATA RAID 控製器或 Intel® 631xESB/632xESB SATA RAID 控製器的系統,都可採用這個相同的程序。 只要替換引號中的文字即可。

    // 將下列指令行插入 UNATTEND.TXT 檔案中

    [MassStorageDrivers]
    "Intel® 82801R/DO/DH SATA RAID Controller" = OEM

    [OEMBootFiles]
    iaStor.inf
    iaStor.sys
    iaStor.cat
    Txtsetup.oem

    設定為 AHCI 模式的系統:

    注意︰ 使用 Intel® 82801FR SATA AHCI 控製器、Intel® 82801FBM SATA AHCI 控製器、Intel® 82801GR/GH SATA AHCI 控製器、Intel® 82801GBM SATA AHCI 控製器或 Intel® 631xESB/632xESB SATA AHCI 控製器的系統,都可採用這個相同的程序。 只要替換引號中的文字即可。

    // 將下列指令行插入 UNATTEND.TXT 檔案中

    [MassStorageDrivers]
    "Intel® 82801R/DO/DH SATA AHCI Controller" = OEM

    [OEMBootFiles]
    iaAhci.inf
    iaStor.sys
    iaAhci.cat
    Txtsetup.oem

  3. 將 IAAHCI.CAT、IAAHCI.INF、IASTOR.CAT、IASTOR.INF、IASTOR.SYS 和 TXTSETUP.OEM 放入下列資料夾中:

    :\i386\$OEM$\Textmode

作業系統:

Windows* 2000、Windows XP Professional、Windows* XP Home Edition、Windows Server* 2003

適用於:

星期日, 9月 10, 2006

Cisco rommon mode password recovery

CISCO路由器配置手冊
參考:
1、Cisco路由器口令恢復
當Cisco路由器的口令被錯誤修改或忘記時,可以按如下步驟進行操作:
1. 開機時按使進入ROM監控狀態
2. 按o 命令讀取配置寄存器的原始值
> o 一般值為0x2102
3. 作如下設置,使忽略NVRAM引導
>o/r0x**4* Cisco2500系列命令
rommon 1 >confreg 0x**4* Cisco2600、1600系列命令
一般正常值為0x2102
4. 重新啟動路由器
>I
rommon 2 >reset
5. 在「Setup」模式,對所有問題回答No
6. 進入特權模式
Router>enable
7. 下載NVRAM
Router>configure memory
8. 恢復原始配置寄存器值並啟動所有埠
「hostname」#configure terminal
「hostname」(config)#config-register 0x「value」
「hostname」(config)#interface xx
「hostname」(config)#no shutdown
9. 查詢並記錄丟失的口令
「hostname」#show configuration (show startup-config)
10. 修改口令
「hostname」#configure terminal
「hostname」(config)line console 0
「hostname」(config-line)#login
「hostname」(config-line)#password xxxxxxxxx
「hostname」(config-line)#
「hostname」(config-line)#write memory(copy running-config startup-config)


您要用終端機才會方便

我是以2611來做的,不過1600也適用。
以下是我的做法,您可以參考一下,有實做成功喔!
一:先準備一條使用RJ45接頭的連接線,連接Router的Console Port。
二:終端機使用以下設定(不要用Win NT,建議用Win9x)
9600 baud rate
No parity
8 data bits
1 stop bit
No flow control
三:將Router開機,
System Bootstrap, Version 11.3(19)AA, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)
Copyright (c) 1998 by cisco Systems, Inc.
C2600 processor with 32768 Kbytes of main memory
Main memory is configured to 32 bit mode with parity enabled
看到出現此訊息後,趕緊按下Ctrl+Break送出 Break,就會進到ROMMON Mode。
四:在rommon>下輸入confreg
rommon 1 > confreg
回答下列問題
Configuration Summary
enabled are:
load rom after netboot fails
console baud: 9600
boot: image specified by the boot system commands
or default to: cisco2-C2600

do you wish to change the configuration? y/n [n]: y-------回答Y
enable "diagnostic mode"? y/n [n]:
enable "use net in IP bcast address"? y/n [n]:
disable "load rom after netboot fails"? y/n [n]:
enable "use all zero broadcast"? y/n [n]:
enable "break/abort has effect"? y/n [n]:
enable "ignore system config info"? y/n [n]: y-------回答Y
change console baud rate? y/n [n]:
change the boot characteristics? y/n [n]: y-------回答Y
enter to boot:
0 = ROM Monitor
1 = the boot helper image
2-15 = boot system
[2]: 2-----要選2

五:rommon 2 > reset 重新啟動 Router
六:
--- System Configuration Dialog --- Router 會自動進入 Setup 選單

Would you like to enter the initial configuration dialog? [yes/no]:
按 Ctrl-C 中斷 Setup
七:Router 會進入一般模式
Router>enable 進入 Priviledged mode (不需輸入任何密碼)
Router#show startup-config 顯示 NVRAM 裡面的 Startup-Config
(顯示結果省略)
八:將 Startup-Config 載入 DRAM
Router#configure memory
九: 2611#configure terminal----輸入此命令進入設定模式
十:將 enable 的密碼改為 2611
2611(config)#enable secret 2611
十一:將 Running-Config 寫回 NVRAM
2611#copy running-config startup-config
十二:
2611#show version
Cisco Internetwork Operating System Software
(中間結果省略)
Configuration register is 0x2142 目前的 Configuration Register 為 0x2142
十三:
2611#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
2611(config)#config-reg 0x2102 將 Configuration Register 改回來
2611(config)#^Z -----Ctrl+Z
2611#
00:01:54: %SYS-5-CONFIG_I: Configured from console by console
2611# reload 重新開機
全部大功告成。過程雖然有點囉唆,不過卻是一定要做的。
希望上述做法對需要的人有幫助。



2500 Password Recovery

Step 1 : Power on router (Press [Ctrl] + [Break] within 30 sec)
Step 2 : o/r 0x2142 [Enter]
Step 3 : i [Enter]
Then it will show as follow
Step 4 : Would you like to enter initial configuration dialog? [Yes] : No [Enter]
Step 5 : Router> enable [Enter]
Step 6 : router# copy start run [Enter]
Step 7 : router# conf t [Enter]
Step 8 : router(config)# config-register 0x2102 [Enter]
Step 9 : router(config)# enable secret Newpassword [Enter]
Step 10 : router(config)# exit [Enter]
Step 11 : router# copy run start [Enter]
Step 12 : router# reload [Enter]

1600 (2600;3600)Password Recovery

Step 1 : Power on router (Press [Ctrl] + [Break] within 30 sec)
Then it will show as follow
Step 2 : rommon> confreg [Enter]
Step 3 : “Do you wish to change configuration[y/n]?” Type y
Step 4 : Type n to all of the question that appear until you reach the
“ignore system config info[y/n]” , type y
Step 5 : Type n to all of the question that appear until you reach the
“change boot characteristics[y/n]” , type y
Step 6 : “enter to boot “ type 2[Enter]
Step 7 : “Do you wish to chane configuration [y/n]” type n
Step 8 : reset [Enter]
Step 9 : Then do the same thing as Step 5 to 12 in 2500 password recovery