今天接到一個工作
要把snort裡的資料匯出成文字檔給外面的單位
因為BASE沒辦法一次全部匯出
所以要自己寫sql了
select event.cid,signature,sig_name,inet_ntoa(iphdr.ip_src),inet_ntoa(iphdr.ip_dst),timestamp from iphdr,event,signature where event.signature=signature.sig_id and event.cid=iphdr.cid into outfile '/tmp/sqloutput.txt';
http://www.andrew.cmu.edu/user/rdanyliw/snort/acid_db_er_v102.html
http://sgros.blogspot.tw/2012/07/querying-snort-sql-database.html
http://note.tc.edu.tw/670.html
2015/07/05
2015/06/30
brocade fws 624 密碼忘記時的處理方法
Recover from a lost password.
1. Start a CLI session over the serial interface to the Brocade device.
2. Reboot the device.
3. While the system is booting, before the initial system prompt appears, enter b to enter the boot
monitor mode.
4. Enter no password at the prompt. (You cannot abbreviate this command.)
5. Enter boot system flash primary at the prompt. This command causes the device to bypass the
system password check.
After the console prompt reappears, assign a new password
Recover from a lost password.
1. Start a CLI session over the serial interface to the Brocade device.
2. Reboot the device.
3. While the system is booting, before the initial system prompt appears, enter b to enter the boot
monitor mode.
4. Enter no password at the prompt. (You cannot abbreviate this command.)
5. Enter boot system flash primary at the prompt. This command causes the device to bypass the
system password check.
After the console prompt reappears, assign a new password
2015/06/29
2015/06/28
最近想在8G的硬碟上裝linux mint
但安裝時會出現
說hd不夠大
為了解決這個問題找了一下資料
也不難處理
修改 /usr/lib/ubiquity/ubiquity/misc.py
min_disk_size = size * 2 # fudge factor.
為
min_disk_size = size * 1.1 # fudge factor.
再執行installer就ok了
http://forums.linuxmint.com/viewtopic.php?f=46&t=182642
但安裝時會出現
說hd不夠大
為了解決這個問題找了一下資料
也不難處理
修改 /usr/lib/ubiquity/ubiquity/misc.py
min_disk_size = size * 2 # fudge factor.
為
min_disk_size = size * 1.1 # fudge factor.
再執行installer就ok了
http://forums.linuxmint.com/viewtopic.php?f=46&t=182642
2015/06/26
好像愈來愈多人設定forword來把信轉到gmail去
導致因為信件量太多而被google擋了
一直出現
Jun 26 13:43:11 mail postfix/smtp[19923]: 4BB3B9E0624: lost connection with ALT1.ASPMX.L.GOOGLE.COM[64.233.168.26] while receiving the initial server greeting
Jun 26 13:43:13 mail postfix/smtp[19922]: 743E79E058A: lost connection with alt2.gmail-smtp-in.l.google.com[64.233.168.27] while receiving the initial server greeting
除了要求user不要再轉信而用pop3來收信外
想不出來有什麼方式可以解決了
查了一下google有提供轉發的服務
https://support.google.com/a/answer/2956491?hl=zh-Hant
再想看看要不要用
導致因為信件量太多而被google擋了
一直出現
Jun 26 13:43:11 mail postfix/smtp[19923]: 4BB3B9E0624: lost connection with ALT1.ASPMX.L.GOOGLE.COM[64.233.168.26] while receiving the initial server greeting
Jun 26 13:43:13 mail postfix/smtp[19922]: 743E79E058A: lost connection with alt2.gmail-smtp-in.l.google.com[64.233.168.27] while receiving the initial server greeting
除了要求user不要再轉信而用pop3來收信外
想不出來有什麼方式可以解決了
查了一下google有提供轉發的服務
https://support.google.com/a/answer/2956491?hl=zh-Hant
再想看看要不要用
2015/06/19
after cacti upgrade to 0.8.8d
zoom not working
Orz
wait for some days
someone find the problem and solved
download jquery-ui.js from https://jqueryui.com/download/
and put it into /cacti/include/js/
jquery-ui.js is missing from Cacti 0.8.8d tar.gz package.
This library is needed by jquery-zoom plugin.
This is the script load header from default cacti tree view :
<script type="text/javascript" src="/cacti/include/layout.js"></script>
<script type="text/javascript" src="/cacti/include/js/jquery.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/js/jquery-ui.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/js/jquery.cookie.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/js/jstree.js"></script>
<script type="text/javascript" src="/cacti/include/js/jquery.zoom.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/jscalendar/calendar.js"></script>
<script type="text/javascript" src="/cacti/include/jscalendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="/cacti/include/jscalendar/calendar-setup.js"></script>
http://forums.cacti.net/viewtopic.php?f=21&t=54754
zoom not working
Orz
wait for some days
someone find the problem and solved
download jquery-ui.js from https://jqueryui.com/download/
and put it into /cacti/include/js/
jquery-ui.js is missing from Cacti 0.8.8d tar.gz package.
This library is needed by jquery-zoom plugin.
This is the script load header from default cacti tree view :
<script type="text/javascript" src="/cacti/include/layout.js"></script>
<script type="text/javascript" src="/cacti/include/js/jquery.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/js/jquery-ui.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/js/jquery.cookie.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/js/jstree.js"></script>
<script type="text/javascript" src="/cacti/include/js/jquery.zoom.js" language="javascript"></script>
<script type="text/javascript" src="/cacti/include/jscalendar/calendar.js"></script>
<script type="text/javascript" src="/cacti/include/jscalendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="/cacti/include/jscalendar/calendar-setup.js"></script>
http://forums.cacti.net/viewtopic.php?f=21&t=54754
2015/06/02
2015/05/17
ubuntu 目前預設都是使用unity 3d為預設桌面環境
但在顯示效能比較差的電腦上總是會有點lag的情況
若要轉回舊版桌面
要安裝
gnome-session-flashback
安裝後登出
在重新登入前按登入區塊右上角的ubuntu圖示就可以選擇不同的桌面環境
在此選擇 gnome flash back(metacity) 登入
若要在桌面上建立捷徑
在 /home/user/桌面 裡建立以下檔案 以terminator為例
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[zh_TW]=/home/user/icon/terminator_7302.png
Name[zh_TW]=terminator
Exec=/usr/share/terminator/terminator
Name=terminator
Icon=/home/user/icon/terminator_7302.png
若要再建立新的捷徑
只要複制檔案 再修改紅色地方即可 icon 要手動找一下
但在顯示效能比較差的電腦上總是會有點lag的情況
若要轉回舊版桌面
要安裝
gnome-session-flashback
安裝後登出
在重新登入前按登入區塊右上角的ubuntu圖示就可以選擇不同的桌面環境
在此選擇 gnome flash back(metacity) 登入
若要在桌面上建立捷徑
在 /home/user/桌面 裡建立以下檔案 以terminator為例
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[zh_TW]=/home/user/icon/terminator_7302.png
Name[zh_TW]=terminator
Exec=/usr/share/terminator/terminator
Name=terminator
Icon=/home/user/icon/terminator_7302.png
若要再建立新的捷徑
只要複制檔案 再修改紅色地方即可 icon 要手動找一下
2015/05/16
2015/05/15
5/13psad又有更新版本
上次2.4版時更新就有問題了
所以沒更新
今天想說再試看看
結果用tar.gz更新還是有問題
想說有提供rpm
所以重裝一台好了
放在centos7 x64上
使用rpm裝完沒問題
但systemctl start psad會起不來
用
journalctl -xn
找一下停在什麼地方
要補什麼東東
還要再加裝的有
perl-Data-Dumper.x86_64
psmisc.x86_64
mailx
iptables-devel.x86_64
perl-ExtUtils-MakeMaker.noarch
perl-NetAddr-IP.x86_64
perl-Date-Calc.noarch
perl-Sys-Syslog.x86_64
gcc
ntpdate
ftp
另外有几個沒有rpm
IPTables-ChainMgr-1.3
IPTables-Parse-1.4
Unix-Syslog-1.1
使用
perl Makefile.PL
make
make install
手動做
如果有缺什麼再補一下吧
log的格式沒有變
所以程式不用修改
最後把這個ip 在 firewall 完全開放
大家來攻吧!
ps
除了改/etc/psad/psad.conf外
記得在/etc/psad/auto_dl
加上內部的ip
不然log會收不完
上次2.4版時更新就有問題了
所以沒更新
今天想說再試看看
結果用tar.gz更新還是有問題
想說有提供rpm
所以重裝一台好了
放在centos7 x64上
使用rpm裝完沒問題
但systemctl start psad會起不來
用
journalctl -xn
找一下停在什麼地方
要補什麼東東
還要再加裝的有
perl-Data-Dumper.x86_64
psmisc.x86_64
mailx
iptables-devel.x86_64
perl-ExtUtils-MakeMaker.noarch
perl-NetAddr-IP.x86_64
perl-Date-Calc.noarch
perl-Sys-Syslog.x86_64
gcc
ntpdate
ftp
另外有几個沒有rpm
IPTables-ChainMgr-1.3
IPTables-Parse-1.4
Unix-Syslog-1.1
使用
perl Makefile.PL
make
make install
手動做
如果有缺什麼再補一下吧
log的格式沒有變
所以程式不用修改
最後把這個ip 在 firewall 完全開放
大家來攻吧!
ps
除了改/etc/psad/psad.conf外
記得在/etc/psad/auto_dl
加上內部的ip
不然log會收不完
2015/05/09
自從之前換isp升速後
發珼舊的ap及無線網卡沒法達到isp給的速度
所以買了新的ap (tp-link tl-wr740n)及asus n10 nano usb無線網卡
但因為使用原廠提供的linux driver一直無法使用
所以使用ndiswrapper掛載windows的driver來使用
但一直有動不動就斷線的困擾
今天再去查了一下
找到了一個方法
sudo apt-get install git
git clone https://github.com/pvaret/rtl8192cu-fixes.git
cd rtl8192cu-fixes
make
sudo make install
sudo modprobe 8192cu
使用改過的driver來編譯使用
目前還沒有問題
再試几天看看吧
發珼舊的ap及無線網卡沒法達到isp給的速度
所以買了新的ap (tp-link tl-wr740n)及asus n10 nano usb無線網卡
但因為使用原廠提供的linux driver一直無法使用
所以使用ndiswrapper掛載windows的driver來使用
但一直有動不動就斷線的困擾
今天再去查了一下
找到了一個方法
sudo apt-get install git
git clone https://github.com/pvaret/rtl8192cu-fixes.git
cd rtl8192cu-fixes
make
sudo make install
sudo modprobe 8192cu
使用改過的driver來編譯使用
目前還沒有問題
再試几天看看吧
2015/05/08
在 mail server的log裡發現
postfix/smtp[1921]: 347A79E0739: to=<abc@gmail.com>, orig_to=<abc@bbb.edu.tw>, relay=alt1.gmail-smtp-in.l.google.com[74.125.25.27]:25, delay=239783, delays=239779/0.04/2.6/0.84, dsn=4.7.0, status=deferred (host alt1.gmail-smtp-in.l.google.com[74.125.25.27] said: 421-4.7.0 [2.3.4.5 15] Our system has detected an unusual rate of 421-4.7.0 unsolicited mail originating from your IP address. To protect our 421-4.7.0 users from spam, mail sent from your IP address has been temporarily 421-4.7.0 rate limited. Please visit 421-4.7.0 http://www.google.com/mail/help/bulk_mail.html to review our Bulk 421 4.7.0 Email Senders Guidelines. d5si4976585pdi.47 - gsmtp (in reply to end of DATA command))
被google擋信了
查了一下google的網頁說明
有三個方式可以處理
最方便的是在DNS設定spf
;spf for google
bbb.edu.tw. 3600 IN TXT "v=spf1 ip4:2.3.4.5 include:_spf.google.com ~all"
設定後重啟DNS
等cache更新後就ok了
postfix/smtp[1921]: 347A79E0739: to=<abc@gmail.com>, orig_to=<abc@bbb.edu.tw>, relay=alt1.gmail-smtp-in.l.google.com[74.125.25.27]:25, delay=239783, delays=239779/0.04/2.6/0.84, dsn=4.7.0, status=deferred (host alt1.gmail-smtp-in.l.google.com[74.125.25.27] said: 421-4.7.0 [2.3.4.5 15] Our system has detected an unusual rate of 421-4.7.0 unsolicited mail originating from your IP address. To protect our 421-4.7.0 users from spam, mail sent from your IP address has been temporarily 421-4.7.0 rate limited. Please visit 421-4.7.0 http://www.google.com/mail/help/bulk_mail.html to review our Bulk 421 4.7.0 Email Senders Guidelines. d5si4976585pdi.47 - gsmtp (in reply to end of DATA command))
被google擋信了
查了一下google的網頁說明
有三個方式可以處理
最方便的是在DNS設定spf
;spf for google
bbb.edu.tw. 3600 IN TXT "v=spf1 ip4:2.3.4.5 include:_spf.google.com ~all"
設定後重啟DNS
等cache更新後就ok了
2015/05/05
2015/05/01
二套偵測硬碟老化及是否有壞軌的程式
http://hddguru.com/software/2005.10.02-MHDD/
燒成光碟開机
http://hddscan.com/
在win下執行
ubuntu 使用
sudo badblocks -nsv -c 1 /dev/sdb
http://hddguru.com/software/2005.10.02-MHDD/
燒成光碟開机
http://hddscan.com/
在win下執行
ubuntu 使用
sudo badblocks -nsv -c 1 /dev/sdb
2015/04/22
free WAF
for iis
http://www.iis.net/downloads/microsoft/urlscan
for apache
https://www.modsecurity.org/
for iis
http://www.iis.net/downloads/microsoft/urlscan
for apache
https://www.modsecurity.org/
原來使用的ultravnc SC都必須直接指定到固定机器上
最近有個需求
希望在校內各個地方都能連線user的電腦
就是說user及工程師的ip都不固定
想到使用 ultravnc的 repeater來做
流程如下
1. 找一台pc來執行 repeater
http://www.uvnc.com/downloads/repeater.html
使用預設值 執行後無須做任何修改
2. 修改原本使用的SC裡的helpdesk.txt
加上
[HOST]
any
-id 1234 -connect 10.0.0.1:5500
10.0.0.1為第1點執行repeater 的 pc ip
3. 工程師執行 vncviewer後 要連線的設定如下
或直接執行指令 vncviewer.exe ID:1234 -proxy 10.0.0.1:5901
10.0.0.1為 repeater 的ip
最近有個需求
希望在校內各個地方都能連線user的電腦
就是說user及工程師的ip都不固定
想到使用 ultravnc的 repeater來做
流程如下
1. 找一台pc來執行 repeater
http://www.uvnc.com/downloads/repeater.html
使用預設值 執行後無須做任何修改
2. 修改原本使用的SC裡的helpdesk.txt
加上
[HOST]
any
-id 1234 -connect 10.0.0.1:5500
10.0.0.1為第1點執行repeater 的 pc ip
3. 工程師執行 vncviewer後 要連線的設定如下
或直接執行指令 vncviewer.exe ID:1234 -proxy 10.0.0.1:5901
10.0.0.1為 repeater 的ip
2015/04/16
2015/04/10
word 20xx 持續出現錯誤 "........安裝軟體時 選擇不要安裝巨集........"
解決方法如下:
從 檔案→選項→信任中心→信任中心設定→增益集
勾選
停用所有應用程式增益集(可能影響功能)
http://answers.microsoft.com/zh-hant/office/forum/office_2010-word/word-2010/8e952bb9-ac1c-4ab1-b00a-9e1d96c9983c
解決方法如下:
從 檔案→選項→信任中心→信任中心設定→增益集
勾選
停用所有應用程式增益集(可能影響功能)
http://answers.microsoft.com/zh-hant/office/forum/office_2010-word/word-2010/8e952bb9-ac1c-4ab1-b00a-9e1d96c9983c
今天在安裝使用playonlinux
在裝完ie8後發現有很多字變成了方格
應該是因為安裝了英文版的IE
而且又沒有中文字型
所以找了一下解決的方法
1.
把/usr/share/fonts/truetype/wqy內的
wqy-microhei.ttc
cp 到
/home/abc/PlayOnLinux's virtual drives/InternetExplorer8/drive_c/windows/Fonts
2.建立f.reg
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="wqy-microhei.ttc"
"Microsoft Sans Serif"="wqy-microhei.ttc"
"MS Sans Serif"="wqy-microhei.ttc"
"Tahoma"="wqy-microhei.ttc"
"Tahoma Bold"="wqy-microhei.ttc"
"SimSun"="wqy-microhei.ttc"
"Arial"="wqy-microhei.ttc"
"Arial Black"="wqy-microhei.ttc"
3.
打開playonlinux 點選 配置
點選wine 註冊表編輯器
匯入之前建立的 f.reg
http://blog.csdn.net/LanderlYoung/article/details/12177091
在裝完ie8後發現有很多字變成了方格
應該是因為安裝了英文版的IE
而且又沒有中文字型
所以找了一下解決的方法
1.
把/usr/share/fonts/truetype/wqy內的
wqy-microhei.ttc
cp 到
/home/abc/PlayOnLinux's virtual drives/InternetExplorer8/drive_c/windows/Fonts
2.建立f.reg
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="wqy-microhei.ttc"
"Microsoft Sans Serif"="wqy-microhei.ttc"
"MS Sans Serif"="wqy-microhei.ttc"
"Tahoma"="wqy-microhei.ttc"
"Tahoma Bold"="wqy-microhei.ttc"
"SimSun"="wqy-microhei.ttc"
"Arial"="wqy-microhei.ttc"
"Arial Black"="wqy-microhei.ttc"
3.
打開playonlinux 點選 配置
點選wine 註冊表編輯器
匯入之前建立的 f.reg
http://blog.csdn.net/LanderlYoung/article/details/12177091
2015/04/09
2015/03/25
2015/03/20
2015/03/16
psad 之前每次都隔好久才更新
昨天上去看
2015就更新了二次
版本已經到 2.2.5了
Added signature to detect fwknop Single Packet Authorization (SPA)
packets that are destined to the default UDP port 62201
看change log好像在這個月 2015/3還會到 2.2.6
還是先更新一下
log的格式沒變,所以程式不用改
另外psad的log已經獨立出來放在/var/log/psad
有滿詳細的資料 要鎖ip可以直接到這裡捉就好了
不過程式先不改
但 2.2.6出來再看看
https://cipherdyne.org/psad/download/
昨天上去看
2015就更新了二次
版本已經到 2.2.5了
Added signature to detect fwknop Single Packet Authorization (SPA)
packets that are destined to the default UDP port 62201
看change log好像在這個月 2015/3還會到 2.2.6
還是先更新一下
log的格式沒變,所以程式不用改
另外psad的log已經獨立出來放在/var/log/psad
有滿詳細的資料 要鎖ip可以直接到這裡捉就好了
不過程式先不改
但 2.2.6出來再看看
https://cipherdyne.org/psad/download/
2015/03/10
2015/03/09
一直都是在user 的.profile把mail forward到gmail去
可是最近突然發現有些mail沒收到
check了一下mail log
發現以下的訊息
Mar 6 16:48:26 mail postfix/smtp[31508]: 206879E074E: to=<test@staff.edu.tw>, orig_to=<test2@mail.edu.tw>, relay=ASPMX.L.GOOGLE.COM[74.125.23.26]:25, delay=2, delays=0.01/0.01/0.54/1.4, dsn=5.7.1, status=bounced (host ASPMX.L.GOOGLE.COM[74.125.23.26] said: 550-5.7.1 [1.1.1.1 12] Our system has detected that this message is 550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message has been blocked. Please visit 550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&answer=188131 for 550 5.7.1 more information. x1si13668566pdp.46 - gsmtp (in reply to end of DATA command))
居然被google視為spam而擋了
找了一下解決方法有三個 SPF DKIM DMARC
最快的是設定SPF
https://support.google.com/a/answer/178723?hl=zh-Hant
參考以下資料設定完成後
http://www.icst.org.tw/ArticlesDetail.aspx?seq=1351&lang=zh
目前沒有再出現被擋的訊息了
持續觀察中
不知道是不是太多人設forward了
XD
可是最近突然發現有些mail沒收到
check了一下mail log
發現以下的訊息
Mar 6 16:48:26 mail postfix/smtp[31508]: 206879E074E: to=<test@staff.edu.tw>, orig_to=<test2@mail.edu.tw>, relay=ASPMX.L.GOOGLE.COM[74.125.23.26]:25, delay=2, delays=0.01/0.01/0.54/1.4, dsn=5.7.1, status=bounced (host ASPMX.L.GOOGLE.COM[74.125.23.26] said: 550-5.7.1 [1.1.1.1 12] Our system has detected that this message is 550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message has been blocked. Please visit 550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&answer=188131 for 550 5.7.1 more information. x1si13668566pdp.46 - gsmtp (in reply to end of DATA command))
居然被google視為spam而擋了
找了一下解決方法有三個 SPF DKIM DMARC
最快的是設定SPF
https://support.google.com/a/answer/178723?hl=zh-Hant
參考以下資料設定完成後
http://www.icst.org.tw/ArticlesDetail.aspx?seq=1351&lang=zh
目前沒有再出現被擋的訊息了
持續觀察中
不知道是不是太多人設forward了
XD
2015/02/20
之前有介紹過 mobaxterm 在win下非常方便好用的工具
如果在linux 的 x-win 下要下指令到多個terminal要怎麼辦呢?
找到了 terminator 相當方便
apt-get install terminator 就可以使用了
第一次執行時會發現有些字重疊在一起了
要改字体來解決這個問題
在視窗內按右鍵-偏好設定裡把字型設為 ubuntu mono 就可以了
(如果還有問題再換其他字体看看)
以下是相關的快速鍵整理
Ctrl + Shift + t 開新 Tab
Ctrl-Shift-E: 新增terminal並垂直切割
Ctrl-Shift-O: 新增terminal並水平切割
Ctrl-Shift-P: 回到上一個terminal
Ctrl-Shift-N: 至下一個terminal
Ctrl-Shift-W: 關閉目前的terminal
Ctrl-Shift-Q: 結束terminator
F11: 全螢幕顯示
ctrl+tab為在分割畫面間切換
ctrl+shift+c 把圈選部份copy
ctrl+shift+v paste
ctrl+shift+上下左右鍵 調整分割畫面範圍
ctrl+shift+x 為將目前分割畫面放大
http://forum.ubuntu.com.cn/viewtopic.php?f=48&t=464295&p=3106293
http://anemospring.blogspot.tw/2009/08/shell-terminator.html
第一次執行時會發現有些字重疊在一起了
要改字体來解決這個問題
在視窗內按右鍵-偏好設定裡把字型設為 ubuntu mono 就可以了
(如果還有問題再換其他字体看看)
以下是相關的快速鍵整理
Ctrl + Shift + t 開新 Tab
Ctrl-Shift-E: 新增terminal並垂直切割
Ctrl-Shift-O: 新增terminal並水平切割
Ctrl-Shift-P: 回到上一個terminal
Ctrl-Shift-N: 至下一個terminal
Ctrl-Shift-W: 關閉目前的terminal
Ctrl-Shift-Q: 結束terminator
F11: 全螢幕顯示
ctrl+tab為在分割畫面間切換
ctrl+shift+c 把圈選部份copy
ctrl+shift+v paste
ctrl+shift+上下左右鍵 調整分割畫面範圍
ctrl+shift+x 為將目前分割畫面放大
http://forum.ubuntu.com.cn/viewtopic.php?f=48&t=464295&p=3106293
http://anemospring.blogspot.tw/2009/08/shell-terminator.html
2015/02/12
接連碰到几台机器在設定完bios的定時開機後都無法正常開機
於是上網找了一下
linux本身就支援定時開機的功能了
設定上也不複雜
但就是每次開完機就要設定一次
不過也還好
放在/etc/rc.local就好了
有几個地方要注意
1. /etc/default/rcS
UTC=yes
2. 再來檢查二個地方
cat /sys/class/rtc/rtc0/wakealarm
cat /proc/driver/rtc
設定明天早上八點三十分自動開機(這個不需要推算utc時間)
設定後再次檢查看看上述的二個檔案是否正常
cat /sys/class/rtc/rtc0/wakealarm
要有值
cat /proc/driver/rtc
http://jamyy.us.to/blog/2012/12/4259.html
http://www.linux.com/learn/docs/672849-wake-up-linux-with-an-rtc-alarm-clock
http://guildwar23.blogspot.tw/2013/02/linux.html
於是上網找了一下
linux本身就支援定時開機的功能了
設定上也不複雜
但就是每次開完機就要設定一次
不過也還好
放在/etc/rc.local就好了
有几個地方要注意
1. /etc/default/rcS
UTC=yes
2. 再來檢查二個地方
cat /sys/class/rtc/rtc0/wakealarm
cat /proc/driver/rtc
設定明天早上八點三十分自動開機(這個不需要推算utc時間)
echo 0 > /sys/class/rtc/rtc0/wakealarmdate +%s --date 'tomorrow 8:30 am' > /sys/class/rtc/rtc0/wakealarm
設定後再次檢查看看上述的二個檔案是否正常
cat /sys/class/rtc/rtc0/wakealarm
要有值
cat /proc/driver/rtc
要看到
alarm_IRQ : yes
http://www.linux.com/learn/docs/672849-wake-up-linux-with-an-rtc-alarm-clock
http://guildwar23.blogspot.tw/2013/02/linux.html
2015/02/09
在cisco的設備設定完dhcp snooping及arp inspection後
如果要針對某些ip例外開放
必須使用arp access-list
arp access-list static-arp
permit ip host 1.1.1.1 mac host 0000.1234.5678
在把這個access-list 下到vlan上去
但在brocade fws624 上就不用這麼麻煩
只要在config裡下一行指令就解決了
arp 1.1.1.1 0000.1234.5678 inspect
接下來再port security這裡加上 maxmum
如果不加 預設每個port 只能出現一個mac
加上後才能允許多個mac出現(在下串小switch的情況下)
port security
enable
maximum 5
violation restrict
age 1
如果要針對某些ip例外開放
必須使用arp access-list
arp access-list static-arp
permit ip host 1.1.1.1 mac host 0000.1234.5678
在把這個access-list 下到vlan上去
但在brocade fws624 上就不用這麼麻煩
只要在config裡下一行指令就解決了
arp 1.1.1.1 0000.1234.5678 inspect
接下來再port security這裡加上 maxmum
如果不加 預設每個port 只能出現一個mac
加上後才能允許多個mac出現(在下串小switch的情況下)
port security
enable
maximum 5
violation restrict
age 1
2015/02/04
2015/01/09
近來linux把network的設定改用NetworkManager來操作
在x-win上有圖形介面的工具可以使用
而命令列的指令為nmcli
命令 作用
nmcli dev status 列出设备(状态)
nmcli con show 显示当前连接信息
nmcli con up "连接名" 启动一个连接
nmcli con down "连接名" 关闭一个连接;如果这个连接设置了autoconnect,那么关闭后这个连接会重启
nmcli dev dis 设备 关闭这个网卡设备,就算有autoconnect也不会重启
nmcli net off 关闭所有受NetworkManager管理的网卡
nmcli con add con-name ens6 type ethernet ifname ens6 增加一个连接
nmcli con mod "连接名" 修改一个连接
nmcli con del "连接名" 删除一个连接
http://feichashao.com/nmcli/
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Using_the_NetworkManager_Command_Line_Tool_nmcli.html
PS. 目前還是找不到這個指令更改的config file是在那裡
在x-win上有圖形介面的工具可以使用
而命令列的指令為nmcli
命令 作用
nmcli dev status 列出设备(状态)
nmcli con show 显示当前连接信息
nmcli con up "连接名" 启动一个连接
nmcli con down "连接名" 关闭一个连接;如果这个连接设置了autoconnect,那么关闭后这个连接会重启
nmcli dev dis 设备 关闭这个网卡设备,就算有autoconnect也不会重启
nmcli net off 关闭所有受NetworkManager管理的网卡
nmcli con add con-name ens6 type ethernet ifname ens6 增加一个连接
nmcli con mod "连接名" 修改一个连接
nmcli con del "连接名" 删除一个连接
http://feichashao.com/nmcli/
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Using_the_NetworkManager_Command_Line_Tool_nmcli.html
PS. 目前還是找不到這個指令更改的config file是在那裡
在asus vm40B 上裝好 xubuntu 14.04 x64 後一直出現以下的log
Jan 9 08:56:25 vod-VM40B kernel: [10567.759358] rtl8821ae-0:rtl_is_special_data():<10000-1> dhcp Rx !!
Jan 9 08:56:25 vod-VM40B kernel: [10567.860612] rtl8821ae-0:rtl_is_special_data():<10000-1> dhcp Rx !!
Jan 9 08:56:26 vod-VM40B kernel: [10568.475362] rtl8821ae-0:rtl_is_special_data():<10000-1> dhcp Rx !!
查了一下google看來是wireless driver的問題
Jan 9 08:56:25 vod-VM40B kernel: [10567.759358] rtl8821ae-0:rtl_is_special_data():<10000-1> dhcp Rx !!
Jan 9 08:56:25 vod-VM40B kernel: [10567.860612] rtl8821ae-0:rtl_is_special_data():<10000-1> dhcp Rx !!
Jan 9 08:56:26 vod-VM40B kernel: [10568.475362] rtl8821ae-0:rtl_is_special_data():<10000-1> dhcp Rx !!
查了一下google看來是wireless driver的問題
先把wireless關了
反正目前用不到
2015/01/07
2015/01/05
2014/12/28
2014/12/25
自從使用ubuntu後一直在找方便的倉頡輸入法
最近因為電子看板的問題把之前測過的東西再拿出來
因為vnc及unity的問題選擇了xubuntu
雖然電子看板不需要使用到中文環境
但考慮到再來換新機器時也想用xubuntu來當桌面
所以測了一下中文
發現即使安裝時選擇中文
但xubuntu並不會把輸入法裝進去
必須手動安裝
同時也找到了一個方便的輸入法
快倉第六代
而且套件庫內就直接收錄了
sudo apt-get ibus-table-scj6 就OK了
記得要重開機
再從設定裡選擇
把之前安裝過有關倉頡的其他輸入法全移除了
按Shift就可以中英切換 不需再用ctrl-space切好几次了
首+尾+z 就可以當成簡易輸入法來使用
最近因為電子看板的問題把之前測過的東西再拿出來
因為vnc及unity的問題選擇了xubuntu
雖然電子看板不需要使用到中文環境
但考慮到再來換新機器時也想用xubuntu來當桌面
所以測了一下中文
發現即使安裝時選擇中文
但xubuntu並不會把輸入法裝進去
必須手動安裝
同時也找到了一個方便的輸入法
快倉第六代
而且套件庫內就直接收錄了
sudo apt-get ibus-table-scj6 就OK了
記得要重開機
再從設定裡選擇
把之前安裝過有關倉頡的其他輸入法全移除了
按Shift就可以中英切換 不需再用ctrl-space切好几次了
首+尾+z 就可以當成簡易輸入法來使用
2014/12/21
在win中使用python
利用subprocess.call呼叫系統指令時
若指令的最後是反斜號 "\"
import subprocess
subprocess.call('dir e:\',shell=True)
會造成以下的錯誤
c:\Python27\python.exe -u "C:\Users\nkhc\Desktop\1.py"
Process started >>>
File "C:\Users\nkhc\Desktop\1.py", line 9
subprocess.call('dir e:\',shell=True)
^
SyntaxError: EOL while scanning string literal
<<< Process finished. (Exit code 1)
================ READY ================
利用subprocess.call呼叫系統指令時
若指令的最後是反斜號 "\"
import subprocess
subprocess.call('dir e:\',shell=True)
會造成以下的錯誤
c:\Python27\python.exe -u "C:\Users\nkhc\Desktop\1.py"
Process started >>>
File "C:\Users\nkhc\Desktop\1.py", line 9
subprocess.call('dir e:\',shell=True)
^
SyntaxError: EOL while scanning string literal
<<< Process finished. (Exit code 1)
================ READY ================
解決方式
subprocess.call('dir e:\\',shell=True)
2014/12/16
最近有個需求就是要讓pc在每天早上自動開机
所以必需要在bios裡設定
發現几個狀況
做個記錄
1. 定時開机在有些bios裡預設是disable 要enable才能看得到來設定
2. bios的時間如果經過os去設定(hwclock -w)
有些會記錄GMT時間 有些則會記錄os的local 時間
所以要設定定時開机時要注意一下時間差
3. 因為以上的原因 所以在os裡用 hwclock -r 取得硬体的時間也有可能跟os不同
經由hwclock取得的時間os會認為是GMT時間後 再經過計算後顯示出os的local 時間
以台灣為例,如果bios記錄的時間是local時間 則hwclock -r 顯示出來的時間就會是local時間再加8小時;如果bios記錄的時間是GMT時間 則hwclock -r 顯示出來的時間就會是os的locl時間
無論如何 bios的自動開机時間是以bios的時間為準 在設定時要特別注意
所以必需要在bios裡設定
發現几個狀況
做個記錄
1. 定時開机在有些bios裡預設是disable 要enable才能看得到來設定
2. bios的時間如果經過os去設定(hwclock -w)
有些會記錄GMT時間 有些則會記錄os的local 時間
所以要設定定時開机時要注意一下時間差
3. 因為以上的原因 所以在os裡用 hwclock -r 取得硬体的時間也有可能跟os不同
經由hwclock取得的時間os會認為是GMT時間後 再經過計算後顯示出os的local 時間
以台灣為例,如果bios記錄的時間是local時間 則hwclock -r 顯示出來的時間就會是local時間再加8小時;如果bios記錄的時間是GMT時間 則hwclock -r 顯示出來的時間就會是os的locl時間
無論如何 bios的自動開机時間是以bios的時間為準 在設定時要特別注意
2014/12/11
2014/11/28
最近在找 ubuntu中 如何讓一般user可以下指令 reboot
找到以下資料
很方便
但看來有點危險
使用下列指令
sudo vi /etc/sudoers
或
sudo visudo
就是去編輯設定檔。
將這行
%sudo ALL=(ALL:ALL) ALL
改成
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
https://www.mxp.tw/2014/06/25/ubuntu-sudo-nopasswd-%E4%B8%8D%E7%94%A8%E8%BC%B8%E5%85%A5%E5%AF%86%E7%A2%BC%E8%A8%AD%E5%AE%9A/
找到以下資料
很方便
但看來有點危險
使用下列指令
sudo vi /etc/sudoers
或
sudo visudo
就是去編輯設定檔。
將這行
%sudo ALL=(ALL:ALL) ALL
改成
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
https://www.mxp.tw/2014/06/25/ubuntu-sudo-nopasswd-%E4%B8%8D%E7%94%A8%E8%BC%B8%E5%85%A5%E5%AF%86%E7%A2%BC%E8%A8%AD%E5%AE%9A/
2014/11/22
2014/11/10
2014/11/09
2014/10/28
2014/10/24
2014/10/14
cisco 6504 supervisor 2T 掛點
什麼東西都會壞
http://www.cisco.com/c/en/us/products/interfaces-modules/catalyst-6500-series-supervisor-engine-2t/index.html
什麼東西都會壞
http://www.cisco.com/c/en/us/products/interfaces-modules/catalyst-6500-series-supervisor-engine-2t/index.html
2014/10/07
目前比較新的switch都提供Time-Domain-Reflectometry(tdr)的功能
以方便管理人員可以初步由switch端回測到outlet
方便layer 1的查修
指令如下
cisco
#test cable tdr interface <interface of your choice>
Wait 5-7 seconds
#show cable tdr interface <interface of your choice>
brocade
#phy cable-diag tdr 1/1/1
Wait 5-7 seconds
以下列出 brocade在有接client及未接client顯示出的結果
未接client
Port Speed Local pair Pair Length Remote pair Pair status
---- ----- ---------- ----------- ----------- -----------
0/1/2 UNKWN Pair A 0000081M Open
Pair B 0000084M Open
Pair C 0000084M Open
Pair D 0000080M Open
有接client
Port Speed Local pair Pair Length Remote pair Pair status
---- ----- ---------- ----------- ----------- -----------
0/1/1 100M Pair A N/A M Pair B Terminated
Pair B N/A M Pair A Terminated
Pair C 0000076M Shorted
Pair D 0000072M Shorted
以方便管理人員可以初步由switch端回測到outlet
方便layer 1的查修
指令如下
cisco
#test cable tdr interface <interface of your choice>
Wait 5-7 seconds
#show cable tdr interface <interface of your choice>
brocade
#phy cable-diag tdr 1/1/1
Wait 5-7 seconds
#show cable-diag tdr 1/1/1
以下列出 brocade在有接client及未接client顯示出的結果
未接client
Port Speed Local pair Pair Length Remote pair Pair status
---- ----- ---------- ----------- ----------- -----------
0/1/2 UNKWN Pair A 0000081M Open
Pair B 0000084M Open
Pair C 0000084M Open
Pair D 0000080M Open
有接client
Port Speed Local pair Pair Length Remote pair Pair status
---- ----- ---------- ----------- ----------- -----------
0/1/1 100M Pair A N/A M Pair B Terminated
Pair B N/A M Pair A Terminated
Pair C 0000076M Shorted
Pair D 0000072M Shorted
2014/09/29
今天發現了二個notepad++上好用的plugin
nppftp及python with notepad++
超方便
http://kilfu0701.blogspot.tw/2011/03/python-with-notepad.html
2014/09/25
最近因為原isp已到期
加上每次一到晚上都會感到不順
另外就是女王一直要求要把ap從小孩的房間移到客廳
所以決定換另一家isp
速度加快到40M價格沒變
但換了之後問題來了
直接使用網路線測試時可以到逹40M沒錯
但如果使用原來的ap就只能到20M左右
而原來的ap只支援到 802.11g 理論上是54M
但理論值跟實際上總是有點差距
所以去買了一台新的ap
考量到價位及未來使用
應該不需要使用到雙頻或到300M
所以買了一台 150M bgn的机器
但買完後問題來了
原來在pc上使用的那支網卡
也只支援11g 在不跑wpa2的情況下跟tplink也只能到 20M
如果ap把wpa2打開
則是完全連不上
看來不換也不行了
所以又去選了一支asus usb-n10 nano
因為查了滿多資料
而且網站上有直接提供linux的driver
應該很好處理
想不到東西寄來
使用原來linux安裝就有的rtl 8192c的module
完全沒作用
再使用網站上的driver
也不行
還導致開机出現問題
連su到root都不行
沒辦法了
只好抱著死馬當活馬醫的想法再使用ndiswrapper
試了半天
網站上提供的vista win7 win8的driver
都不能用
只有xp 沒問題
好吧
跑了一下測試
wpa2沒問題
速度也到達到40M
就醬用吧
本來是想要退貨的
另外一個小問題就是ndiswrapper不知為什麼竟然無法在開机時自動啟到
只要再加到/etc/rc.local
/sbin/modprobe ndiswrapper
再觀察看看囉
標籤:
asus,
asus usb-N10 nano,
linux,
ndiswrapper,
rtl 8192c,
tp-link,
ubuntu 14.04,
wpa,
wpa2
2014/09/18
2014/09/16
2014/09/12
2014/09/02
centos 7 /etc/rc.local開机不會執行
要把 /etc/rc.d/rc.local加上執行的權限
chmod 755 /etc/rc.d/rc.local
2014/09/01
centos mysql安裝好要做的几個動作
修改MySQL root 的密碼
# mysqladmin -u root password '12345678'
登入MySQL
# mysql -u root -p
刪除匿名帳戶
mysql> DELETE FROM mysql.user WHERE user="";
重載權限
mysql> FLUSH PRIVILEGES;
mysql> quit
設定my.cnf
# vi /etc/my.cnf
在[mysqld] 新增
default-storage-engine=innodb
character-set-server=utf8
port=3306
新增[client]
default-character-set=utf8
修改MySQL root 的密碼
# mysqladmin -u root password '12345678'
登入MySQL
# mysql -u root -p
刪除匿名帳戶
mysql> DELETE FROM mysql.user WHERE user="";
重載權限
mysql> FLUSH PRIVILEGES;
mysql> quit
設定my.cnf
# vi /etc/my.cnf
在[mysqld] 新增
default-storage-engine=innodb
character-set-server=utf8
port=3306
新增[client]
default-character-set=utf8
2014/08/23
2014/08/15
2014/08/14
hp的virtual store竟然無法在多台proxmox的情況下作業
會造成host os的down g
目前已詢問原廠是否有解決方案
考慮最差的情況應該就是拿一台机器把iscsi捉進來
再用nfs share出來了
因為容量超過2T所以必須使用之前的方法來處理
另外mount -t xfs /dev/sdb1 /mnt這個動作如果寫在/etc/rc.local
會因為執行太早網路還沒起來而無法成功
因此使用另一個方法
把開机後執行的指令放到crontab 裡
@reboot /root/0814test
0814test的內容如下
#!/bin/bash
/usr/bin/sleep 10
/usr/bin/mount -t xfs /dev/sdb1 /mnt
目前測起來工作是正常
只是nfs如果斷線重連
guest os還是有可能有問題需要重開
跟之前的預期有落差
會造成host os的down g
目前已詢問原廠是否有解決方案
考慮最差的情況應該就是拿一台机器把iscsi捉進來
再用nfs share出來了
因為容量超過2T所以必須使用之前的方法來處理
另外mount -t xfs /dev/sdb1 /mnt這個動作如果寫在/etc/rc.local
會因為執行太早網路還沒起來而無法成功
因此使用另一個方法
把開机後執行的指令放到crontab 裡
@reboot /root/0814test
0814test的內容如下
#!/bin/bash
/usr/bin/sleep 10
/usr/bin/mount -t xfs /dev/sdb1 /mnt
目前測起來工作是正常
只是nfs如果斷線重連
guest os還是有可能有問題需要重開
跟之前的預期有落差
2014/07/29
不久前有個朋友來電求救
問題狀況是之前幫他架的proxmox裡的guest
主要服務是mail及dns
只要一開机
所有的網路就動不了
他懷疑是不是主机被hack了
但因為只要一開机網路就死了
所以在想要怎麼連進去
最後請他先把guest關机
讓我能進到proxmox的管理介面先把guest的網卡停掉
再把guest boot
初步看了一下
並沒有看到被hack的情況
接下來把網卡enable
在rc.local加上
iptables -I OUTPUT -j DROP
reboot把網卡起起來
用tcpdump看到好多來自某個subnet ip的request
dos攻擊沒錯了
一樣用iptables在input擋掉
再把之前加的OUTPUT拿掉
恢復正常
目前就先醬
如果攻擊者換了subnet就再說了
但一個小公司
怎麼會有人無聊到dos port 53
不解
總結
1. 先drop output packet
2. 使tcpdump看 input packet
3. 決定對策
問題狀況是之前幫他架的proxmox裡的guest
主要服務是mail及dns
只要一開机
所有的網路就動不了
他懷疑是不是主机被hack了
但因為只要一開机網路就死了
所以在想要怎麼連進去
最後請他先把guest關机
讓我能進到proxmox的管理介面先把guest的網卡停掉
再把guest boot
初步看了一下
並沒有看到被hack的情況
接下來把網卡enable
在rc.local加上
iptables -I OUTPUT -j DROP
reboot把網卡起起來
用tcpdump看到好多來自某個subnet ip的request
dos攻擊沒錯了
一樣用iptables在input擋掉
再把之前加的OUTPUT拿掉
恢復正常
目前就先醬
如果攻擊者換了subnet就再說了
但一個小公司
怎麼會有人無聊到dos port 53
不解
總結
1. 先drop output packet
2. 使tcpdump看 input packet
3. 決定對策
2014/07/28
2014/07/26
2014/07/12
不知道從那天開始
整個ubuntu的字變的怪怪的
所以一直想調整的好看一點
找了許多資料
找到了以下的文章
簡單整理一下
先下載lihei pro字型
再解壓到/usr/share/fonts/truetype/
執行 fc-cache -v -f 讓系統重捉字型
安裝系統字型設定工具
apt-get install gnome-tweak-tool
接下來執行
gnome-tweak-tool
就可以選取li hei pro 做為系統預設字型了
chrome和firefox再分別修改
2014/07/09
不知道為什麼原來安裝在centos6 x64裡的openvas rule不能更新也不能scan了
花了不少時間找問題
但還是沒辦法處理
最後決定放棄重裝
依照原廠網站的方法
一次就ok了
目前還是使用v6的版本 因為v7還沒有人做出package
但有個問題就是開机時port 9392是有起來的
但連進9392 port時就掛了
在log上看到的訊息如下
gsad main:WARNING:2014-07-08 17h33.31 utc:1051: MHD: Failed to receive data: The TLS connection was non-properly terminated.
看起來是https有問題
再找了一下資料
把預設的https改成http
vi /etc/init.d/gsad
找到 daemon $EXEC #PARAMS
改成如下
daemon $EXEC #PARAMS "--http-only" > 補上 --http-only 即可
service gsad restart
目前運作正常
http://www.i-uix.com/kevin/centos6-5%E5%AE%89%E8%A3%9Dopenvas/
花了不少時間找問題
但還是沒辦法處理
最後決定放棄重裝
依照原廠網站的方法
一次就ok了
目前還是使用v6的版本 因為v7還沒有人做出package
但有個問題就是開机時port 9392是有起來的
但連進9392 port時就掛了
在log上看到的訊息如下
gsad main:WARNING:2014-07-08 17h33.31 utc:1051: MHD: Failed to receive data: The TLS connection was non-properly terminated.
看起來是https有問題
再找了一下資料
把預設的https改成http
vi /etc/init.d/gsad
找到 daemon $EXEC #PARAMS
改成如下
daemon $EXEC #PARAMS "--http-only" > 補上 --http-only 即可
service gsad restart
目前運作正常
http://www.i-uix.com/kevin/centos6-5%E5%AE%89%E8%A3%9Dopenvas/
2014/05/28
最近這几天一直收到由proxmox寄出的訊息
如下
/etc/cron.daily/mlocate:
Warning: /var/lib/mlocate/daily.lock present, not running updatedb.
run-parts: /etc/cron.daily/mlocate exited with return code 1
查了一下才知道這個訊息跟nfs有關
http://jonmccune.wordpress.com/2010/08/11/warning-varlibmlocatedaily-lock-present-not-running-today/
想到前几天才把一台nfs下架
雖然在/etc/pve/storage.cfg裡已經update了
但/etc/mtab還沒清掉
難怪這几天下df指令會一直hang住
如下
/etc/cron.daily/mlocate:
Warning: /var/lib/mlocate/daily.lock present, not running updatedb.
run-parts: /etc/cron.daily/mlocate exited with return code 1
查了一下才知道這個訊息跟nfs有關
http://jonmccune.wordpress.com/2010/08/11/warning-varlibmlocatedaily-lock-present-not-running-today/
想到前几天才把一台nfs下架
雖然在/etc/pve/storage.cfg裡已經update了
但/etc/mtab還沒清掉
難怪這几天下df指令會一直hang住
只好手動強制umount
umount -f /mnt/pve/nfs_bck
再看一下/etc/mtab已經正常了
df的指令也正常
再觀察看看今天還會不會收到訊息
2014/05/21
昨天中午停電
關掉了几台proxmox
想不到晚上的備份竟然停了
出現以下的error
INFO: starting new backup job: vzdump 115 --remove 0 --mode snapshot --storage nfs6_bck --node proxmox76
INFO: Starting Backup of VM 115 (qemu)
INFO: status = running
INFO: unable to open file '/etc/pve/nodes/proxmox76/qemu-server/115.conf.tmp.191828' - Permission denied
INFO: update VM 115: -lock backup
ERROR: Backup of VM 115 failed - command 'qm set 115 --lock backup' failed: exit code 2
INFO: Backup job finished with errors
TASK ERROR: job errors
早上把所有机器打開,再手動備一次
就ok了
今天晚上再觀察看看
關掉了几台proxmox
想不到晚上的備份竟然停了
出現以下的error
INFO: starting new backup job: vzdump 115 --remove 0 --mode snapshot --storage nfs6_bck --node proxmox76
INFO: Starting Backup of VM 115 (qemu)
INFO: status = running
INFO: unable to open file '/etc/pve/nodes/proxmox76/qemu-server/115.conf.tmp.191828' - Permission denied
INFO: update VM 115: -lock backup
ERROR: Backup of VM 115 failed - command 'qm set 115 --lock backup' failed: exit code 2
INFO: Backup job finished with errors
TASK ERROR: job errors
早上把所有机器打開,再手動備一次
就ok了
今天晚上再觀察看看
2014/05/20
2014/05/15
今天又有user反應校外不能寄信的問題
參考了一下這篇
設定完成後
不管校內校外都不能發信了
看了一下log
fatal: no SASL authentication mechanisms
warning: xsasl_cyrus_server_get_mechanism_list: no applicable SASL mechanisms
參考以下連結
http://www.electrictoolbox.com/postfix-smtp-auth-no-sasl-authentication-mechanisms/
發現還要裝上 cyrus-sasl-plain 才能用
yum install cyrus-sasl-plain
參考了一下這篇
設定完成後
不管校內校外都不能發信了
看了一下log
fatal: no SASL authentication mechanisms
warning: xsasl_cyrus_server_get_mechanism_list: no applicable SASL mechanisms
參考以下連結
http://www.electrictoolbox.com/postfix-smtp-auth-no-sasl-authentication-mechanisms/
發現還要裝上 cyrus-sasl-plain 才能用
yum install cyrus-sasl-plain
2014/05/13
2014/04/21
2014/04/20
2014/04/18
今天是ubuntu 14.04 release的日子
一開始upgrade時總是有三個檔案有問題
後來把source改到米國就ok了
但升完smokeping卻發生圖出不來的問題
查了一下rrd都有正常update
原來是apache2的升級把smokeping的site砍了
補回去
ln -s /etc/apache2/sites-enabled/smokeping.conf /etc/smokeping/apache2.conf
service apache2 restart
恢復正常
http://askubuntu.com/questions/365088/smokeping-web-front-end-on-ubuntu-13-10
一開始upgrade時總是有三個檔案有問題
後來把source改到米國就ok了
但升完smokeping卻發生圖出不來的問題
查了一下rrd都有正常update
原來是apache2的升級把smokeping的site砍了
補回去
ln -s /etc/apache2/sites-enabled/smokeping.conf /etc/smokeping/apache2.conf
service apache2 restart
恢復正常
http://askubuntu.com/questions/365088/smokeping-web-front-end-on-ubuntu-13-10
2014/03/31
crontab 預設最小的單位是分,如果需要crontab以秒執行,則可以這樣做~~
以下方法將每15秒執行一次
1.編輯crontab
# crontab -e
QUOTE:
* * * * * /bin/date >>/tmp/date.txt
* * * * * sleep 15; /bin/date >>/tmp/date.txt
* * * * * sleep 30; /bin/date >>/tmp/date.txt
* * * * * sleep 45; /bin/date >>/tmp/date.txt
2.檢查結果
# tail -f /tmp/date.txt
說明:需要將 /bin/date 更換成你的命令即可
================================================
如果需要精確到每秒執行一次...則可以寫Shell 的方式運作
1.編寫shell腳本
# mkdir /root/bin
# vi /root/bin/time.sh
QUOTE:
#!/bin/sh
while [ true ]; do
/bin/sleep 1
/bin/date >>/tmp/date.txt
done
2.後台運行
# nohup /root/bin/time.sh &
3.確認每秒執行
# tail -f /tmp/date.txt
http://www.adj.idv.tw/html/32/t-76632.html
以下方法將每15秒執行一次
1.編輯crontab
# crontab -e
QUOTE:
* * * * * /bin/date >>/tmp/date.txt
* * * * * sleep 15; /bin/date >>/tmp/date.txt
* * * * * sleep 30; /bin/date >>/tmp/date.txt
* * * * * sleep 45; /bin/date >>/tmp/date.txt
2.檢查結果
# tail -f /tmp/date.txt
說明:需要將 /bin/date 更換成你的命令即可
================================================
如果需要精確到每秒執行一次...則可以寫Shell 的方式運作
1.編寫shell腳本
# mkdir /root/bin
# vi /root/bin/time.sh
QUOTE:
#!/bin/sh
while [ true ]; do
/bin/sleep 1
/bin/date >>/tmp/date.txt
done
2.後台運行
# nohup /root/bin/time.sh &
3.確認每秒執行
# tail -f /tmp/date.txt
http://www.adj.idv.tw/html/32/t-76632.html
2014/03/29
2014/03/25
2014/03/23
一直以來user打電話來詢問網路狀況的時候都會先到splunk去查帳號跟ip 的對應
之後到到LP去查詢該ip 是否被block
但必須要進二個系統去查
有點麻煩
今天在想有沒辦法直接在splunk就可以查到所有的資料
因此必須把lp上的資料丟到splunk上
程式如下
#!/usr/bin/python
import MySQLdb,sys
db = MySQLdb.connect(host="localhost", user="root", passwd="123456", db="test")
cursor = db.cursor()
#cursor.execute("select StartTime,SourceHost,Cause,ReleaseTime from BlockItem order by StartTime")
cursor.execute("select StartTime,SourceHost,Cause,ReleaseTime from BlockItem where StartTime between date_add(now(), interval - 5 minute) and now()")
result = cursor.fetchall()
if result:
for record in result:
print record[0],
print "ip=",
sys.stdout.softspace=0
print record[1],
print record[2],
print record[3]
db.close()
之後到到LP去查詢該ip 是否被block
但必須要進二個系統去查
有點麻煩
今天在想有沒辦法直接在splunk就可以查到所有的資料
因此必須把lp上的資料丟到splunk上
程式如下
#!/usr/bin/python
import MySQLdb,sys
db = MySQLdb.connect(host="localhost", user="root", passwd="123456", db="test")
cursor = db.cursor()
#cursor.execute("select StartTime,SourceHost,Cause,ReleaseTime from BlockItem order by StartTime")
cursor.execute("select StartTime,SourceHost,Cause,ReleaseTime from BlockItem where StartTime between date_add(now(), interval - 5 minute) and now()")
result = cursor.fetchall()
if result:
for record in result:
print record[0],
print "ip=",
sys.stdout.softspace=0
print record[1],
print record[2],
print record[3]
db.close()
重點在where StartTime between date_add(now(), interval - 5 minute) and now()
每次取出這個時間點往回算5min的資料
以避免splunk重複地計入
2014/03/20
一直使用vnc的反向連線來作為電腦支援之用
但原來使用的viewer版本太舊
以致於在win8連線時會出現一些很奇怪的狀況
所以想使用bat去call最近版本的viewer
但又碰到一個問題就是bat的dos視窗還要手動去關
很麻煩
google了一下資料
只要在bat使用start就可以了
方便
之後有新版ultravnc時只要把這個批次檔copy到同一個資料夾就好了
檔案內容如下
start vncviewer.exe -listen 81
exit
http://www.weithenn.org/2014/01/cmd-exit-after-exec-batch-file.html
但原來使用的viewer版本太舊
以致於在win8連線時會出現一些很奇怪的狀況
所以想使用bat去call最近版本的viewer
但又碰到一個問題就是bat的dos視窗還要手動去關
很麻煩
google了一下資料
只要在bat使用start就可以了
方便
之後有新版ultravnc時只要把這個批次檔copy到同一個資料夾就好了
檔案內容如下
start vncviewer.exe -listen 81
exit
http://www.weithenn.org/2014/01/cmd-exit-after-exec-batch-file.html
2014/03/10
2014/03/03
2014/03/01
本來不太使用的coventive nas因為user的一個需求
必須在create一個帳號
但建完帳號發現quota無法設定
而且之前針對user設定的quota也都不見了
連絡原廠後原廠判定是home的file system有問題
而且原廠判定home的filesystem是xfs
而xfs的quota是記錄在filesystem內
所以做成以上結論
解決方法是找一個空間把home的資料co出來
重建home再放回去
我以xfs重建完home後
發現quota還是不能設定
找了一下coventive竟然沒有xfs_quota這個指令
再想一想應該還是使用ext3才對
繞了一大圈
最後總結應該是
把home裡的
.aquota.group
.aquota.user
這二個檔砍了
重跑quotacheck
再重新設定每個user 的quota應該就解決了
Orz
必須在create一個帳號
但建完帳號發現quota無法設定
而且之前針對user設定的quota也都不見了
連絡原廠後原廠判定是home的file system有問題
而且原廠判定home的filesystem是xfs
而xfs的quota是記錄在filesystem內
所以做成以上結論
解決方法是找一個空間把home的資料co出來
重建home再放回去
我以xfs重建完home後
發現quota還是不能設定
找了一下coventive竟然沒有xfs_quota這個指令
再想一想應該還是使用ext3才對
繞了一大圈
最後總結應該是
把home裡的
.aquota.group
.aquota.user
這二個檔砍了
重跑quotacheck
再重新設定每個user 的quota應該就解決了
Orz
標籤:
aquota.group,
aquota.user,
coventive,
linux,
nas,
quotacheck,
xfs,
xfs_quota
2014/02/19
今天有一台 cisco 3750 cpu莫名的飆高
目前重開後ok
找到下列文件
如果再發生方便查原因
http://www.cisco.com/c/en/us/support/docs/switches/catalyst-3750-series-switches/68461-high-cpu-utilization-cat3750.html#pbr
目前重開後ok
找到下列文件
如果再發生方便查原因
http://www.cisco.com/c/en/us/support/docs/switches/catalyst-3750-series-switches/68461-high-cpu-utilization-cat3750.html#pbr
2014/02/10
昨天host重開
有一個guest一直停在
Booting from Hard Disk...
倒回之前的backup也沒用
想不到是grub壞了
修復方法如下
到底是誰搞壞的
Orz
單單利用 grub 安裝開機程式
你也可利用 grub 這個指令來安裝開機程式,它卻不會在 /boot/grub 內安裝 Grub 的檔案。要是開機程式被蓋過或損壞了,此方法可修復 Grub 的安裝。
執行 grub。
你可選擇執行 find /boot/grub/stage1 尋找哪個分割區在 /boot/grub 內含有 Grub 所需的檔案。如果你的 /boot 採用獨立分割區,請執行 find /grub/stage1。
執行 root [按 Grub 方式命名的分割區] 來指定哪個分割區的 /boot/grub 內含有 Grub 檔案及備有 /boot/grub/grub.conf。
利用 setup [按 Grub 方式命名的開機程式位置] 來安裝開機程式。
執行 quit 來離開 Grub 程式。
範例:
[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> find /boot/grub/stage1
(hd0,5)
(hd0,9)
grub> root (hd0,5)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p
(hd0,5)/boot/grub/stage2
/boot/grub/grub.conf"... succeeded
Done.
grub> quit
http://wiki.centos.org/zh-tw/HowTos/GrubInstallation
有一個guest一直停在
Booting from Hard Disk...
倒回之前的backup也沒用
想不到是grub壞了
修復方法如下
到底是誰搞壞的
Orz
單單利用 grub 安裝開機程式
你也可利用 grub 這個指令來安裝開機程式,它卻不會在 /boot/grub 內安裝 Grub 的檔案。要是開機程式被蓋過或損壞了,此方法可修復 Grub 的安裝。
執行 grub。
你可選擇執行 find /boot/grub/stage1 尋找哪個分割區在 /boot/grub 內含有 Grub 所需的檔案。如果你的 /boot 採用獨立分割區,請執行 find /grub/stage1。
執行 root [按 Grub 方式命名的分割區] 來指定哪個分割區的 /boot/grub 內含有 Grub 檔案及備有 /boot/grub/grub.conf。
利用 setup [按 Grub 方式命名的開機程式位置] 來安裝開機程式。
執行 quit 來離開 Grub 程式。
範例:
[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> find /boot/grub/stage1
(hd0,5)
(hd0,9)
grub> root (hd0,5)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p
(hd0,5)/boot/grub/stage2
/boot/grub/grub.conf"... succeeded
Done.
grub> quit
http://wiki.centos.org/zh-tw/HowTos/GrubInstallation
2014/02/07
2014/02/05
VBoxManage startvm vmname --type gui
VBoxManage snapshot vmname restorecurrent
或
VBoxManage snapshot vmname restore snapshot_name
http://xx3d2ybnf.pixnet.net/blog/post/119457139-virtualbox-%E7%94%A8%E4%BE%86%E9%80%B2%E8%A1%8C%E7%9B%B8%E9%97%9C%E7%AE%A1%E7%90%86%E7%9A%84%E7%B5%82%E7%AB%AF%E6%A9%9F%E6%8C%87%E4%BB%A4-vboxma
VBoxManage snapshot vmname restorecurrent
或
VBoxManage snapshot vmname restore snapshot_name
http://xx3d2ybnf.pixnet.net/blog/post/119457139-virtualbox-%E7%94%A8%E4%BE%86%E9%80%B2%E8%A1%8C%E7%9B%B8%E9%97%9C%E7%AE%A1%E7%90%86%E7%9A%84%E7%B5%82%E7%AB%AF%E6%A9%9F%E6%8C%87%E4%BB%A4-vboxma
proxmox在最近的 test update把open vswitch加進去了
今天試玩了一下
首先要手動安裝openvswitch
apt-get install openvswitch-switch
再來在管理介面中移除原本的bridge (二者無法共存)
之後在管理介面
network - create - ovs bridge
設好之後reboot
如圖所示為vmbr1 因為vmbr0已被之前的bridge使用
所以reboot後要到/etc/network/interface把vmbr1改為vmbr0
否則必須重改所有guest的network
open vswitch的相關文件如下
http://www.sdnap.com/wp-content/uploads/2013/05/OpenvSwitch%E5%AE%89%E8%A3%85%E5%8F%8A%E9%85%8D%E7%BD%AE.pdf
今天試玩了一下
首先要手動安裝openvswitch
apt-get install openvswitch-switch
再來在管理介面中移除原本的bridge (二者無法共存)
之後在管理介面
network - create - ovs bridge
設好之後reboot
如圖所示為vmbr1 因為vmbr0已被之前的bridge使用
所以reboot後要到/etc/network/interface把vmbr1改為vmbr0
否則必須重改所有guest的network
open vswitch的相關文件如下
http://www.sdnap.com/wp-content/uploads/2013/05/OpenvSwitch%E5%AE%89%E8%A3%85%E5%8F%8A%E9%85%8D%E7%BD%AE.pdf
2014/01/21
postfix如果要利用header_checks來check中文是會有問題的
必須先把中文進行編碼
網址如下
http://www.mytju.com/classCode/tools/base64.asp
要分utf8或big5
編出來之後再加入header_checks
/^Subject:.*5biQ5oi3/ DISCARD
/^Subject:.*pc6k4Q==/ DISCARD
postfix要重啟
必須先把中文進行編碼
網址如下
http://www.mytju.com/classCode/tools/base64.asp
要分utf8或big5
編出來之後再加入header_checks
/^Subject:.*5biQ5oi3/ DISCARD
/^Subject:.*pc6k4Q==/ DISCARD
postfix要重啟
2014/01/16
Gluster 系統服務
啟動Gluster服務:
指令:
service glusterfs-server start
停止Gluster服務:
指令:
service glusterfs-server stop
檢視Gluster服務:
指令:
service glusterfs-server status
Gluster 節點指令
檢視Gluster 節點狀態:
指令:
gluster peer status
新增Gluster 節點:
指令:
gluster peer probe <HOSTNAME>
說明:
HOSTNAME為您要新增該節點的主機名稱
刪除Gluster 節點:
指令:
gluster peer detach <HOSTNAME>
說明:
HOSTNAME為您要刪除該節點的主機名稱
Gluster 卷冊指令
檢視Gluster 卷冊狀態:
指令:
gluster volume info
新增分散式卷冊(Distributed Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [transport [tcp | rdma | tcp,rdma]] <NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
3.NEWBRICK為您要新增至卷冊之節點儲存區塊
新增複製式卷冊(Replicated Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [replica COUNT] [transport [tcp |rdma | tcp,rdma]]<NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.replica COUNT為副本的數量
3.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
4.NEWBRICK為您要新增至卷冊之節點儲存區塊
新增帶狀式卷冊(Striped Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [stripe COUNT] [transport [tcp | rdma | tcp,rdma]]<NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.stripe COUNT為帶狀的數量
3.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
4.NEWBRICK為您要新增至卷冊之節點儲存區塊
新增分散複製式卷冊(Distributed Replicated Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [replica COUNT] [transport [tcp | rdma | tcp,rdma]]<NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.replica COUNT為副本的數量
3.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
4.NEWBRICK為您要新增至卷冊之節點儲存區塊
增加儲存區塊(Brick)至現有卷冊中:
指令:
gluster volume add-brick <VOLUMENAME> <NEWBRICK>
說明:
1.VOLUMENAME為您要加入儲存區塊的卷冊名稱
2.NEWBRICK為您要新增至卷冊之節點儲存區塊
移除儲存區塊(Brick)於現有卷冊中:
指令:
gluster volume remove-brick <VOLUMENAME> <BRICK> start
說明:
1.VOLUMENAME為您要移除儲存區塊的卷冊名稱
2.BRICK為您要移除儲存區塊名稱
檢視移除儲存區塊(Brick)狀態:
指令:
gluster volume remove-brick VOLUMENAME BRICK status
說明:
1.VOLUMENAME為您所移除儲存區塊的卷冊名稱
2.BRICK為您要移除儲存區塊名稱
提交移除儲存區塊(Brick)狀態:
指令:
gluster volume remove-brick VOLNAME BRICK commit
說明:
1.VOLUMENAME為您所移除儲存區塊的卷冊名稱
2.BRICK為您要移除儲存區塊名稱
啟用卷冊:
指令:
gluster volume start <VOLUMENAME>
說明:
VOLUMENAME為要啟用的卷冊名稱
停用卷冊:
指令:
gluster volume stop <VOLUMENAME>
說明:
VOLUMENAME為要停用的卷冊名稱
刪除卷冊:
指令:
gluster volume delete <VOLUMENAME>
說明:
1.VOLUMENAME為要刪除的卷冊名稱
2.要刪除卷冊之前必須要先停用卷冊
掛載卷冊
手動掛載卷冊:
指令:
mount.glusterfs HOSTNAME-OR-IPADDRESS:/VOLUMENAME MOUNTDIR
說明:
1.HOSTNAME-OR-IPADDRESS為您所要掛載的主機名稱或IP及掛載的卷冊名稱
2.MOUNTDIR為您所要掛載的目的地路徑
參考資料:http://www.gluster.org
http://ithelp.ithome.com.tw/question/10107251
啟動Gluster服務:
指令:
service glusterfs-server start
停止Gluster服務:
指令:
service glusterfs-server stop
檢視Gluster服務:
指令:
service glusterfs-server status
Gluster 節點指令
檢視Gluster 節點狀態:
指令:
gluster peer status
新增Gluster 節點:
指令:
gluster peer probe <HOSTNAME>
說明:
HOSTNAME為您要新增該節點的主機名稱
刪除Gluster 節點:
指令:
gluster peer detach <HOSTNAME>
說明:
HOSTNAME為您要刪除該節點的主機名稱
Gluster 卷冊指令
檢視Gluster 卷冊狀態:
指令:
gluster volume info
新增分散式卷冊(Distributed Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [transport [tcp | rdma | tcp,rdma]] <NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
3.NEWBRICK為您要新增至卷冊之節點儲存區塊
新增複製式卷冊(Replicated Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [replica COUNT] [transport [tcp |rdma | tcp,rdma]]<NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.replica COUNT為副本的數量
3.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
4.NEWBRICK為您要新增至卷冊之節點儲存區塊
新增帶狀式卷冊(Striped Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [stripe COUNT] [transport [tcp | rdma | tcp,rdma]]<NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.stripe COUNT為帶狀的數量
3.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
4.NEWBRICK為您要新增至卷冊之節點儲存區塊
新增分散複製式卷冊(Distributed Replicated Volumes):
指令:
gluster volume create <NEWVOLUMENAME> [replica COUNT] [transport [tcp | rdma | tcp,rdma]]<NEWBRICK1> <NEWBRICK2>...
說明:
1.NEWVOLUMENAME為您要新增的卷冊名稱
2.replica COUNT為副本的數量
3.transport為傳輸模式,預設不輸入該指令參數是使用tcp模式
4.NEWBRICK為您要新增至卷冊之節點儲存區塊
增加儲存區塊(Brick)至現有卷冊中:
指令:
gluster volume add-brick <VOLUMENAME> <NEWBRICK>
說明:
1.VOLUMENAME為您要加入儲存區塊的卷冊名稱
2.NEWBRICK為您要新增至卷冊之節點儲存區塊
移除儲存區塊(Brick)於現有卷冊中:
指令:
gluster volume remove-brick <VOLUMENAME> <BRICK> start
說明:
1.VOLUMENAME為您要移除儲存區塊的卷冊名稱
2.BRICK為您要移除儲存區塊名稱
檢視移除儲存區塊(Brick)狀態:
指令:
gluster volume remove-brick VOLUMENAME BRICK status
說明:
1.VOLUMENAME為您所移除儲存區塊的卷冊名稱
2.BRICK為您要移除儲存區塊名稱
提交移除儲存區塊(Brick)狀態:
指令:
gluster volume remove-brick VOLNAME BRICK commit
說明:
1.VOLUMENAME為您所移除儲存區塊的卷冊名稱
2.BRICK為您要移除儲存區塊名稱
啟用卷冊:
指令:
gluster volume start <VOLUMENAME>
說明:
VOLUMENAME為要啟用的卷冊名稱
停用卷冊:
指令:
gluster volume stop <VOLUMENAME>
說明:
VOLUMENAME為要停用的卷冊名稱
刪除卷冊:
指令:
gluster volume delete <VOLUMENAME>
說明:
1.VOLUMENAME為要刪除的卷冊名稱
2.要刪除卷冊之前必須要先停用卷冊
掛載卷冊
手動掛載卷冊:
指令:
mount.glusterfs HOSTNAME-OR-IPADDRESS:/VOLUMENAME MOUNTDIR
說明:
1.HOSTNAME-OR-IPADDRESS為您所要掛載的主機名稱或IP及掛載的卷冊名稱
2.MOUNTDIR為您所要掛載的目的地路徑
參考資料:http://www.gluster.org
http://ithelp.ithome.com.tw/question/10107251
2014/01/07
python 從2.4開始建議使用
subprocess來取代
os.system
os.spawn*
os.popen*
popen2.*
commands.*
除了 subprocess.call() 之外,另外還有 check_call() 跟 check_output()。
除了 check_output 會回傳 output 之外,用法相同跟 call() 一樣。只不過會自動檢查 return code,如果是非零值的話,就會直接丟出 CalledProcessError,這個時候 return code 還是可以透過 returncode 這個 attribute 來取回。例如:(但是要執行的程式不存在時,還是會丟出 OSError)
如果要捉取回傳的值來進行某些判斷的話
就要使用subprocess.check_output()
範例如下
import subprocess
a = subprocess.check_output("dir", shell=True)
print a
b = a.find('zz')
print b
http://docs.python.org/2/library/subprocess.html
http://imsardine.wordpress.com/tech/shell-scripting-in-python/
subprocess來取代
os.system
os.spawn*
os.popen*
popen2.*
commands.*
除了 subprocess.call() 之外,另外還有 check_call() 跟 check_output()。
除了 check_output 會回傳 output 之外,用法相同跟 call() 一樣。只不過會自動檢查 return code,如果是非零值的話,就會直接丟出 CalledProcessError,這個時候 return code 還是可以透過 returncode 這個 attribute 來取回。例如:(但是要執行的程式不存在時,還是會丟出 OSError)
如果要捉取回傳的值來進行某些判斷的話
就要使用subprocess.check_output()
範例如下
import subprocess
a = subprocess.check_output("dir", shell=True)
print a
b = a.find('zz')
print b
http://docs.python.org/2/library/subprocess.html
http://imsardine.wordpress.com/tech/shell-scripting-in-python/
2014/01/05
import telnetlib
f = open("switch")
lines = f.read().splitlines()
#print lines
command_arr = ["123456","en","123456","terminal length 0","sh mac add","exit"]
#print command_arr
for HOST in lines:
#print HOST
tn = telnetlib.Telnet(HOST)
for command in command_arr :
tn.write(command + "\n")
#print tn.read_all()
content = tn.read_all()
print content
chk = content.find("1122.3344.5566") #找出這個mac是否在這台switch上 在那一個port上
print chk
tn.close()
f = open("switch")
lines = f.read().splitlines()
#print lines
command_arr = ["123456","en","123456","terminal length 0","sh mac add","exit"]
#print command_arr
for HOST in lines:
#print HOST
tn = telnetlib.Telnet(HOST)
for command in command_arr :
tn.write(command + "\n")
#print tn.read_all()
content = tn.read_all()
print content
chk = content.find("1122.3344.5566") #找出這個mac是否在這台switch上 在那一個port上
print chk
tn.close()
2014/01/04
使用python的 telnetlib對網路設備進行一些自動化的操作
範例如下
import telnetlib
HOST = "1.1.1.1"
tn = telnetlib.Telnet(HOST)
tn.read_until("Password: ")
tn.write("12345\n")
tn.read_until("cc>")
tn.write("en\n")
tn.read_until("Password: ")
tn.write("12345\n")
tn.write("sh flash\n")
tn.write("exit\n")
print tn.read_all()
http://blog.johnsonlu.org/category/programe/pythin/
http://docs.python.org/2/library/telnetlib.html
範例如下
import telnetlib
HOST = "1.1.1.1"
tn = telnetlib.Telnet(HOST)
tn.read_until("Password: ")
tn.write("12345\n")
tn.read_until("cc>")
tn.write("en\n")
tn.read_until("Password: ")
tn.write("12345\n")
tn.write("sh flash\n")
tn.write("exit\n")
print tn.read_all()
http://blog.johnsonlu.org/category/programe/pythin/
http://docs.python.org/2/library/telnetlib.html
2014/01/01
最近碰到一個很奇怪的問題
使用了一段時間的aruba ap
突然發生無法使用的情況
查了一下brocade icx 6450的log發現是ap向switch要更多的電
原本是使用802.3 af的 15400ma
但switch無法提供更多
因此視為異常而把port disable了
但該ap並不是新裝而是已經使用一段時間了
搞不清楚到底是ap還是switch 的問題
因為有二顆出現這個情況
所以先送修一個回aruba原廠
同時詢問brocade原廠
大約隔了二週
brocade給了一個針對poe module的patch
上上去之後
目前看起來是正常
更新指令如下
inline power install-firmware [stack-unit |unit-number] tftp ip-address filename
必須先用show run看poe是在那一個unit
使用了一段時間的aruba ap
突然發生無法使用的情況
查了一下brocade icx 6450的log發現是ap向switch要更多的電
原本是使用802.3 af的 15400ma
但switch無法提供更多
因此視為異常而把port disable了
但該ap並不是新裝而是已經使用一段時間了
搞不清楚到底是ap還是switch 的問題
因為有二顆出現這個情況
所以先送修一個回aruba原廠
同時詢問brocade原廠
大約隔了二週
brocade給了一個針對poe module的patch
上上去之後
目前看起來是正常
更新指令如下
inline power install-firmware [stack-unit |unit-number] tftp ip-address filename
必須先用show run看poe是在那一個unit
今天稍微玩了一下lxc
如果只用linux是可以考慮的選擇
但支援的linux也不多
目前支援的如下圖
有web介面可以管理
如下連結
http://lxc-webpanel.github.io/index.html
web介面安裝指令
wget http://lxc-webpanel.github.io/tools/install.sh -O - | bash
但要進入guest的console還是要下指令
相關指令如下
lxc-create -n 虛擬機器名稱 -t ubuntu
lxc-console -n 虛擬機器名稱
sudo lxc-shutdown -n 虛擬機器名稱
如果不熟linux的應該會不太適應
不過效能上應該是比較好的
測試的環境是先在virtualbox上裝ubuntu
之後才在ubuntu上裝lxc
guest中的guest
沒有什麼lag
http://www.arthurtoday.com/2012/10/ubuntu-create-and-setting-lxc-containers.html#.UsOuPtIW2So
如果只用linux是可以考慮的選擇
但支援的linux也不多
目前支援的如下圖
有web介面可以管理
如下連結
http://lxc-webpanel.github.io/index.html
web介面安裝指令
wget http://lxc-webpanel.github.io/tools/install.sh -O - | bash
但要進入guest的console還是要下指令
相關指令如下
lxc-create -n 虛擬機器名稱 -t ubuntu
lxc-console -n 虛擬機器名稱
sudo lxc-shutdown -n 虛擬機器名稱
如果不熟linux的應該會不太適應
不過效能上應該是比較好的
測試的環境是先在virtualbox上裝ubuntu
之後才在ubuntu上裝lxc
guest中的guest
沒有什麼lag
http://www.arthurtoday.com/2012/10/ubuntu-create-and-setting-lxc-containers.html#.UsOuPtIW2So
2013/12/22
borcade
http://www.brocade.com/downloads/documents/product_manuals/MIB/IPMIB_Reference_Jun2013.pdf
OID前要加上 1.3.6.1.4.1.1991
1.3.6.1.4.1.1991.1.1.1.1.18 机器溫度
cisco 溫度相關oid
iso.3.6.1.4.1.9.9.13.1.3.1.2.1005 = STRING: "SW#1, Sensor#1, GREEN "
iso.3.6.1.4.1.9.9.13.1.3.1.2.2005 = STRING: "SW#2, Sensor#1, GREEN "
iso.3.6.1.4.1.9.9.13.1.3.1.3.1005 = Gauge32: 30
iso.3.6.1.4.1.9.9.13.1.3.1.3.2005 = Gauge32: 33
iso.3.6.1.4.1.9.9.13.1.3.1.4.1005 = INTEGER: 65
iso.3.6.1.4.1.9.9.13.1.3.1.4.2005 = INTEGER: 65
iso.3.6.1.4.1.9.9.13.1.3.1.5.1005 = INTEGER: 0
iso.3.6.1.4.1.9.9.13.1.3.1.5.2005 = INTEGER: 0
iso.3.6.1.4.1.9.9.13.1.3.1.6.1005 = INTEGER: 1
iso.3.6.1.4.1.9.9.13.1.3.1.6.2005 = INTEGER: 1
以下為目前實際值
.1.3.6.1.4.1.9.9.13.1.3.1.3.1005
舊型机器(2U)不支援此OID
http://www.brocade.com/downloads/documents/product_manuals/MIB/IPMIB_Reference_Jun2013.pdf
OID前要加上 1.3.6.1.4.1.1991
1.3.6.1.4.1.1991.1.1.1.1.18 机器溫度
cisco 溫度相關oid
iso.3.6.1.4.1.9.9.13.1.3.1.2.1005 = STRING: "SW#1, Sensor#1, GREEN "
iso.3.6.1.4.1.9.9.13.1.3.1.2.2005 = STRING: "SW#2, Sensor#1, GREEN "
iso.3.6.1.4.1.9.9.13.1.3.1.3.1005 = Gauge32: 30
iso.3.6.1.4.1.9.9.13.1.3.1.3.2005 = Gauge32: 33
iso.3.6.1.4.1.9.9.13.1.3.1.4.1005 = INTEGER: 65
iso.3.6.1.4.1.9.9.13.1.3.1.4.2005 = INTEGER: 65
iso.3.6.1.4.1.9.9.13.1.3.1.5.1005 = INTEGER: 0
iso.3.6.1.4.1.9.9.13.1.3.1.5.2005 = INTEGER: 0
iso.3.6.1.4.1.9.9.13.1.3.1.6.1005 = INTEGER: 1
iso.3.6.1.4.1.9.9.13.1.3.1.6.2005 = INTEGER: 1
以下為目前實際值
.1.3.6.1.4.1.9.9.13.1.3.1.3.1005
舊型机器(2U)不支援此OID
2013/12/21
訂閱:
文章 (Atom)





