擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

Aug-25-10

用 NM 設定 NXHX vpn

posted by Thomas

NXHX 的 vpn 走得是 pptp 協定,其中有一寫選項比較特別,要手動處理,Linux NetworkManager 也不像M$ 第一次會自動偵測(雖然不可靠XD)…
不過有手動連線的經驗之後,看那些選項,大概可以知道怎麼操作。

要先有套件 dpkg -l | grep pptp
ii  network-manager-pptp                 0.8-0ubuntu3   network management framework (PPTP plugin)
ii  network-manager-pptp-gnome       0.8-0ubuntu3  network management framework (PPTP plugin
ii  pptp-linux                                  1.7.2-4           Point-to-Point Tunneling Protocol (PPTP) Cli

在右上角NM(NetworkManager)圖示點選,底下有vpn,可以找到設置vpn。

新增連線,點選vpn的label,按下右邊的加入。

vpn 類型選 pptp。

輸入gateway, account, password

選 Advanced,只勾PAP,下有一些選項,Use tcp header compress 不要勾。

另外要設定140.110.16.1為dns,就是在IPv4設定為”只有自動VPN位址”,地下可以輸入DNS。

Oct-29-09

usplash theme clonezilla

posted by Thomas

最近簡單製作了 usplash for clonezilla,因為用vmware錄的不好…


usplash

基本作法可以參考 usplash 中的 example, 或是 ubuntu (usplash-theme-ubuntu) or debian (usplash-theme-debian)

大致上就是準備255色以內非透明的png檔,配合修改 theme.c 的檔案就可以完成!

完成後發現 9.10 又改用 xsplash…機機車車 不是很好搞XD 暫時先這樣 不弄了!

Oct-22-09

NXHX PPTP 手動設定

posted by Thomas

修改自 PPTP Client Debian HOWTO by James Cameron 26th May 2008
These are instructions for installing PPTP Client on Debian GNU/Linux.

Contents:

* 安裝 Ubuntu pptp client

apt-get install pptp-linux

* 手動設定pptp連線
Configuration, by hand

1. obtain from your PPTP Server administrator:

* the IP address or host name of the server ($SERVER),
* the name you wish to use to refer to the tunnel ($TUNNEL),
* the authentication domain name ($DOMAIN),
* the username you are to use ($USERNAME),
* the password you are to use ($PASSWORD),
* whether encryption is required.

基本上要開始之前要對 VPN SERVER 有所了解,最起碼要知道ServerIP, Domain, Username, Password, 最容易告不清楚就是 “加密”與”壓縮”
以 NXHX公司為例
* $SERVER = 140.110.22.100
* $TUNNEL = nchc //自己定義就好
* $DOMAIN = //沒有
* $USERNAME = ….
* $PASSWORD = ….
* 以 pap 認証,允許不加密資料…

2. 建立 or 修改 /etc/ppp/options.pptp:

預設是 lock noauth nobsdcomp nodeflate refuse-pap refuse-chap refuse-eap refuse mschap
,而NXHX因為要用到PAP,所以把 refuse-pap 給住解掉。
# We won’t do PAP, EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2
# (you may need to remove these refusals if the server is not using MPPE)
#refuse-pap
refuse-eap
refuse-chap
refuse-mschap
….

3. 建立 or 修改 /etc/ppp/pap-secrets: //因為我們用的是pap認証,所以要改這個檔案,也時候也可能要改的檔案是 chap-secrets…所以要看你的認証方式而定

$USERNAME PPTP $PASSWORD *

4. 建立 /etc/ppp/peers/$TUNNEL:

vi /etc/ppp/peers/nchc
pty “pptp 140.110.22.100 –nolaunchpppd”
name $USERNAME
remotename PPTP
file /etc/ppp/options.pptp
ipparam nchc

Note: if you do not need MPPE support, then remove the require-mppe-128 option from this file and /etc/ppp/options.pptp.
// 原本範例有 require-mppe-128 因為我們不需要 所以拿掉了

5. 用 pon 來建立連線吧:

pon nchc

ifconfig 可以找到 ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:140.110.35.193 P-t-P:140.110.35.192 Mask:….

6. 斷線:

poff nchc

7. to set up routing: //這邊希望連線後預設路由就是VPN出去

route add default gw 140.110.35.192

or

vi /etc/ppp/ip-up.d/nchc

#!/bin/sh
if [ "${PPP_IPPARAM}" = "nchc" ]; then
    /sbin/route add -net 140.x.0.0/16   dev ${IFNAME}
    /sbin/route add -net 2xx.1xx.1xx.0/24 dev ${IFNAME}
fi

8. 在NXHX還要改 DNS 140.110.16.1

這樣就大功告成啦!

更多細節參考
http://pptpclient.sourceforge.net/howto-debian.phtml

Oct-20-09

Ubuntu AoE booting - not finish

posted by Thomas

1. 安裝Ubuntu //建議只用4G大小的硬碟,或是只切到4G以免耗費太多dump的時間
sda1 => /, sda5 => swap

2. apt-get install aoetools

3. modprobe aoe //測試看看aoe module,用 lsmod 檢查看看

4. whereis aoe-discovery //測試看看aoe-discovery 有沒有在/sbin/

5. wget http://www.libthomas.org/~thomas/wp/wp-content/uploads/2009/10/hooks-aoetools -O
/etc/initramfs-tools/hooks/aoetools

6. wget http://www.libthomas.org/~thomas/wp/wp-content/uploads/2009/10/scripts_local-top_aoetools -O /etc/initramfs-tools/scripts/local-top/aoetools

7. sudo find /etc/initramfs-tools -name aoetools -exec chmod u+x ‘{}’ \;

9. vi /etc/initramfs-tools/initramfs.conf //預設應該是這樣 BUSYBOX=y

10. update-initramfs -u -k all //會產生新的initrd在/boot

11. vi /etc/fstab
#把類似這樣的代號/dev/sda1 換成 AoE 的代號 /dev/etherd/e[x].[y]p[z] //[x].[y]
代表硬碟 [p]代表磁區
/dev/etherd/e0.0p1 表示第0.0硬碟的第一個partition
ex:
/dev/etherd/e0.0p1 / ext3 realtime,eooros=remount-r 0 1

原先的fstab

修改過後的fstab

12. vi /boot/grub/menu.lst
kernel ……root=/dev/ethered/e0.0p1

A. DRBL伺服器就緒後,在DRBL伺服器上執行”/opt/drbl/sbin/dcs”,選擇”remote-linux-txt”。然後將T機器當作DRBL的用戶端,把它經由PXE來開機進入DRBL的用戶端命令列。

13. 在Client機器登入成root (如果你的root沒有設定密碼的話,你無法登入該主機,可以先在DRBL伺服器上執行”/opt/drbl/sbin/drbl-client-root-passwd”來設定用戶端root的密碼後再來在Client機器登入。)

14. 執行”/etc/init.d/mkswapfile stop”來停止使用swap以免有任何分割區被掛載住。

15. 在Client機器上執行”/opt/drbl/sbin/drbl-aoe-img-dump -x”,然後選擇要複製到伺服器的硬碟,再來就是輸入印象檔名稱。這個命令會將T機器裏面的硬碟的第一個分割區以及MBR,分割區表等資訊在伺服器的 /home/sanboot-img/裡存成一個類似這樣的檔名”winaoe.aoe-0-0-for-00-50-56-02-01-09″(如果你輸入的印象檔名稱是winaoe)。此時會等待一段時間。完成後,建議把這個印象檔備份,這樣萬一不小心攪亂這個印象檔的時候,不用重新再安裝MS Windows以及再dump一次,可以直接把備份的檔案複製回來即可。註:這裡我們檔名的格式: [name].aoe-[shelf no]-[slot no]-for-[client MAC address]
# DRBL-Server 需要對應AoE代號
在 img-dump 之後,可以在 /home/sanboot-img/找到剛剛 dump 的資料
ex: Ubuntu.aoe-0.0-for-00-0c-29-f8-01-ac //格式 Name.aoe-x.y-for-$mac
注意這邊的 x,y 必須要與 fstab, menu.lst 中的硬碟代號一致!

B. 然後在DRBL伺服器上,登入成root,然後執行”/opt/drbl/sbin/drbl-aoe-serv start”。這樣所有的設定應該已經完成。
# 啟動 AoE Server /opt/drbl/sbin/drbl-aor-serv [start|restart|stop]

C. 確認
ps aux | grep vblade
grep aoe /tftpboot/nbi_img/pxelinux.cfg/$mac
xxxx: append aoe:e0.0

16. client 網路開機
預設應該是 Diskless client (AoE booting)
# 如果不要使用這個AoE服務的話,可以執行”/opt/drbl/sbin/drbl-aoe-serv stop”來停止。

Tags: , , ,
Mar-2-09

用 wicd 取代 NetworkManager

posted by Thomas

Yes,現在已經完全用 wicd 來取代 NetworkManager。

其實,NetworkManager 很好用,對跟指令無緣的人,或是不需要把NB拿來作一些特異功能的話。wicd 只是半自動的網路圖形管理介面。有點像開車,有的人喜歡自排、手排的感覺。

wicd 在這邊已經做了非常完整的介紹 Wicd - Linux底下好用的連線管理套件安裝說明也非常簡單。

Ubuntu 安裝方式:

增加 wicd repository 到 sources.list

deb http://apt.wicd.net intrepid extra

wget -q http://apt.wicd.net/wicd.gpg -O- | sudo apt-key add -

apt-get update

apt-get install wicd

通常我在使用上,會先在偏好設定中把有線網路介面 eth0 給拿掉,不要讓 wicd 管理。

這樣 DRBL 運作的時候就不會發生有線網路被自動修改的情形,wlan0 給 wicd 管理對外連線,eth0 設定成私有固定IP 由 interfaces 管理,這樣 DRBL-NB Server 就可以完美運作了!

另外我很喜歡腳本功能,我通常會設定連線到公司的無線網路時,在 post-connection 也就是連線之後自動執行一隻認證的程式,取代繁瑣的 AP web access。

Tags: , ,