2015年1月26日 星期一

Linux and Mac OS use serial port on virtualbox

由於使用多個系統加上又要用virtualbox來練習lab,因為virtualbox好像不會自己增加一個虛擬網卡,所以不像在windows系統可以互綁ip來透通,所以只好使用連接serial port的方式來連入。

Linux方式:
須先安裝screen

socat UNIX-CONNECT:/tmp/pipe_junos PTY,link=/tmp/pty & screen /tmp/pty

這樣就會有cosole畫面了


OSX的方式:
先安裝xcode
我使用iterm當terminal軟體
socat -d -d /tmp/pipe_Olive PTY
紅色部分為在virtualbox定義的名稱,這邊要打入你自己定義的才是。

lizhengyudeMBP:~ Chris$ socat -d -d /tmp/pipe_Olive PTY2015/01/27 10:33:26 socat[3332] N opening connection to LEN=17 AF=1 "/tmp/pipe_Olive"
2015/01/27 10:33:26 socat[3332] N successfully connected from local address LEN=16 AF=1 ""
2015/01/27 10:33:26 socat[3332] N successfully connected via
2015/01/27 10:33:26 socat[3332] N PTY is /dev/ttys001
2015/01/27 10:33:26 socat[3332] N starting data transfer loop with FDs [3,3] and [4,4]

然後再開另一個視窗,打入以下命令
screen /dev/ttys001
(黃底部分文字要一致)
就可以有console畫面了


2014年10月2日 星期四

Olive pratice lab-BGP multihop

bgp-multihop.jpeg 
 
基本設定
我習慣用group的方式建lab,之後要移除會比較快!
基本設定
set groups test-multihop logical-systems r1 interfaces em1 unit 12 vlan-id 12
set groups test-multihop logical-systems r1 interfaces em1 unit 12 family inet address 192.168.12.1/30
set groups test-multihop logical-systems r2 interfaces em2 unit 12 vlan-id 12
set groups test-multihop logical-systems r2 interfaces em2 unit 12 family inet address 192.168.12.2/30
set groups test-multihop logical-systems r2 interfaces em1 unit 23 vlan-id 23
set groups test-multihop logical-systems r2 interfaces em1 unit 23 family inet address 192.168.23.1/30
set groups test-multihop logical-systems r3 interfaces em2 unit 23 vlan-id 23
set groups test-multihop logical-systems r3 interfaces em2 unit 23 family inet address 192.168.23.2/30

確認用r2 ping r1 跟r2 ping r3,確認OK後於兩台r1/r3加入static route讓r1/r3能夠互ping
set groups test-multihop logical-systems r1 routing-options static route 192.168.23.0/24 next-hop 192.168.12.2
set groups test-multihop logical-systems r3 routing-options static route 192.168.12.0/24 next-hop 192.168.23.1
確認用r1 ping r3,確認OK後,加入bgp設定
1. as number
2. group name and type
3. bgp neighbor ip and local address ip
4. check bgp neighbor
set groups test-multihop logical-systems r1 protocols bgp group ebgp type external
set groups test-multihop logical-systems r1 protocols bgp group ebgp local-address 192.168.12.1
set groups test-multihop logical-systems r1 protocols bgp group ebgp peer-as 65001
set groups test-multihop logical-systems r1 protocols bgp group ebgp neighbor 192.168.23.2
set groups test-multihop logical-systems r1 routing-options autonomous-system 65000
set groups test-multihop logical-systems r3 protocols bgp group ebgp type external
set groups test-multihop logical-systems r3 protocols bgp group ebgp local-address 192.168.23.2
set groups test-multihop logical-systems r3 protocols bgp group ebgp peer-as 65000
set groups test-multihop logical-systems r3 protocols bgp group ebgp neighbor 192.168.12.1
set groups test-multihop logical-systems r3 routing-options autonomous-system 65001
此時show bgp summary會看到bgp neighbor狀態是idle
[edit groups test-multihop]
lab@RE0# run show bgp summary logical-system all   
logical-system: r2
BGP is not running
-----
logical-system: r3
Groups: 1 Peers: 1 Down peers: 1
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 0          0          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.12.1          65000          0          0       0       0          16 Idle
-----
logical-system: r1
Groups: 1 Peers: 1 Down peers: 1
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 0          0          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.23.2          65001          0          0       0       0          16 Idle
-----                                  

加入bgp multihop的設定
set groups test-multihop logical-systems r1 protocols bgp group ebgp multihop
set groups test-multihop logical-systems r3 protocols bgp group ebgp multihop
確認bgp neighbor狀態
lab@RE0# run show bgp summary logical-system all                    
logical-system: r2
BGP is not running
-----
logical-system: r3
Groups: 1 Peers: 1 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 0          0          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.12.1          65000         92         92       0       0       40:20 0/0/0/0              0/0/0/0
-----
logical-system: r1
Groups: 1 Peers: 1 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 0          0          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.23.2          65001         91         92       0       0       40:20 0/0/0/0              0/0/0/0
-----
                                  
logical-system: default
BGP is not running

結論是multihop通常是要增加TTL的數,因為ebgp的ttl是預設為1,所以如neighbor不是介面的IP的話,都必須要啟用multihop來增加彼此router的ttl數,來達到BGP TCP建立

ebgp要建立TCP的封包帶的ttl值為1,在enable multihop後,其值增加到64













2014年8月6日 星期三

2014年7月19日 星期六

Olive pratice lab- BGP

  • Topology:
BGP_ospf_redistribute.jpeg
Looback:
R1:1.1.1.1
R2:2.2.2.2
R3:3.3.3.3
R4:4.4.4.4

Lab:
最終目的:每個Router都必須ping的到其他router的loopback
1. R2/R4建立OSPF,並可互ping彼此的loopback
2. R1/R2/R3彼此之間,利用界接interface建立ebgp,R2/R4用loopback建立ibgp
3.設定policy,R1/R2/R3放出loopback給彼此學習
4.設定policy,export ospf route 給ebgp
5.驗證每台router都可以互ping loopback IP

2014年7月17日 星期四

2014 史考特證卷 Scottrade 開戶說明


為了要投資美股,去找了些資料,當然要有能夠投資美股的證卷商。比較了幾家搜尋到的firsttrade&Etrade&scotttrade,最後在開戶的便利性下,我選擇了scottrade證卷。
當然要先有以下的資料才能夠順利開戶,再慢慢介紹

1. 要有美金帳戶:

我本身剛好有台北富邦銀行的一本萬利帳戶(V-banking),帳戶可以有多種類型帳戶,所以在網路銀行上我就可以直接買美金,至於怎麼匯出,在後面說明
https://www.fubon.com/bank/rich/vbanking/001_vbanking_01.htm?show=m0

2. 準備雙身分證件正反影印本

3. Non-US Person Brokerage Account Application (非美國居民經紀賬戶申請表)

申請非美國居民經紀賬戶表格,也就是W-8BEN表,以下會用圖示說明。

4. 一個紙本帳單(要有現居地的地址)

不管戶籍地與通訊地址是不是在同一個地址,都需要一個有寄送到目前居住地的帳單。
所有帳單目前我都是申請電子帳單了,所以就是去申請手機紙本帳單來當作證明(中華電信直接跟客服說寄送帳單或是收費證明皆可以)
以上都準備好後,只要照個相之後,全部寄送至api@scottrade.com,就等候scottrade通知開戶完成囉!

2014年7月9日 星期三

2014年7月1日 星期二

Primary Vs Preferred

在Juniper 網路設備中,都會有在interface上設定IP位址後,可設定一個參數(primary or perferred)
根據官方的解釋:

Configuring the Primary Address for an Interface

The primary address on an interface is the address that is used by default as the local address for broadcast and multicast packets sourced locally and sent out the interface. For example, the local address in the packets sent by a ping interface so-0/0/0.0 255.255.255.255 command is the primary address on interface so-0/0/0.0. The primary address flag also can be useful for selecting the local address used for packets sent out unnumbered interfaces when multiple non-127 addresses are configured on the loopback interface, lo0. By default, the primary address on an interface is selected as the numerically lowest local address configured on the interface.

GNS3 with JUNOS Olive which install in Virtualbox

學習Juniper也一段時間了,Lab不在乎就是更簡單使用,目前Juniper不像Cisco有龐大的資源可以拿到,模擬器也一堆(GNS3&IOU..等)。
但是隨著Juniper越來越多人學習後,也一堆資源可以慢慢拿到,早期可以lab的方式大概就以下幾種。
  1. 實際的設備機器:


    這個方式花費之大,連目前已淘汰且最小的機種M7i(不加卡板)也都要五萬多台幣以上,且是二手品,如是新品的話,又要看保固之類的,不然買了就壞掉實在是得不償失,而且線材跟SPF之類的都要另外準備,這種比較適合團體一起弄lab,只是在台灣光找到小團體來兜lab就有點難了啊,又尤其是要準備J牌考試的!!!XD
  2. Olive:


    Olive就不多說了,網路搜尋一堆解釋,此資源在官方來看是不允許的,所以也自己去搜尋來使用,優點當然就是不用錢,缺點就是線路都是利用vlan來打通,所以要弄大型lab的話,會因為線路設定而顯得很複雜。
  3. GNS3 with Olive:


    熟悉Cisco的工程師,一定有用過GNS3,裡面就會有個選項-qemu,可把olive的檔案指定當成GNS3裏頭的一台Router。優點也是免錢囉,另外就是圖面式及可直接透過GNS3的功能去畫線,可省去一堆vlan打通的麻煩。缺點也是頗多,在GNS3開啟olive會耗費非常久的時間,端看你的主機強度啦,另外interface em2似乎是有bug,目前應該無解。
    [求助] GNS3模擬Junos基本連通性問題求助
  4. Olive in virtualbox in GNS3


    其中目前這個GNS3&virtualbox 所結合的方式是我覺得比較直覺化的一種。後續介紹安裝方式
    優點是不佔CPU loading,但吃記憶體,現在ram便宜到爆,應該可以多買幾支來撐著用,其圖像就如第三點那樣,缺點應該就是目前資源較少,因為要找到可在vituralbox開的olive較少。

2014年5月4日 星期日

什麼是RFC1918

RFC1918,從字面上來看,會以為是某個RFC文件的標題。但實際上並不是,是解釋其三組private address,可看成把這三組private的統稱。

查詢IETF組織所編譯的資料。rfc1918是Address Allocation for Private Internets。等於說rfc1918可以代表private address。其進一步的意思解釋可以參考RFC1918

因IP位置有保留其三組IP網段供private使用
10.0.0.0 - 10.255.255.255 (10/8)
172.16.0.0 - 172.31.255.255 (172.16/12)
192.168.0.0 - 192.168.255.255 (192.168/16)
 
 這三組網段就等同代表rfc1918。

2013年9月25日 星期三

IP truncated-ip


今天在troubleshooting線路的時候,在monitor traffice的時候,突然發現有這樣一串訊息

juniper@R1> monitor traffic interface ge-0/0/0
18:01:22.896037  In IP 12.1.1.2 > 12.1.1.1: ICMP echo reply, id 6762, seq 4, length 64
18:01:22.974066  In IP 12.1.1.2.55937 > 12.1.1.1.telnet: . ack 469 win 33304
18:01:22.974190 Out IP truncated-ip - 215 bytes missing! 12.1.1.1.telnet > 12.1.1.2.55937: P 469:692(223) ack 69 win 33304
18:01:23.080077  In IP 12.1.1.2.55937 > 12.1.1.1.telnet: . ack 692 win 33304
^C
191 packets received by filter0 packets dropped by kernel

其中IP truncated-ip比較吸引我注意,為什麼有這個字眼。
查了一下,簡單來說,Juniper 設備monitor traffic的時候預設是96 bytes,但是觀察到的流量是大於96 bytes,所以需要此指令後再加上 size XXX,端看多大,以上例來看,至少要96+215以上的size才不會再看到truncated的字眼。

這個應該不至於會影響服務,只是在判斷問題時,能夠盡快釐清問題罷了。

參考資料:

http://forums.juniper.net/t5/Junos-and-Junosphere/the-monitor-traffic-issue/td-p/94704
 

2013年6月6日 星期四

[網站介紹]Hatch-可套用大量設定腳本的網站

   無聊再找一些資料,發現了這個網站Hatch ,hatch 有孵化的意思。
Hatch有大量的templates的檔案,大概瀏覽了一下,都是一些需要大量config的設定檔範本。

之前找了很多IPSEC的設定,在Hatch裏頭也有這個相關設定。真的還滿獨特的一個網站。
或許有網友也有這種大量設定的腳本可以分享在上頭,讓大家能夠有夠快的時間去設定囉。

2013年5月20日 星期一

偵測到antiwpa.dll 是危害的檔案?


C:\WINDOWS\system32\antiwpa.dll
有的話就加入你所使用的防毒的信任區,或者防毒偵測出來時千萬別點刪除或隔離~
目前知道AVG是親身有抓到此檔案,所以把此檔案按右鍵設定為允許應該就可以避開以下的問題。

這是對岸出的所謂XP一鍵破解生成的,目前已至少15家以上防毒軟體報毒,萬一你剛好是這15家其中一家,下次重開機可能會只剩安全模式進得去喔~
萬一已經進不去正常模式了呢?請在安全模式下把這隻檔案加入防毒的信任區,並重新執行破解程序一次!
這個破解程序會把XP改成OEM版本,而目前並無OEM可用的序號可以找,不用去找什麼KEYFINDER之類的軟體來改了~
建議正常開機以後把資料備份一下,重裝作業系統吧!antiwpa.dll 是不是真的木馬還有很多爭議~~

2012年12月9日 星期日

設備的console突然不能使用

最近處理一件case,用securecrt軟體連接設備的cosole端時
有出現connected的訊息,但是就是沒有畫面出來,試過好多其他軟體也都沒有用!

後來發現遇到這種狀況,只要按一下ctrl + q就可以解決了
 (造成的原因是ctrl + s, 類似鎖定的意思,ctrl + q類似於解鎖的意思)
大概可能發生的狀況就是用習慣win介面,快速鍵的儲存
在  SecureCRT 下 不小心按了 ctrl + s 之後,畫面及按鍵就什麼都沒有了,
這個時候,只要按下 ctrl + q,一切都解決了!!!!