2013-03-12

Something about dd-wrt v24sp2 build 19154 in WHR-HP-G300N

1. How to keep pppoe connection alive?

=> Reconnect function is already implemented in dd-wrt v24sp2. pppd is configured to automatically rebuild the connection should it fail.

from /tmp/ppp/options.pppoe:

persist
lcp-echo-interval 3
lcp-echo-failure 20


lcp-echo-interval <n> : 如果有給這個選項, pppd 每 <n> 秒將會送出一個 LCP 回應要求(echo-request)封包(frame)給彼端. 在 Linux 系統下, 回應要求在 n 秒內沒有從彼端接收到封包時會被送出. 一般彼端應該以傳送一個回應回覆(echo-reply)來反應該回應要求. 這個選項可以與 lcp-echo-failure 選項一起使用來偵測不再連線的彼端。

lcp-echo-failure <n> : 如果有給這個選項, 那麼如果傳送 n 個 LCP 回應要求沒有接收到有效的 LCP 回應回覆的話 pppd 將會推測彼端是死掉的. 如果發生這種情形, pppd 將會終結該連線. 這個選項的使用要求一個非零的 lcp-echo-interval 參數值. 這個選項可以用在硬體數據機控制線路無法使用的情況下當實際連線被中斷之後 ( e.g., 數據機已經掛斷)終結 pppd 的執行。

persist : 使用此指令代表如果 lcp-echo-interval 3 和 lcp-echo-failure 20 (也就是 60 秒) 判斷 ppp 斷線以後, 不是退出 ppp, 而是重新撥號.

若還不放心, 或網路不穩, 可以打開 WHR-HP-G300N connection watchdog 再作一層確保. ( Administration -> Keep Alive -> WDS/Connection Watchdog.)

2. WAN, LAN and Wireless interface same MAC address?

Recently I replaced WHR-HP-G300N’s firmware to DD-WRT v24sp2 build 19154. And I noticed that this particular router has same MAC addresses on all 3 network interfaces! That is, be it WAN, LAN or wireless, it has the exact same MAC address!

How is this possible, and why does it work? Isn't that at least WAN side & LAN side should have different MAC addresses for a router?


Ans from F430 : No. They may have the same MAC address. A MAC address must be unique on a single broadcast domain. A LAN is a broadcast domain. The WAN is a different broadcast domain (although in some types of WAN interfaces it really isn't a "broadcast domain"). In practical terms only hosts on the LAN side of the router see the router's LAN MAC address. They do not see the MAC address on the WAN side so it doesn't matter if it is different from the LAN MAC address or not. Same for devices on the WAN side. They do not see the LAN side.…….. Note however that some bridges are designed to use a single MAC address for all interfaces. Depends on the firmware running on the bridge.
Via the router. The router acts at layer 3 and forwards based on IP address, not MAC address. A device on the LAN uses layer 3 (IP address) to determine that the destination is not on the LAN. Then it sends the packet to the default IP address (default gateway) for that LAN. Layer 2 takes over and determines what MAC address on the WAN to send the packet to. Neither layer 3 nor layer 2 care what is on the other side of the router since they never see it. Same for a packet on the WAN - it never sees layer 2 MAC addresses or layer 3 IP addresses on the LAN.
It causes no trouble at all. It doesn't violate any specifications or network "rules". The vendor is doing nothing wrong.
Vendors have to buy MAC addresses from IEEE (something like $500 for 65536 addresses.) If they can use 1 instead of 3, they will save a few cents.
Will not cause problems on a router.

2013-03-03

How to rip a video cd to a avi file

1. Copy the AVSEQ01.DAT file from the MPEGAV directory of the VCD to a location on the computer. This file contains the main audio and video of the VCD.

2. Rename the AVSEQ01.DAT file on the computer to AVSEQ01.MPG. Since DAT files are MPEG-1 format, there is no conversion necessary.

3. Open the AVSEQ01.MPG file with the video conversion software. The software should display relevant file information including frame size, frame rate and data rate for the video.

4. Choose an output option to convert the AVSEQ01.MPG file to an AVI file. Use an output frame size that is the same as the source file frame size.

5. Encode the video to AVI format. Depending on the length of the video, encoding may take significant time to complete. Once completed, delete the AVSEQ01.MPG file from the computer.

2013-02-04

Windows7 怎麼將系統磁區轉移到新硬碟?

問題 : 要怎樣透過 ghost partition to partition 的方式備份到另一顆硬碟上, 而又可以正常開機呢?!
我想把原本硬碟上的win7 ghost 到新硬碟上, 但又不想用disk to disk的方式因為我只要系統磁區的部分!!
windows7 有隱藏磁區大約100MB, 我也有都備份過去, 但始終無法開機, 會有錯誤.
但是使用disk to disk是可以開機的!! ( 利用 ghost 加 -lB 參數; ex : c:\>ghost –lB ; 含 MBR 一起 Copy )

============================================================
方法 1: 使用 Ghost <--- 僅新硬碟會動到
100M 的系統保留分區 就不必了
先格式化新硬碟, 然後用 Ghost 把 W7 還原到 Primary Partition 1 並對該分區 active

<<分區代號請自行修改>> 
在PE或救援光碟下執行以下步驟:
bcdboot C:\windows /s C: /l zh-TW
bootsect /nt60 Sys     <--- 會更新硬碟磁碟分割的主開機程式碼,以便在BOOTMGR 與 NTLDR 之間切換
REG LOAD HKLM\Sys C:\Windows\System32\config\System
REG DELETE HKLM\Sys\MountedDevices /v "\DosDevices\C:" /F    <--- 避免系統認錯分區
REG UNLOAD HKLM\Sys
重啟 進入W7

============================================================
方法 2: 使用 W7 內建的備份還原功能 <--- 新舊硬碟都會動到
首先必須對調新舊兩顆硬碟的數位簽章. 怎麼說呢?
Windows 7 的備份, 有綁定硬碟數位簽章. 也就是備份時,給硬碟一個號碼
告訴還原軟體,每個還原檔,只能還原到一開始備份來源的硬碟
把舊硬碟的數位簽章號碼和新硬碟的數位簽章號碼對換. 以用來騙過還原軟體, 達成還原到新硬碟的目標!
以"磁碟 0 是新硬碟, 磁碟 1 是舊硬碟" 為例. 步驟如下:
0. 先以救援光碟格式化新硬碟
1. 啟動救援光碟->"命令提示字元"
2. DISKPART
3. LIST
4. SELECT DISK 1
5. DETAIL DISK
6. 抄下磁碟 1 磁碟識別碼 xxxxxxxx
7. LIST DISK
8. SELECT DISK 0
9. DETAIL DISK
10. 抄下磁碟 0 磁碟識別碼 yyyyyyyy
11. UNIQUE DISK ID xxxxxxxx
12. SELECT DISK 1
13. UNIQUE DISK ID yyyyyyyy
14. Reboot
15. 再次執行救援光碟的備份還原功能
============================================================

2013-02-02

記錄 ThinakPad X61 7673-DF1 安裝 Windows 7 的過程

內容主要是參考 "如何自行在ThinkPad X61安裝Windows XP Professional SP3?", 再加以修改. 強烈建議先看一遍.
ThinkPad X61 出廠時預先安裝了Windows Vista,2008/9 改安裝Windows XP, 並且升上SP3, 2013/1 再升級至Windows 7, 本文是我的安裝心得。
Introduction
使用環境:ThinkPad X61 7673DF1 + 4G記憶體 + USB FlashKey + Unetbootin +Windows 7 Enterprise ISO 檔
預備動作 :
1. 升級 BIOS 2.16 至 2.22 : 在原本的 XP 中使用 ThinkVantage System Update. 必須安裝電池, 否則 BIOS 無法升級.
2. 確認 BIOS SATA mode 為 AHCI. power on -> press F1 -> Config –> Serial ATA(SATA) -> SATA Controller Mode Option : AHCI
3. BIOS 中 Disable : Intel AMT, Security Chip, Wireless WAN, Ultrabay
4. 使用 Unetbootin, 將 Windows 7 ISO 裝入 USB.
5. Download X61 driver from Lenovo support express home

開始
Step 1: 使用 USB Flashkey 開機. power on -> press F12 -> 選由 USB Flashkey 開機
Step 2: Install Windows 7
Step 3: Install Intel Chipset Driver
Step 4: Install Intel Matrix Storage Manager Driver. 更新 Intel(R) ICH8M SATA AHCI Controller 驅動程式. 裝置管理員->IDE ATA/ATAPI->Intel(R) ICH8M SATA AHCI Control->內容->更新驅動程式
Step 5: Intel Turbo Memory driver
Step 6: ThinkVantage Power Manager. 這是ThinkPad招牌工具程式,一定要安裝!!除了在工具列顯示目前電池電力資訊外,主要還能控制如何對電池充電,減少充電次數,增加電池壽命。
Step 7: Power Management Driver

==== 至此安裝過程就完成了, 很多 Drivers Windows 7 都已自動安裝好了 ====

Step 8: Hotkey features Integration
Step 9: ThinkVantage Access Connection
Step 10: 安裝 ThinkVantage System Update, then 執行 ThinkVantage System Update 安裝你所需要的驅動程式或更新

PS :
1. 按 F1 進 BIOS; 按 F12 選擇開機媒體; 按 F11 進入 Rescure/Recovery 功能
(重新 Format HD 後就沒用了)
2. Lenovo ThinkPad driver website : http://download.lenovo.com/express/ddfm.html

Reference:
1. ThinkPad T61/R61/X61介紹特集
2. 驅動程式下載 : Lenovo > Support Express Home > Device Drivers File Matrices

2012-09-23

IME: Intel Management Engine

vPro 必備的5個硬體組件
個人電腦的硬體要有5個條件才能稱為 vPro 平臺,第一是處理器要支援虛擬技術,第二則是要具備 Intel ME 的北橋晶片,第三是南橋晶片要支援 Intel AMT(主動管理技術),第四是能透過 AMT 寫入的 Flash ROM,最後網路晶片要支援 OOB(Out Of Band),能載入2祖 IP Address。上述條件缺一不可.

vPro 平臺會應用到處理器的 Intel VT (Virtualization Technology,虛擬技術),AMT 可控制利用 VT 安裝的嵌入式作業系統。

vPro 平臺中,最重要的就是 Intel ME (Management Engine),這類似另一個 BIOS,北橋晶片要具備 Intel ME 才能應用 vPro 平臺,只要支援 AMT 技術的軟體,就能控制 Intel ME,而達成遠端管理。

vPro平臺中另外一重要的技術是 Intel AMT (Active Management Technology,主動管理技術),只要軟體支援 AMT,就能透過網晚路管理 vPro 個人電腦。

AMT 執行後的資料,需要儲存在 Flash 中,而 Flash 還要儲存 BIOS、Intel ME 及網路晶片韌體及資料、和軟體開發商提供 API 程式,這也讓原本只需要8MB的 Flash ROM,擴充到 16MB。特別的是,記憶體中增加能儲存 NVRAM,可寫入軟體開發商的程式,應用程式可利用 AMT 技術存取 Flash 中的資料,不需要儲存在電腦中。

vPro 電腦需要具備 2組 IP Address 及支援 OOB (Out of Band),Intel 82566DN GbE 則同時具備上述功能。它會專門提供 IP Address 給 AMT 使用,管理系統就是透過此 IP Address 與 vPro 電腦溝通,不影響使用操作,而且就算關機下,也能取得 IP Address

1. Intel ME 類似主機板上另一個 BIOS


2. ME 設定主要提供管理員調整電源管理、遠端韌體更新權限等,變更 ME 設定完成後,系統需重新開機後才會套用新設定。


3. ME 目前掌管了系統開機大權,包含開機時部份的 power sequence / clock / HW-STRAP 而 ME 基本上就是一個內含在 PCH內的 Controller

當你按下 Power button 時,剛開始 ME 會先使用一 PCH 內含的 ROM 來啟動(這組 ROM 是外界無法 touch 的),接著套用一個  HW Default 去驅動 CLOCK 來讓系統開機,CLOCK 出來後,ME 會先去讀取存放在 SPI Flash 裡的 Descriptor,也就是 SPI Flash 的前 4KB, 先驗証 Descriptor 裡的 signature 是否等於 0FF0A55Ah,若不同的話,則不會執行 ME Firmware! 若值正確,會接著套用 Descriptor 裡的 hw strap 值並執行 ME Firmware,然後才開始 LOAD SPI Flash 裡的 BIOS Area,當 BIOS 開機到 MRC,時會分配 memory 給 ME UMA 使用…


ME上還有不同的AP,Intel AMT就算是ME AP的一種

4.
4.1 CALPELLA 的 clock 有 2 種模式,一種是採用舊的 clock gen 來給 platform 供給 clock,另一種是完全由 PCH 來提供 platform 上的 clock


4.2 我說的 hw strap 可能有點不妥,但有不少的 hw config 是存放在 descriptor 裡,開機時由 ME 來取用,比方說 PCH 上的 PCI Express lane 的設定,是否做 lane reversal,lane的組態設定/ PCIE lane 是否為借道給 on board LAN 的PHY來使用…等


4.3 原本不少需要透過 HW 機制來完成的動作,現階段改由 ME 來完成

Source : IME

2012-09-05

How to Change UUID of VDI files

先做好一個Windows XP的vdi,再複製一份VDI要分別做Office 2000和Office 2003的VM,出現UUID重覆的訊息,要如何處理呢?

"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands sethduuid 檔案名稱
That's it!

How to resize a VirtualBox disk partition

Method 1 :

VirtualBox is a cross platform full virtualizer for x86 hardware. It runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems such as Windows, Linux and OpenBSD. In a previous guide I have shown you How to install Ubuntu Linux on Windows using VirtualBox . The procedure is the same if you want to install Windows on Linux. The guest operating system is installed on a virtual disk created by VirtualBox which is nothing more than a single .vdi file. When you first create the virtual machine you must set a certain size for this disk. However after playing with VirtualBox you might realize you need more space because your virtual disk is full So, in this tutorial I will explain how to enlarge an existing virtual disk or in other words how to resize your virtualbox vdi. I have a Windows XP installation running on Linux and specifically Archlinux and I am going to create a larger disk for Windows XP.
**Note: The same procedure works for Windows Vista also. The only difference is that you have to use your original Vista installation CD for Bootmgr repair the first time the system is started after the GPARTED steps have been followed. (Thanks to Andrew)

Run VirtualBox and go to File -> Disk Manager.

1sm
Here as you can see I have a .vdi disk with a size of 10GB (1) which is almost full. So press the New button (2) to create a new virtual disk.

2sm
Click next to go to the next page of the New Virtual Disk Wizard.

3
Select Dynamically expanding image as Image type and click next.

4
Select a name for the new image (1), this should be different than the existing one, and also set the size of the new disk (2). Here I've set it to 20GB.

5
Press Finish to end the wizard.

6
Now you should have 2 .vdi images in the Virtual Disk Manager. Click Ok to close the wizard.

7sm

Here we are gonna need GParted to copy the data of our old disk to the new one. GParted is the Gnome Partition Editor application for creating, destroying, resizing, moving, checking and copying partitions, and the file systems on them. It has a LiveCD which you must download from here . You don't have to burn it on a cd, just store the .iso somewhere in you hard disk.

Now select the existin Windows XP installation (1) and click on the Settings button (2).

8sm
In the General -> Advanced tab set CD/DVD Rom as the first boot device.

9sm
In the Hard Disks settings double click below your IDE Primary Master and set IDE Primary Slave and the new Virtual Hard Disk image.

10sm
In the CD/DVD-ROM settings click on Mount CD/DVD Drive (1), choose ISO Image File (2) and use the folder button to browse to the location you have saved the gparted live cd (3).

11sm
Now click the Ok button and start the Windows XP Virtual Machine. Press Enter to boot GParted Live with Default Settings.

12sm
Don't touch keymap should be fine. Again press Enter.

13sm
Select the Language you prefer. Press Enter for English. And again press Enter for the default video card settings.

14sm
GParted will automatically scan your virtual disks. /dev/hda should be the old one and /dev/hdb the new one. Right click on your first disk and select Copy.

15sm
Next select /dev/hdb from the drop down menu (1), right click on the unallocated space and select Paste (2).

16sm
Drag the right edge (1) like you see in the screenshot so as not to leave any unallocated space in the new disk. Next click the Paste button.

17sm
Now press Apply to apply the changes.

18sm
When all listed operations are applied click the Close button. Again right click on the new partition /dev/hdb and click Manage flags. Here you should tick the boot flag.

19sm

Gparted will scan all devices once more. When it's done close the program and shutdown the live cd from the exit button. It will prompt you to press Enter. Now return to the VirtualBox application, select the Windows XP virtual machine and click the settings button. In the General -> Advanced tab select Hard Disk as the first boot device.

20sm
In the Hard Disk settings use the delete button (1) to remove the IDE Primary Slave, leave just IDE Primary Master (2), and select the new .vdi (3).

21sm
In the CD/DVD-ROM settings tick the Host CD/DVD Drive.

22sm
Press the Ok button and start your Windows XP virtual machine. Windows might ask to check their filesystem. Just let them do it.

23sm
After they automatically reboot you will log into your new resized virtualbox disk without having lost any of your data. You can now just delete the old .vdi. Enjoy!

24sm

Method 2 :

Use Norton ghost bootable CD. See 賴榮樞的軟體資訊誌 直接擴充現有的VMWare虛擬磁碟容量