8月 13, 2020

京東買紅米 Note 8 Pro

因為台灣不進新機,只能跨海從京東訂陸版紅米 Note 8 Pro,人民幣依匯率(4.19)換算約$4500台幣,免運直送一週可到超商,物流速度算是不錯。

小米手機介面可以預期,但開機後仍會訝異,滿坑滿谷來自對岸的應用程式!其實MIUI介面發展很久,實際也整合的很好,但陸版沒有GMS(Google Mobile services),所以一般常用軟體無法以正當管道取得,這真的要刷機了!至於大家在意的個資問題或許只能無視。

.出廠版本:MIUI 穩定版 11.0.4 (PGGCNXM) ... 陸版
.刷機版本:MIUI Global 11.0.6 (PGGMIXM)

刷完機要用 ADB 移除的套件有:
adb shell pm uninstall --user 0 [package name]

com.miui.msa.global
com.miui.analytics

com.miui.hybrid
com.miui.hybrid.accessory
com.miui.yellowpage
com.miui.notes
com.xiaomi.midrop
com.xiaomi.glgm
com.miui.fm
com.mi.android.globalFileexplorer
com.miui.videoplayer
com.miui.player 
com.miui.compass
com.xiaomi.scanner
com.miui.cleanmaster

com.android.browser 預設瀏覽器
com.android.calendar 預設日曆
com.mi.android.globalminusscreen 資訊(智能)助理

7月 02, 2020

Juniper EX2300 VLAN 設定

在 Juniper 交換器中要讓不同 VLAN 可以互通,首先要瞭解什麼是 IRB(Integrated Routing and Bridging) 介面:
When Should I Use an IRB Interface or RVI?
To forward packets between VLANs, you normally need a router that connects the VLANs. However, you can accomplish this forwarding on a switch without using a router by configuring an integrated routing and bridging (IRB) interface.
  • Allow traffic to be routed between VLANs.
  • Provide Layer 3 IP connectivity to the switch.
配置架構: [L3 IRB.X] -- [VLAN.X] -- [PHY port] 其中 X 為邏輯介面,不同 VLAN 對應之。

root# show interfaces irb | display set
set interfaces irb unit 70 family inet address 192.168.70.254/24
set interfaces irb unit 80 family inet address 192.168.80.254/24
root# show vlans | display set
set vlans vlan70 vlan-id 70
set vlans vlan70 l3-interface irb.70  /* 把 vlan70 與 irb.70 綁定 */
set vlans vlan80 vlan-id 80
set vlans vlan80 l3-interface irb.80
root# show interfaces | display set
set interfaces ge-0/0/0  unit 0 family ethernet-switching vlan members vlan70
set interfaces ge-0/0/1  unit 0 family ethernet-switching vlan members vlan70

set interfaces ge-0/0/12 unit 0 family ethernet-switching vlan members vlan80
set interfaces ge-0/0/13 unit 0 family ethernet-switching vlan members vlan80

Junos: 18.1R3.3

6月 21, 2020

Juniper EX2300 LACP 設定

依據 Juniper 線上說明

The LACP mode can be active or passive. If the actor and partner are both in passive mode, they do not exchange LACP packets, which results in the aggregated Ethernet links not coming up. If either the actor or partner is active, they do exchange LACP packets.

By default, LACP is turned off on aggregated Ethernet interfaces. If LACP is configured, it is in passive mode by default. To initiate transmission of LACP packets and response to LACP packets, you must configure LACP in active mode.
  • LACP 有兩種運作模式,當兩方設備皆為 Passive 則 LACP 機制不會啟動,必定要有一者為 Active 才能觸發。
  • LACP 功能預設不啟用(在AE介面上),啟用後預設是 Passive 模式。

實際 LACP 指令


★ 範例綁定 10G 介面(XE0/1/1、XE0/1/2),配置後的設定檔

# 設定全域 LACP 組數,創建 AE(Aggregated Ethernet) 介面
> set chassis aggregated-devices ethernet device-count 10
> set interfaces ae0 aggregated-ether-options lacp active

# 連接埠作為 AE 成員,不能帶邏輯(unit 0)介面
> delete interfaces xe-0/1/1 unit 0
> delete interfaces xe-0/1/2 unit 0

# 因 LACP 要綁定多個連接埠,故停用 RSTP 防護
> delete protocols rstp interface xe-0/1/1
> delete protocols rstp interface xe-0/1/2

# 連接埠放入 AE 群組
> set interfaces xe-0/1/1 ether-options 802.3ad ae0
> set interfaces xe-0/1/2 ether-options 802.3ad ae0

# 允許 AE 處理不同 VLAN 封包(Trunk)
> set interfaces ae0 unit 0 family ethernet-switching interface-mode trunk
> set interfaces ae0 unit 0 family ethernet-switching vlan members default

# 列出 LACP 介面
> show lacp interfaces


# 列出 LACP 統計資料
> show lacp statistics interfaces ae0

6月 18, 2020

Juniper EX2300 基礎設定

手上這台機器是 Juniper EX2300-48T 交換器,
韌體版本為 Junos: 18.1R3.3  (配置後的設定值)

# 回復為出廠值(要一併指定root密碼才能commit)
> load factory-default
> set system root-authentication plain-text-password
> commit

# 回復出廠值,抹除所有資料(費時)
> request system zeroize

# 檢查設定有無問題,然後進行commit
> commit check

# 列出未 commit 部份差異性
> show configuration | compare

# 列出過去 commit 記錄
> show system commit

# 刪除自動更新印象檔
> delete chassis auto-image-upgrade

# 設定 root 密碼
> set system root-authentication plain-text-password

# 設定主機名稱
> set system host-name EX2300-3F

# 設定校時(NTP)主機並強制刷新時間
> set system time-zone Asia/Taipei
> set system ntp server 118.163.81.61
> set date ntp force

# 啟動 SSH 連線服務,並允許 root 可以遠端登入
> set system services ssh
> set system services ssh root-login allow

# 啟用 WEB(HTTP) 管理介面
> set system services web-management http port 80

# 啟用 WEB(HTTPS) 加密管理介面
> set system services web-management https system-generated-certificate
> set system services web-management https port 443

# 設定路由
set routing-options static route 0.0.0.0/0 next-hop 10.38.105.254

# 設定管理 IP
root# delete interfaces irb.0 family inet dhcp
root# set interfaces irb unit 0 family inet address 10.38.105.248/24
root# show interfaces irb
unit 0 {
    family inet {
        address 10.38.105.248/24;
    }
}

root# show vlans
default {
    vlan-id 1;
    l3-interface irb.0;
}

root# show routing-options
static {
    route 0.0.0.0/0 next-hop 10.38.105.254;
}

# 設定目前配置為救援回復值 (消 ALARM燈號)
> request system configuration rescue save

# 將設定值轉存到檔案中
> show | save config.txt

# 針對 system/ntp 區塊加入註解(Annotate)
> edit system
> annotate ntp "Sync with AD server"

4月 13, 2020

FortiGate 防火牆物件最大表(Maximum Values Table)

在 Fortigate 的設計中,每個網路位址與管理項目都看作是一個物件,防火牆物件儲存量依各型號有所不同。對照表可見 Maximum Values Table(或handbook),而數量限制則有全域(global)、虛擬域(VDOM)兩個分類。
All objects in the maximum values table have either a global limit, which applies to the entire FortiGate configuration, or a VDOM limit, which applies only to a single VDOM.

例如像「IP pools 1024」這就是每個 VDOM 各自有 1024 筆額度;
而「Addresses 20000」則是整台防火牆共可存放二萬筆位址。

在防火牆上可透過指令 print tablesize 進行查詢。
手上的機器 FortiGate 300D:位址物件(整台)20000筆、位址群組(整台)2500組、每個群組可有300筆位址物件。

4月 10, 2020

透過 Websocket 讀取健保卡

1. 安裝後端元件

2. 讀卡指令(Websocket)
$(document).ready(function(){ connectws(); });
function connectws()
{
  wsUri = "wss://iccert.nhi.gov.tw:7777/echo";  /* Backend */
  websocket = new WebSocket(wsUri);
  websocket.onopen = function(evt) { onOpen(evt) };
  websocket.onclose = function(evt) { onClose(evt) };
  websocket.onmessage = function(evt) { onMessage(evt) };
  websocket.onerror = function(evt) { onError(evt) };
}
function ws_GetBasic() { $("#name").html(""); websocket.send("GetBasic"); }   
function onOpen(evt) { $("#state").html("健保卡元件/正常"); }
function onClose(evt) { $("#state").html("Not connected"); }
function onMessage(evt) 
{ 
  var message = evt.data;
  if (message.substring(0, 9) == 'GetBasic:')
  {
    var res = message.split(",", 5);  
    // Data in res[1] ~ res[3]
  }
}
function onError(evt) { $("#state").html("健保卡元件/失敗" + evt.data); }

3月 02, 2020

Debian 安裝 nginx 與 PHP-FPM

安裝套件(有關 PHP-FPM 說明)
# apt install nginx php-fpm php-mysql
# apt install mysql-server
修改配置檔 /etc/nginx/sites-enabled/default
# SSL configuration
listen 443 ssl default_server;
ssl_certificate         /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key     /etc/letsencrypt/live/domain.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/domain.com/chain.pem;
include snippets/ssl.conf;

# With php-fpm (or other unix sockets):
location ~ \.php$ {
  fastcgi_pass unix:/run/php/php7.3-fpm.sock;
  include         fastcgi_params;
  fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
  fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;        
}

11月 09, 2019

HTC U11 手機維修記

第一次碰到手機完全打不開,充電也沒用的狀況。趕時間只能送去外廠修...大概一個小時就處理好了,只不過代價就是有點貴,尤其在知道電池的成本後。

4月 07, 2019

Pentium G5400 ASUS PRIME H310M-K R2.0

再組一台長輩機,近期固態硬碟(SSD)價格大跳水,可能再過一年容量就會逼近傳統硬碟了。
傳統硬碟 1TB 目前大約是 $1300 左右,固態硬碟價格則是 240G($1000)、480G($1700)。
  • Intel Pentium G5400 , $2150
  • 華碩 PRIME H310M-K R2.0 (裝機版四年保) , $1990
  • 金士頓 UV500 120G (TLC顆粒/五年保) , $750
  • 威剛 8G DDR4-2666 , $1250
  • 全漢 聖武士350W (全日系DC-DC/五年保) , $990
  • Fractal Design the Core 1100 , $990
Total = $8,120



同場加映...友人委託的另台電腦
  • Intel Core i3-8100 , $4300
  • 技嘉 B360M DS3H (四年保) , $2750
  • 金士頓 UV500 240G (TLC顆粒/五年保) , $1130
  • Toshiba 1TB , $1190
  • 威剛 8G DDR4-2666 , $1250
  • 全漢 聖武士350W (全日系DC-DC/五年保) , $990
  • Fractal Design the Core 1100 , $990
Total = $11,850 (CPU+板子優惠$6300)



最後總結,這次選的機殼非常好,不論質感跟空間運用都極其恰當,對於只有簡單需求的使用者「一張小板mATX + 3.5吋硬碟 + 2.5吋SSD」都能塞的下。

12月 12, 2018

Node.js on macOS

Node.js 官網的安裝檔(10.14 LTS)會新增下列資料:
  • /usr/local/bin/{node, npm, npx}
  • /usr/local/lib/node_modules
  • /usr/local/include/node
反安裝方式可參考 stackoverflow 這篇文章

9月 12, 2018

快速轉移 Fortigate 防火牆設定檔

原始設備:FortiGate FG-300C、目標設備:FortiGate FG-60D

防火牆介面「管理模式」分為兩類:

Switch Mode(單一規則管理所有連接埠)
In this mode, all ports are grouped to a single switch, represented as "internal"
Interface Mode(各連接埠規則皆獨立)
In this mode, each port is independent and is represented as port1 through port7.
在較小型號的 FortiGate 上,連接埠命名預設是 WAN/DMZ/Internal,系統預設所有的 Internal Ports 皆套用到同一組 Policy;大一點型號的 Fortigate 則將連接埠直接命名為 Port1~portN。

想把設定值硬套過來,要先改變 Port 的對映方式,例如 (Port1, WAN1)、(Port5, Internal2)




9月 07, 2018

2018 Essilor 新眼鏡


  • 2018-09-07 / $5500
  • 依視路 鑽潔®E-SPF濾藍光鏡片(A4鍍膜)

8月 21, 2018

[PL2303] 在 macOS 下連線路網路設備(USB to RS232)

PL2303 安裝驅動後,在 macOS 終端機直接用 screen 指令即可透過 RS232 連接設備:

screen /dev/tty.usbserial 9600