顯示具有 UNIX 標籤的文章。 顯示所有文章
顯示具有 UNIX 標籤的文章。 顯示所有文章

2010年10月6日 星期三

Kuro Box 備忘

之前更新IP 分享器之後,發現SSH 登不進去,一直沒去理他。
今天忽然想到,所以就想辦法處理一下。

結果忘記讓Kuro Box 回到EM Mode 的方法了...拆下機器才想到後面有個設定初始化(INIT)的紅色按鈕...害我還大費周章將機器由客廳移到我的書桌...

進了系統才發現忘記改 /etc/hosts.allow 真是豬頭....

再來備忘一下吧...

編輯 /etc/hosts.allow 檔:
在預設的情況下, Kuro-Box 只允許 192.168.0.0/255.255.255.0 及 127.0.0.1 的 IP 存取由 inetd所管理的服務 (例如 telnet)。因此, 若你要設給 Kuro-Box 使用的 IP 不在這個範圍 (例如你要設定真實的 IP), 重開機之後將會無法 telnet 進去, 因為被擋掉了。
# vi /mnt/etc/hosts.allow

ALL : 192.168.0.0/255.255.255.0
ALL : 127.0.0.1
ALL : .hinet.net ← 允許所有 Hi-Net 的 IP 均可連線

系統備份
1. 設定進入 EM 模式,重開機
※debian 2.4 的核心
#echo -n "NGNG" > /dev/fl3
#reboot

※debian 2.6 的核心
# echo -n "NGNG" > /dev/mtdblock2
# reboot

2. EM 模式下 root 登錄
root/kuroadmin

3. 掛載分割區
# mount /dev/hda1 /mnt
# mount /dev/hda3 /mnt2

4. 備份系統
# cd /mnt
# tar cvf /mnt2/backup.tar .
# write_ok
# reboot

5. 還原系統
# cd /mnt
# tar xvf /mnt2/backup.tar
# write_ok
# reboot


2009年6月4日 星期四

KuroBox/HG kernel升級為2.6.25.1的問題

有網友反應重開機後,diag 閃六下就掛了...

很久之前我也有類似的狀況,diag 閃六下後重開Kernel 會回到2.4的版本。
不過我按照上面的順序重裝是沒有這個問題的,所以我猜是我之前抓的source有問題...

下面這個連結可以去看一下,也許有幫助...
主要是說 kernel and libc6 在Debian Lenny 的版本有問題吧~
http://forum.kurobox.nas-central.org/viewtopic.php?p=8722&sid=3c2aa9a3e603f2aea9fc7f7a1d815821

2009年1月5日 星期一

把KuroBox/HG 升級到 Debian etch版本(kernel升級為2.6.25.1)


由於之前的KuroBox/HG是跑在kernel 2.4的kernel,並且有許多package在升級的時候都有一堆奇怪的Error。所以重新安裝KuroBox,並且升級到2008五月由genbako release的kernel 2.6.25.1。沒想到同事Max也遇到一樣的問題,所以整理一下之前的筆記~提供參考。

1. 設定進入 EM 模式,重開機
※debian 2.4 的核心
#echo -n "NGNG" > /dev/fl3
#reboot

※debian 2.6 的核心
# echo -n "NGNG" > /dev/mtdblock2
# reboot


2. 準備相關檔案

請由http://www.genbako.com/ 下載下面這些已經做好給KuroBox用的檔案

debian-sarge-2.6.17.3-kuroHG-20060702.tgz
kernelimage-2.6.25.1-kuroHG.tgz
modules-2.6.25.1-kuroHG.tgz

3. 安裝 Debian sarge
用telnet 進入EM Mode下的KuroBox,用root/kuroadmin登入

如果是全新的HD,要做硬碟分割
# /sbin/mfdisk -e /dev/hda
# sh /sbin/mkfilesystem.sh

已經分割好了之後,將之前的OS所在的分割區清空(在這個分割區的資料會全部不見喔)
# mke2fs -j /dev/hda1

掛載分割區
# mount /dev/hda1 /mnt
# mount /dev/hda3 /mnt2

用FTP指令將下列檔案傳到 /mnt2/source 的目錄下

debian-sarge-2.6.17.3-kuroHG-20060702.tgz
kernelimage-2.6.25.1-kuroHG.tgz
modules-2.6.25.1-kuroHG.tgz


傳完之後解壓
# cd /mnt
# tar zxvf /mnt2/source/debian-sarge-2.6.17.3-kuroHG-20060702.tgz

解壓之後修改相關檔案

/mnt/etc/hostname
/mnt/etc/hosts
/mnt/etc/resolv.conf
/mnt/etc/hosts.allow
/mnt/etc/network/interfaces

改完之後,進入正常模式重新啟動

# /usr/bin/write_ok
argv: /usr/bin/write_ok
# reboot


正常模式telnet登入帳號
先以tmp-kun/tmp-kun登入後在切換為root/root
# su - root

4. 升級kernel and modules

將kernel升級到2.6.25.1之後重開機
# cd /boot
# tar zxvf /mnt/source/kernelimage-2.6.25.1-kuroHG.tgz
# reboot

重開機後,更新modules
# cd /lib/modules
# tar zxvf /mnt/source/modules-2.6.25.1-kuroHG.tgz
# depmod -a

5. 線上更新 Debian sarge

#vi /etc/apt/sources.list
deb http://security.debian.org/ stable/updates main contrib non-free
deb ftp://opensource.nchc.org.tw/debian/ stable main contrib non-free
deb ftp://debian.linux.org.tw/debian/ stable main contrib non-free
deb-src ftp://opensource.nchc.org.tw/debian/ stable main contrib non-free
deb-src ftp://debian.linux.org.tw/debian/ stable main contrib non-free

# apt-get update
# apt-get upgrade

6. 將Debian 由 sarge 升級到 etch
#vi /etc/apt/sources.list
deb http://security.debian.org/ etch/updates main
deb ftp://opensource.nchc.org.tw/debian/ etch main
deb ftp://debian.linux.org.tw/debian/ etch main
deb-src ftp://opensource.nchc.org.tw/debian/ etch main
deb-src ftp://debian.linux.org.tw/debian/ etch main

# apt-get update
# apt-get -u dist-upgrade
#reboot


7. 其他
變更root的密碼
# passwd

新增使用者
# adduser user_name

將內建的tmp-kun使用者移除
# deluser tmp-kun
# rm -R /home/tmp-kun

線上系統升級
# apt-get update
# aptitude update
# aptitude upgrade

8. 參考資料
http://www.dyg.jp/category/kurobox/index.asp
http://blog.goo.ne.jp/g_armani/e/89aba8514fa6ad16bf5272100d3a5c09

2008年10月19日 星期日

修改SSH的設定

修改SSH的設定
vi /etc/ssh/sshd_config
改完之後記得重啟 SSH Daemons
/lib/svc/method/sshd restart

修改 Solaris 的IP

/etc/hostname.eth0 網卡eth0的IP位址
/etc/hosts 網路中hostname的IP位址的對應表
/etc/netmasks 設置網路號及網路遮罩
/etc/nsswitch.conf 名稱解析的方法及順序
/etc/resolv.conf DNS Server的地址及名稱
/etc/defaultrouter 設置閘道位址
/etc/nodename 設hostname

改完可以順道Check 這兩個檔案
/etc/inet/ipnodes (在 10 這個等於 /etc/hosts)
/etc/inet/netmask (在 10 這個等於 /etc/netmask)


一般情況下,如果暫時要改為192.168.1.100 的IP 可以用ifconfig的語法

ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up

vi /etc/hosts
192.168.1.100 myhostname

vi /etc/netmasks
192.168.1.100 255.255.255.0

2008年10月1日 星期三

SSH or SCP不需密碼的方法

假設在A Server上不需密碼就能使用 SSH or SCP連線到主機B的話
B Server IP: 192.168.44.131 使用者名稱:arthur
首先登入A Server,輸入下列指令
# ssh-keygen -t rsa (連續按Enter 三次,會產生公鑰id_rsa.pub 和 私鑰id_rsa)
# ssh Arthur@192.168.44.131 "mkdir .ssh;chmod 0700 .ssh" (需要輸入B Server 該User的密碼)
# scp ~/.ssh/id_rsa.pub arthur@192.168.44.131:.ssh/public.key (需要輸入B Server 該User的密碼)
# ssh arthur@192.168.44.131 "touch ~/.ssh/authorized_keys2;chmod 600 ~/.ssh/authorized_keys2;cat ~/.ssh/public.key >> ~/.ssh/authorized_keys2" (需要輸入B Server 該User的密碼)

接下來應該就不需密碼,就能連線到B Server
# ssh arthur@192.168.44.131 (Bingo! 不需要輸入密碼了喔!)

2008年9月30日 星期二

How to diagnose web connection with Telnet on UNIX

Problem:
My application need to send XML Soap message to the third-party application. How can we make sure the connection is good?

Solution:
In general, we can use web browser to test web connection on PC, but when our product running on UNIX, we can use Telnet to test the web connection.

For example, the URL of XML Soap server is http://192.168.1.99/PMS_Webservice/XMLSoapEventServices.asmx
1. Verify the connection.
Please key in the command:
telnet 192.168.1.99 80
IF you see this message, the connection is fine.
Connected to 192.168.1.99.
Escape character is '^]'.
IF you see this message, the connection is not work. Please check the IP or Port
Trying 192.168.1.99...
telnet: Unable to connect to remote host: Connection refused

2. Verify the web page of XML Soap services.
Please key in the GET command:
GET /PMS_Webservice/XMLSoapEventServices.asmx
IF you see this message, the web page is ok.
HTTP/1.1 200 OK
IF you see this message, the web page is not found. (Service not online)
HTTP/1.1 404 Object Not Found

Example:


themcs001 /usr2/class> telnet 192.168.1.99 80
Trying 192.168.1.99...
Connected to 192.168.1.99.
Escape character is '^]'.
GET /PMS_Webservice/XMLSoapEventServices.asmx
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 17 Sep 2008 03:13:42 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/html; charset=utf-8
Content-Length: 3340




Connection to 192.168.1.99 closed by foreign host.




themcs001 /usr2/class> telnet 192.168.1.99 80
Trying 192.168.1.99...
Connected to 192.168.1.99.
Escape character is '^]'.
GET /PMS_Webservice/XMLSoapEventServices.php
HTTP/1.1 404 Object Not Found
Server: Microsoft-IIS/5.1
Date: Wed, 17 Sep 2008 03:19:27 GMT
Content-Length: 3878
Content-Type: text/html


Connection to 192.168.1.99 closed by foreign host.