9/09/2013

快速理解 FECN/BECN (forward explicit congestion notification/backward explicit congestion notification)

在frame relay世界中, 有送端與收端, 想像工廠中生產線上的兩個員工, A and B.

A 會一直作東西給 B, 當 A 發現 要把做好的東西放到機台上時結果擠不進去,

這時候A 就會跟 B 說 FECN : 現在機台很上太多東西了, 會滿出來喔.

相反地, B 會一直拿到 A 做好的東西 再加工, 如果 B 發現機台上太多東西,

就會跟 A 說 BECN, 現在機台上太多東西了, 很塞耶.

當然實際在網路上發生此現象的原因是因為頻寬不足, 或是 link noise太大 之類.

8/31/2013

vim 如何使用巨集功能

1. 紀錄

先在最外層 按下 "q" , 再按下你想要的巨集名稱, 例如: a

2. 輸入想要編輯的步驟

此時左下方會顯示 "recording" , 代表已經在紀錄中, 此時你所有
輸入的編輯指令都會被紀錄在巨集 a 當中. 例如: 我 i + teststring + Esc

3. 離開紀錄模式

編輯完後按 Esc 跳到最外層, 再按下 "q", 就會停止紀錄

4. 播放巨集

按下 @a, 播放剛才紀錄的巨集, 這樣就會播放一次

5. 連續播放巨集

按下 10@a, 就會播放剛才紀錄的巨集 10 次


8/26/2013

STP switch port states

STP switch port states:


  • Blocking - A port that would cause a switching loop if it were active. No user data is sent or received over a blocking port, but it may go into forwarding mode if the other links in use fail and the spanning tree algorithm determines the port may transition to the forwarding state. BPDU data is still received in blocking state. Prevents the use of looped paths.
  • Listening - The switch processes BPDUs and awaits possible new information that would cause it to return to the blocking state. It does not populate the MAC address table and it does not forward frames.
  • Learning - While the port does not yet forward frames it does learn source addresses from frames received and adds them to the filtering database (switching database). It populates the MAC Address table, but does not forward frames.
  • Forwarding - A port receiving and sending data, normal operation. STP still monitors incoming BPDUs that would indicate it should return to the blocking state to prevent a loop.
  • Disabled - Not strictly part of STP, a network administrator can manually disable a port
  • Reference: wikipedia

    8/19/2013

    set the IPs and static route on ERX

    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

    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:

    $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 }

    如何在 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


    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

    6/27/2013

    一次觀看多個youtube影片的方法

    1. 連結到此網站:

    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

    如何寫簡單的 web page auto refresh

    如何在用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

    5. 完成

    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

    5/09/2013