show the config on certain interface
(config)# run show configuration interface gigabitEthernet X/X/X.YYY
set the ip address subnet on certain interface
(config)# interface gigabitEthernet X/X/X.YYY
(config)# ip address 1.1.1.1 255.255.255.0 secondary
set static route on router
(config)#ip route 1.1.1.1/24 2.2.2.2
or
(config)#ip route 1.1.1.1/24 gigabitEthernet X/X/X.YYY
setting targets:
o. let certain subnet can access to internet
All hardware and software things including network, system, UI, maintaining tools and the information security field
8/19/2013
8/02/2013
python dictionary 入門
>>> tel = {'jack': 4098, 'sape': 4139} >>> tel['guido'] = 4127 >>> tel {'sape': 4139, 'guido': 4127, 'jack': 4098} >>> tel['jack'] 4098 >>> del tel['sape'] >>> tel['irv'] = 4127 >>> tel {'guido': 4127, 'irv': 4127, 'jack': 4098} >>> tel.keys() ['guido', 'irv', 'jack'] >>> 'guido' in tel True
7/31/2013
python write the json and php read it periodically
python part:
#save your data into python dictionary - Ex. testResultsJson
testResultsJson = {}
fjs = open('/var/www/xxx/state.json','w')
fjs.write(json.dumps(testResultsJson))
fjs.close()
php part:
#save your data into python dictionary - Ex. testResultsJson
testResultsJson = {}
fjs = open('/var/www/xxx/state.json','w')
fjs.write(json.dumps(testResultsJson))
fjs.close()
php part:
$file = "/var/www/xxx/state.json";
$obj = json_decode(file_get_contents($file));
#Ex. i want to get the timestamp info from this object.
$timestring = 'Last Updated:'.$obj.'timestamp.';
7/26/2013
GTM 常用指令紀錄
create gtm datacenter dc1 dc2
create gtm server ltm1 addresses add { 10.10.100.1 } monitor bigip datacenter dc1 virtual-servers add { 10.10.100.10:80 10.10.100.11:80 10.10.100.12:80 }
create gtm server ltm2 addresses add { 10.10.200.1 } monitor bigip datacenter dc3 virtual-servers add { 10.10.200.10:80 10.10.200.11:80 10.10.200.12:80 }
create gtm pool gpool1 members add { 10.10.100.10:80 {ratio 1} 10.10.100.11:80 {ratio 2} 10.10.100.12:80 {ratio 3} } load-balancing-mode ratio verify-member-availability disabled
create gtm pool gpool2 members add { 10.10.200.10:80 {ratio 1} 10.10.200.11:80 {ratio 2} 10.10.200.12:80 {ratio 3} } load-balancing-mode ratio verify-member-availability disabled
create gtm wideip test.wip.com pool-lb-mode ratio pools add { gpool1 { ratio 1 } gpool2 { ratio 2 } } persistence enabled ttl-persistence 300 rules add { testwip-rule }
create gtm server ltm1 addresses add { 10.10.100.1 } monitor bigip datacenter dc1 virtual-servers add { 10.10.100.10:80 10.10.100.11:80 10.10.100.12:80 }
create gtm server ltm2 addresses add { 10.10.200.1 } monitor bigip datacenter dc3 virtual-servers add { 10.10.200.10:80 10.10.200.11:80 10.10.200.12:80 }
create gtm pool gpool1 members add { 10.10.100.10:80 {ratio 1} 10.10.100.11:80 {ratio 2} 10.10.100.12:80 {ratio 3} } load-balancing-mode ratio verify-member-availability disabled
create gtm pool gpool2 members add { 10.10.200.10:80 {ratio 1} 10.10.200.11:80 {ratio 2} 10.10.200.12:80 {ratio 3} } load-balancing-mode ratio verify-member-availability disabled
create gtm wideip test.wip.com pool-lb-mode ratio pools add { gpool1 { ratio 1 } gpool2 { ratio 2 } } persistence enabled ttl-persistence 300 rules add { testwip-rule }
如何在 GTM 使用 tmsh 新增多members 到 pool當中
tmsh# gtm pool modify POOLNAME members add { ip1:port ip2.port }
7/25/2013
set static mac address on juniper router
(config)# arp 1.1.1.1 gigabitEthernet x/x/x/x AAAA.BBBB.CCCC
7/23/2013
常忘記但會用到的 shell script while loop
Example:
while true; do ls; sleep 2; done
while true; do [command]; sleep [duration]; done
while true; do ls; sleep 2; done
while true; do [command]; sleep [duration]; done
7/15/2013
紀錄常用protocol header
mac header size: 14 B
ip header size: 20 B
tcp header size: 20 B
udp header size: 8 B
ip header size: 20 B
tcp header size: 20 B
udp header size: 8 B
6/27/2013
一次觀看多個youtube影片的方法
1. 連結到此網站:
http://geoipro.mooo.com/youtube/testy.html
2. 輸入您所要看的youtube video ID 以及其他相關參數
3. 點擊 Gen crazy user
4. 享受一次觀看多個youtube的效果
http://geoipro.mooo.com/youtube/testy.html
2. 輸入您所要看的youtube video ID 以及其他相關參數
3. 點擊 Gen crazy user
4. 享受一次觀看多個youtube的效果
6/12/2013
SNAT 與 DNAT 的差別
假設 IP 封包 示意如下:
| src ip | dst ip | xxxx(payload) |
NAT大致有下列三種 :
1. SNAT
[change]
| src ip | dst ip | xxxx |
#修改 src ip
2. DNAT
[change]
| src ip | dst ip | xxxx |
#修改 dst ip
3. MASQUERADE (SNAT的一種)
假設 網卡 eth0 上的 IP 為 A-ip, 則由eth0 出去的封包:
[change to A-ip]
| src ip | dst ip | xxxx |
SNAT run on POSTROUTING chain, DNAT run on PREROUTING chain
| src ip | dst ip | xxxx(payload) |
NAT大致有下列三種 :
1. SNAT
[change]
| src ip | dst ip | xxxx |
#修改 src ip
2. DNAT
[change]
| src ip | dst ip | xxxx |
#修改 dst ip
3. MASQUERADE (SNAT的一種)
假設 網卡 eth0 上的 IP 為 A-ip, 則由eth0 出去的封包:
[change to A-ip]
| src ip | dst ip | xxxx |
SNAT run on POSTROUTING chain, DNAT run on PREROUTING chain
如何在用apt-get 安裝 vim 7.3
1. 在 /etc/apt/sources.list 中加入下列這行:
deb http://ftp.de.debian.org/debian sid main
2. 關閉vim並且運行下列指令:
sudo apt-get update
sudo apt-get remove vim-common vim-runtime vim-gtk vim-gui-common
sudo apt-get install vim-common vim-runtime
3. 在/etc/apt/sources.list 中移除 deb http://ftp.de.debian.org/debian sid main
4. 再跑一次 sudo apt-get update
deb http://ftp.de.debian.org/debian sid main
2. 關閉vim並且運行下列指令:
sudo apt-get update
sudo apt-get remove vim-common vim-runtime vim-gtk vim-gui-common
sudo apt-get install vim-common vim-runtime
3. 在/etc/apt/sources.list 中移除 deb http://ftp.de.debian.org/debian sid main
4. 再跑一次 sudo apt-get update
5. 完成
5/21/2013
5/17/2013
GTM 修改多個 WideIP 之設定方法
tmsh
Ex.
modify gtm wideip all last-resort-pool test-pool
The last-resort-pool part can be the any parameter within wideip
Ex.
modify gtm wideip all last-resort-pool test-pool
The last-resort-pool part can be the any parameter within wideip
5/12/2013
5/09/2013
4/24/2013
CTCP - Compound TCP
簡介:
CTCP 是 Microsoft 所研發的一種TCP algorithm, 原始是被用在Windows Vista (非預設) and Windows Server 2008 上的TCP Stack. 他主要是被設計成可以積極的調整送端的壅塞窗戶, 並且其主要針對頻寬大而延遲高的網路通道作最佳化, 而又不失TCP 之公平性. CTCP可以用hotfix 套用於Linux 與 Windows XP.
原則:
CTCP 使用queueing 延遲來作為壅塞的衡量參數. 如果queueing延遲很小, 那他就會假設目前網路通道上沒有link發生壅塞, 進而快速增加傳送速率.
CTCP 維護兩種壅塞窗戶, 一種是一般的AIMD窗戶, 另一種是以延遲為基準的窗戶, 而實際上的Sliding window size 就是以上兩種的總和. AIMD窗戶大小增加的行為與TCP Reno相同.
如果網路環境的延遲很小, 那麼延遲窗戶就會快速加大, 一旦發現queueing發生, 延遲窗戶就會快速減小, 來補償AIMD窗戶增加的量. 主要目的是要讓 AIMD 窗戶 size + 延遲窗戶 size ~= 定值 (趨近定值) 而當queue 發生時, 延遲窗戶所減少的量會接近於queue size, 以防止持續性的壅塞. 所以CTCP的特點在於, 他可以根據delay的程度來調整其窗戶 size.
設定:
在Windows 7 如果想要啟用的話, 可使用以下指令:
netsh interface tcp set global congestionprovider=ctcp
在Windows 8 的話, 可使用以下指令:
set-nettcpsetting -Settingname Custom -CongestionProvider CTCP
顯示目前您電腦的TCP設定:
netsh interface tcp show global
CTCP 是 Microsoft 所研發的一種TCP algorithm, 原始是被用在Windows Vista (非預設) and Windows Server 2008 上的TCP Stack. 他主要是被設計成可以積極的調整送端的壅塞窗戶, 並且其主要針對頻寬大而延遲高的網路通道作最佳化, 而又不失TCP 之公平性. CTCP可以用hotfix 套用於Linux 與 Windows XP.
原則:
CTCP 使用queueing 延遲來作為壅塞的衡量參數. 如果queueing延遲很小, 那他就會假設目前網路通道上沒有link發生壅塞, 進而快速增加傳送速率.
CTCP 維護兩種壅塞窗戶, 一種是一般的AIMD窗戶, 另一種是以延遲為基準的窗戶, 而實際上的Sliding window size 就是以上兩種的總和. AIMD窗戶大小增加的行為與TCP Reno相同.
如果網路環境的延遲很小, 那麼延遲窗戶就會快速加大, 一旦發現queueing發生, 延遲窗戶就會快速減小, 來補償AIMD窗戶增加的量. 主要目的是要讓 AIMD 窗戶 size + 延遲窗戶 size ~= 定值 (趨近定值) 而當queue 發生時, 延遲窗戶所減少的量會接近於queue size, 以防止持續性的壅塞. 所以CTCP的特點在於, 他可以根據delay的程度來調整其窗戶 size.
設定:
在Windows 7 如果想要啟用的話, 可使用以下指令:
netsh interface tcp set global congestionprovider=ctcp
在Windows 8 的話, 可使用以下指令:
set-nettcpsetting -Settingname Custom -CongestionProvider CTCP
顯示目前您電腦的TCP設定:
netsh interface tcp show global
1/19/2013
測試DNS是否成功設定 - python script
#!/usr/bin/python
import time
import sys
import os
i = 1
if len(sys.argv) < 3:
sys.stderr.write('Usage: sys.argv[0] target-domain times-of-test DNS-IP\n')
sys.exit(1)
else:
counter = int(sys.argv[2])
domain = sys.argv[1]
dnsip = sys.argv[3]
while i <= counter:
i += 1
os.system("dig " + domain "@" + dnsip + " | grep NXDOMAIN")
#只要看ouput出來有幾行 NXDOMAIN 就知道大約的錯誤機率了
1/15/2013
保護眼睛 螢幕設定模式
作為一個資訊相關的工程師, 或是一般上網的重度使用者, 一定會覺得常常眼壓很高很累吧. 個人最近甚至因為常常工作看螢幕, 飛蚊症漸漸出現, 為了讓各位的眼睛能夠用久一點, 在此推薦在 win 7 裡面可以設定螢幕色調相反模式, 也就是如果網頁是白底黑字, 就會變成黑底白字, 眼睛長期看螢幕比較不會一直都在看白色部份.
設定方法如下:
控制台 -> 輕鬆存取中心 -> 啟動放大鏡 -> 在放大鏡控制介面有個齒輪設定圖案
-> 進入設定後 勾選 開啟色彩反轉
大功告成
以後覺得眼睛很酸很累又需要看螢幕時, 可以嘗試開啟此模式喔
看網頁會像是下面這樣:
設定方法如下:
控制台 -> 輕鬆存取中心 -> 啟動放大鏡 -> 在放大鏡控制介面有個齒輪設定圖案
-> 進入設定後 勾選 開啟色彩反轉
大功告成
以後覺得眼睛很酸很累又需要看螢幕時, 可以嘗試開啟此模式喔
看網頁會像是下面這樣:
1/01/2013
在linux刪除所有特定的程序
linux上面有些daemon一次可能會開多個process, 例如: nginx, 如果我們想要一次kill所有跟nginx相關的process, 可以使用 killall nginx 來刪除所有與nginx有關的 running process.
訂閱:
文章 (Atom)