聚沙成塔

養貓的陌生人筆記本

Windows 2003 DHCP 快速鎖定大量 Mac Address

No Comments »

以往要綁定 DHCP 總是要一筆一筆輸入
公司電腦又一天比一天多,實在麻煩了,|
因此想快速完成這件事。
以下是我起心動念之後開始的步驟:

1. 先利用2003本身的管理介面,導出現有的 DHCP 列表,把第一行中文字給刪除。

2. 將這個文件用 awk 重新整理一下

cat DHCP.txt |awk -F\t '{print $1,$5,$2}'

會得出一個這樣的結果:

 192.168.x.101 001xx09689f0 mis 

3. 查詢一下 netsh 的指令,得知綁定 DHCP 的完整命令為

 netsh dhcp server 192.168.x.1 scope 192.168.x.0 add reservedip 192.168.x.101 001xx09689f0 mis 

因此再使用 awk 整理一次,重導向到另一個檔案中


cat DHCP.txt |awk -F\t ‘{print netsh “dhcp server 192.168.x.1 scope 192.168.x.0 add reservedip”,$1,$5,$2}’ > DHCP.bat

如此便誕生了一個快速綁定 DHCP 的 bat 檔案,只需要放到Server上執行,
就能快速的完成任務了。

附錄:

備份 DHCP 設定的方法

netsh dhcp server export c:\dhcp.txt all

導入 DHCP 設定的方法

 netsh dhcp server import c:\dhcp.txt all 

cron.d 資料夾

No Comments »

為了讓系統能夠更自動化,
我發現了CentOS /etc 目錄下,
分別有 cron.daily cron.horly 等資料夾,
分別是作業系統預設一定會去找的工作,
然後又發現了一個叫cron.d的資料夾,
底下可以設定一個檔案自動排程的時間,
這樣的話就可以自訂時間而不需使用 crontab -e 來編輯排程了.

然而卻碰到了問題,時間到了卻沒有執行…
查看log發現了這樣的訊息:

(*system*) BAD FILE MODE
經過查詢需要更改權限…
chmod 0600 /etc/cron.d/*

改了權限後,錯誤訊息沒有了,但仍然不會執行,
參考/etc/crontab 文件後,
增加一個使用者身份如下,就成功了。

00 16 * * * root /path/to/scripts

Could not load all ISAPI filters for site/service

No Comments »

事發原因都是因為 Vista 64 的印表機驅動有問題。

原本用公司配給我的 PC 灌 Windows 2008  x64 來分享一台 HP1505n,
沒想到會出現部份檔案可以印,部份檔案不能印的問題,
於是就想用另一台 Sever 2003 WSUS x64 來分享看看,

裝好印表機之後,很遺憾實驗失敗了,情況沒改善而且 WSUS 也掛了…
看事件檢視器真是一片狼藉啊…

    Could not load all ISAPI filters for site/service

    Application pool ‘DefaultAppPool’ is being automatically disabled due to a series of failures in the process(es) serving that application pool.

    A process serving application pool ‘DefaultAppPool’ reported a failure. The process id was ‘2252′.  The data field contains the error number.

還有一大堆不贅述,總之我找到解法了:

1. 移除 HP 印表機驅動程式雞婆幫忙裝的 .Net Framework 1.1

2. 取消32位元相容模式,跑以下指令:
cscript C:\inetpub\adminscripts\adsutil.vbs SET
W3SVC/AppPools/Enable32bitAppOnWin64 0

3. 把 IIS 註冊給  .Net Framework 2.0,跑以下指令:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727>
aspnet_regiis.exe -i

FreeBSD nss_ldap v.s OpenSSL

No Comments »

哈哈,終於找到 FreeBSD 裝不順利的原因了,
原來是 OpenSSL 這個東西在亂搞鬼,
FreeBSD 原本都有內建一版 OpenSSL
但是更新 Ports Tree 之後再安裝 OpenSSL 則會更新到 0.9.8k
由於已經試驗過所有版本的 FreeBSD (x64,x86,7.1,6.4,6.3)
所以可以輕易推論出目前不能使用 Ports Tree 上的 OpenSSL 最新版,
否則會造成 LDAP, nss_ldap, apache
以及其他所有跟 OpenSSL 有關係的服務不匹配。

呼….問題終於解決了~~爽。

在 AIX 5.2 上安裝 bind8

No Comments »

其實在 aix 5.2 上面裝 bind 跟一般並沒有什麼不同,
但是實做最大…你沒裝過你敢說之前的做法一定成功嗎?XD
故在此紀錄一下步驟…

Read the rest of this entry »

使用 telnet 連上 IRC Server

No Comments »

IRC 是一個聊天型的服務,不過是明碼的,
以下示範如何用 telnet 指令就登入 IRC Server


telnet  irc.server.domain  6667

NICK [your name]

USER [your name]  irc.server.domain blah germaN

join #[ch-name]

PRIVMSG  #[ch-name]  : TSET

Read the rest of this entry »

使用反向代理 squid 保護 apache

No Comments »

squid 的功能我就不贅述了,除了當作 httpd-proxy server 之外,還能保護後端的網站,
減少該網站 I/O 的效能消耗。
以下為 squid.conf 的組態設定,#部份是 FreeBSD 的路徑

Read the rest of this entry »

控制搜尋引擎蜘蛛

No Comments »

網站流量節節升高,
所以必須節流的時候到了!
開啟一個空白檔案 叫做 robots.txt 在網站根目錄下,
內容為:

Read the rest of this entry »

NetBSD 3 基本上網設定

No Comments »

以下為 NetBSD 3 基本網路設定

安裝也是照畫面指示即可,

網路配置

Read the rest of this entry »

打開 rcp

No Comments »

打開簡單的 rcp 權限

今日老闆突然要打開 rcp 的語法權限,

是 AIX 與 Solaris…

Read the rest of this entry »