niusrv, snmp+mrtg 設定參考

No Comments

設定檔 /etc/snmp/snmpd.conf
</div>
<div>com2sec local localhost private</div>
<div id="_mcePaste">com2sec6 local localhost private</div>
<div id="_mcePaste">com2sec niusrv 120.101.5.41/24 public</div>
<div id="_mcePaste">com2sec6 niusrv 2001:288:a001:5::41/64 public</div>
<div id="_mcePaste">--</div>
<div>
<div>view    all           included   .1 80</div>
<div>view    systemview    included   .1.3.6.1.2.1.2</div>
<div>view    systemview    included   .1.3.6.1.2.1.1</div>
<div>view    systemview    included   .1.3.6.1.2.1.25.1.1</div>
<div>view    systemview    included   .1.3.6.1.2.1.2.2.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.5.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.6.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.11.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.10.1.3.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.10.1.3.2</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.10.1.3.3</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.3.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.4.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.5.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.6.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.11.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.13.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.14.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.4.15.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.2.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.3.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.6.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.7.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.8.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.9.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.9.1.10.1</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.9.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.50.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.10.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.52.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.11.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.53.0</div>
<div>view    systemview    included   .1.3.6.1.4.1.2021.11.51.0</div>
<div>-- 以上參考 --</div>
<div>-- 以下一定要設定, 找出網卡 --</div>
<div>
<div>view    systemview    included   .1.3.6.1.2.1.1</div>
<div>view    systemview    included   .1.3.6.1.2.1.25.1.1</div>
<div>view    systemview      included .1.3.6.1.2.1.2.2.1.10</div>
<div>view    systemview      included .1.3.6.1.2.1.2.2.1.16</div>
</div>
<div>-- 以上一定要設定, 找出網卡 --</div>
</div>
<div>
[檢查SNMP查詢內容]
# snmpwalk -c public -v 2c
建立 mrtg.cfg 檔案
cfgmaker –enable-ipv6 –global ‘HtmlDir: /var/www/mrtg’ –global ‘ImageDir: /var/www/mrtg’ –global ‘LogDir: /var/lib/mrtg’ –global ‘ThreshDir: /var/lib/mrtg’ –output /etc/mrtg/mrtg-temp.cfg public@niusrv.twbbs.org
建立 index.html for MRTG
/usr/bin/indexmaker –output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

[程式][系統]Shell Script 基本型

No Comments

參考: 鳥哥的 Linux 私房菜 – 學習 Shell Scripts
REF: http://linux.vbird.org/linux_basic/0340bashshell-scripts.php

— 基本型 —
#!/bin/sh
# 程式註解 writing 1.0.0
# 版權宣告 GPL
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
echo -e “Hello World ! a n”
exit 0

— 判斷型 —
(以下待補)

[驅動][系統]usb wireless zd1211rw driver

No Comments

以下文章來自: http://blog.linym.net/archives/209

感謝 lym520 的貢獻

關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver,經常在各大討論區及 BBS 看到有人提出相同的問題,因此來寫個教學。

前往 ZD1211 專案網站可以知道目前有三種版本的驅動,其中建議使用 zd1211rw 這個版本,因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片:

  • ZyDAS ZD1211
  • ZyDAS ZD1211B
  • Atheros AR5007UG

不過既然都已經納入 kernel 了為什麼還要編譯驅動?因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是),當然就沒辦法驅動囉!這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID,主機環境是 ubuntu 7.10,其他版本應該也差不多。

首先要安裝編譯相關套件 & 下載 linux source
$ sudo apt-get install build-essential kernel-package linux-source

切換至 src 目錄並解開 linux source
$ cd /usr/src
$ sudo tar -xjvf linux-source-2.6.22.tar.bz2

拷貝 kernel 設定檔(.config) 至 linux source
$ sudo cp linux-headers-2.6.22-14-generic/.config linux-source-2.6.22

編輯 zd_usb.c 加入新 USB ID,可利用 lsusb 指令可以找出網卡的 ID,如:2019:5303
$ cd linux-source-2.6.22
$ sudo vim drivers/net/wireless/zd1211rw/zd_usb.c
在檔案開頭不遠處可以看到一堆 USB ID 號碼,就是要加進這裡面,GW-US54GXS 是 ZD1211B 晶片,所以在 ZD1211B 下方增加一行:
/* ZD1211B */
{ USB_DEVICE(0×2019, 0×5303), .driver_info = DEVICE_ZD1211B },
確認後就存檔離開

開始編譯驅動
$ sudo mkdir .tmp_versions
$ sudo make drivers/net/wireless/zd1211rw/zd1211rw.ko

沒錯誤就會產生 zd1211rw.ko,將它覆蓋原本系統中的
$ sudo cp drivers/net/wireless/zd1211rw/zd1211rw.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/zd1211rw
$ sudo depmod -a

重開機應該就可以正確驅動了:D

參考資料:
Adding new device IDs to zd1211rw

[更新][系統]Upgrade FreeBSD (二) vi your kernel

No Comments

cd /usr/src/sys/i386/conf

vi YOUR-KERNEL

cd ../complie/i386/

config YOUR-KERNEL

make cleandepend ; make depend ; make ; makeinstall

reboot

vi YOUR-KERNEL 時
若有編輯到 umass (USB 大容量存儲)時
需要加上
device scbus # SCSI bus (required for SCSI)
device da # Direct Access (disks)
這兩個 device, 不然會出現
undefined reference to `xpt_done’
的錯誤

[更新][系統]Upgrade FreeBSD (一) cvs up

No Comments

REF: http://cu.ttc.edu.tw/wordpress/?p=15

Freebsd 6.1 ->Freebsd 6.2

1.安裝cvsup

#cd /usr/ports/net/cvsup-without-gui/ (進入cvsup安裝路徑)

#make install clean (安裝套件並清除安裝過程中產生不必要檔案)
皆下來設定修改stable-supfile

#cd /usr/share/examples/cvsup/

#vi standard-supfile
修改以下資料

*default host=cvsup13.tw.freebsd.org (改為國內站台giga如此下載速度較快,還有cvsup1~13都可使用)

*default release=cvs tag=RELENG_6_2

存檔,皆下來開始更新

#rehash (才不會出現指令無效訊息)

#cvsup -g -L2 stable – supfile (再來就開始檢查有哪些更新檔案,跑完會顯示 Finished successfully)

#cd /usr/src

#make update
準備開始編譯新的核心

#cd /usr/src/sys/i386/conf

#cp GENERIC /root/MYKERNEL

#ln -s /root/MYKERNEL

#vi MYKERNEL (修改核心設定)
省略

#cd /usr/src

#make buildworld

#make buildkernel KERNCONF=MYKERNEL

#make installkernel KERNCONF=MYKERNEL

#sync;sync;sync; reboot(更新完後重新開機)

————————————————————————————–
(此段請參考 http://hina.ushiisland.net/blog/445)
CVSup 的部分
備份這兩個檔案

/etc/master.passwd
/etc/group
如果要整個 /etc 備份也可以,不過如果是新安裝的主機,是可以不用啦。安裝 CVSup 請參考之前的文章。安裝完畢之後,請更新 Source 檔案,確認安裝 FreeBSD 時有將 source code 裝進來,接著按照以下步驟更新整個系統。

make buildworld
編譯所有的系統程式。

make buildkernel KERNCONF=MYKERNEL
編譯新的系統核心。系統核心檔案(MYKERNEL)請依照自己的系統與需求修改,詳細的核心資料可以參考這篇文章,twbsd.org, 第八章 編譯核心。

make installkernel KERNCONF=MYKERNEL
安裝新的核心。

make installworld
安裝新的系統程式。

mergemaster
用來檢查並升級你的設定檔。他會將 CVSup 抓回來的新的檔案與現有的設定檔做比對,然後讓你決定是否要使用新的設定檔案。除了 master.passwd group aliases 三個檔案可以沿用舊的設定之外,其他的幾乎都可以更新。
最後 sync;sync;sync;reboot 重新開機。
————————————————————————————–

重開機進入 singl mode ( 單人模式 )

#mount -a

#cd /usr/src

#make installworld

#sync;sync;sync;reboot

此時再 uname -a 看一下,嘿,升級成功囉!

不過此時你的 uname -r 會變成是 6.3-RELEASE-p1, 這會造成 sysinstall 安裝 packages 時
出現找不到套件的問題

要在 Options 裡改掉 RELEASE 的資訊為 6.3-RELEASE
(這個問題困擾我很久, 還找錯解決方向, 害我重編核快3次)

[維護][系統]Trustix X window

No Comments

swup –install entrance

swup –install xorg

swup –install metacity

swup –install xorg-x11-fonts-75dpi xorg-x11-fonts-100dpi xorg-x11-fonts-ttf

[不再修正][網路][服務] OpenSER under Fedora 7

3 Comments

因 Fedora 10 與 OpenSIPs 的出現, 此篇文章已不具修改必要性。

REF: http://top12345tw.blogspot.com/2008/05/openser.html (better)

REF: http://www.hk-pub.com/forum/archiver/tid-1064603.html

website: http://www.openser.org/

download: http://ftp.upjs.sk/pub/users/sal/Fedora/7/

Files to donwload:
openser-1.2.2-10.fc7.i386.rpm
openser-mysql-1.2.2-10.fc7.i386.rpm

設定檔:
/etc/openser/openser.cfg
/etc/openser/openserctlrc

# vi /etc/openser/openser.cfg
找到以下各行文字, 並移除前頭的井字符號
# loadmodule “mysql.so”
#loadmodule “auth.so”
#loadmodule “auth_db.so”
#modparam(“usrloc”, “db_mode”, 2)
#modparam(“auth_db”, “calculate_ha1”, yes)
#modparam(“auth_db”, “password_column”, “password”)

#if (!www_authorize(“openser.org”, “subscriber”)) {
#       www_challenge(“openser.org”, “0”);
#       exit;
#};
(以上四行裡的 operser.org 改成你主機的 FDQN)

建立資料庫表單在 MySQL 裡
# vi /usr/sbin/openser_mysql.sh (可以先編輯這個檔案, 裡面包含了可能會使的資訊)
# /usr/sbin/openser_mysql.sh (編輯後就執行它)
可用的參數有:
usage: openser_mysql.sh create
openser_mysql.sh drop   (!!entirely deletes tables)
openser_mysql.sh reinit (!!entirely deletes and than re-creates tables
openser_mysql.sh backup (dumps current database to stdout)
openser_mysql.sh restore <file> (restores tables from a file)
openser_mysql.sh copy <new_db> (creates a new db from an existing one)
openser_mysql.sh migrate <old_db> <new_db> (migrates DB from 1.1 to 1.2)
openser_mysql.sh presence (adds the presence related tables)
openser_mysql.sh extra (adds the extra tables – imc,cpl,siptrace,domainpolicy)
openser_mysql.sh serweb (adds the SERWEB specific tables)

建立環境:
export SIP_DOMAIN=your-ip.address (也可以把這行寫到 /etc/profile 裡)

建立一個資料庫給 OpenSER
# /usr/sbin/openser_mysql.sh create (然後會需要你的資料庫管理員的密碼, ex: root 的密碼)
MySQL password for root: xxxxxxxx

設定開機啟動:
chkconfig openser on

手動啟用:
service openser start

紀錄檔管理:
REF: http://www.openser.org/dokuwiki/doku.php/utils:basic-syslog-configuration
# vi openser.cfg

touch /var/log/openser
(選用)安裝管理程式 OpenSER Admin:
REF: http://www.read8.org/20080918/35617/
yum install ruby ruby-libs rubygems
http://sourceforge.net/projects/openseradmin
wget http://nchc.dl.sourceforge.net/sourceforge/openseradmin/openseradmin-0.3.tar.bz2
tar jxvf openseradmin-0.3.tar.bz2

http://lightyror.thegiive.net/2007/06/fedora-7-ruby-on-rails.html
gem i rails -y
gem install rails –include-dependencies

在 /etc/rc.local 裡加入
/var/www/oseradm/script/server -p 3000 -d
(-p 是指定 port , -d 表示以 daemon 執行)

Older Entries Newer Entries

Share via
Copy link