蘇美
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: 1082, lsa --- # LSA 期中報告 - 管理 - Book mode https://hackmd.io/@ncnu-opensource/By4H6JLNW [TOC] ## IEEE 802 系列 ### 簡介 - 802 - 制定 LAN 和 MAN 的體系結構 - ![](https://i.imgur.com/ooQA5cF.png) *[圖片來源](https://www.facebook.com/UNAMIDIMTC/posts/definitionswan-wide-area-network-is-a-communications-network-that-spans-a-large-/1268831736516174/) - 802.11 - 無線區域網路 - 802.11b - 使用 ISM 2.4GHz 的頻段,傳輸速度可達11Mbps。 - 廣泛應用:微波爐、藍牙、Wi-Fi 等 - 802.11a - 使用 ISM 5 GHz 的頻段,傳輸速度可達54Mbps。 - 不能與 IEEE 802.11b 進行互操作 - 傳輸距離越短 > 傳輸距離短 - 802.11g - 使用 ISM 2.4GHz 的頻段,傳輸速度可達 54Mbps。 - 可與 802.11b 相容 - 802.11n - 傳輸速度有大幅度的提升 - 傳輸距離增加 - 802.11ax - 又稱為 「 高效率無線標準 」( High - Efficiency Wireless , HEW ) - 支援從 1GHz 至 6GHz 的所有 ISM 頻段 - 目的:在人多的環境下,為更多使用者提供穩定的資料流 (平均傳輸率) :::info ISM 頻段 (Industrial Scientific Medical Band) - 各國挪出某一段頻段主要開放給工業,科學和醫學機構使用 - ISM頻段在各國的規定並不統一 - 2.4GHz為各國共同的ISM頻段 ::: ### 無線網路安全保護 ![](https://i.imgur.com/OXJHBCw.png) *[圖片來源](https://www.guidingtech.com/wpa3-vs-wpa2/) *Key rotation (密鑰旋轉): 加密金鑰不是無期限的,使用密鑰的時間越長,破解的可能性就越大。 因此 Key rotation 是用來生成新的加密金鑰以替換舊金鑰 #### WPA (Wi-Fi Protected Access) - TKIP(Temporal Key Integrity Protocol) > 動態改變金鑰 - 訊息認證碼 > 檢查完整性、身分驗證 #### WPA2 - IEEE 802.11i標準的認證形式 - 利用 AES(Advanced Encryption Standard) 加密 - 用 CCMP (Counter Cipher Mode with Block Chaining Message Authentication Code Protocol) 取代 TKIP ## 鏈路聚合 ### 鏈路聚合介紹 這是一種將多個網路線、網卡或連線簿整合成單一邏輯連線的技術 Link Aggregation 主要可提供以下三種優點: - 增加整體的網路流量傳輸率 (throughput) - 負載平衡 (Load Balancing) - 網路容錯 (Fault tolerance /Failover) - single point of failure: 系統中若某一點故障,就會讓整個系統無法運作 - Redundancy: 擁有備份元件,如果一個元件發生故障,它們將自動啟動 - ![](https://i.imgur.com/o78JSB4.png) *自己畫的 ![](https://i.imgur.com/GHq2I8a.png) *[圖片來源](https://zh.wikipedia.org/wiki/%E9%93%BE%E8%B7%AF%E8%81%9A%E5%90%88) ### 模式介紹 #### 模式 0,循環負載平衡合併頻寬 (Round-robin, balance-rr) - 所有的 port **循序式輪流來作封包的傳遞**。 - 同一時間只有一個 port 在運作。 - 提供負載平衡和容錯能力。 #### 模式 1,自動備援模式 (Active-backup): - **只有一個 port 是 Active 狀態**,其餘都是備援狀態。 - 提供容錯能力。 - 資源利用率較低,在有 N 個網路介面的情況下,資源利用率為 1 / N #### 模式 2,balance-xor - 進階版的 Mode 0 - 根據封包來源和目的地的 MAC_addr Hash 後的值來決定傳輸網路封包 - 路線穩定、可以記錄 state #### 模式 3,fault-tolerance (broadcast) - 把封包送到**所有的連線** - 有很好的容錯機制 - 有浪費資源的嫌疑 、沒有負載平衡、總頻寬是單條網路線的頻寬 ![](https://i.imgur.com/BB4FaPD.png) *自己畫的 #### 模式 4,LACP 鏈路聚合模式 (IEEE 802.3ad Dynamic link aggregation): - 將多個 port 成一個共享相同速度及全雙工的鏈路聚集。 - Switch 需**支援 802.3ad 協定**。 - 在 IEEE 規範內 ![](https://i.imgur.com/hriKoR4.png) *[圖片來源](http://linux.vbird.org/linux_enterprise/0110network.php) #### 模式 5,自動調整傳輸負載平衡 (Adaptive transmit load balancing, balance-tlb): - 封包發送 : 依據各個 port 目前的負載情況 ( 計算相對速度 ) 來作發送的分配 - 封包接收 : 由目前正在運作中的 port 來負責,若此 port 故障,則由另一 port 套用原先 MAC 位址接手。 - 沒有負載平衡 #### 模式 6,自動調整全負載平衡 (Adaptive load balancing, balance-alb ): - **輸入輸出流量皆具有自動負載平衡功能** - 設定上太麻煩 ![](https://i.imgur.com/KuwnENA.png) *[圖片來源](https://www.itread01.com/articles/1476495013.html) ### LACP 連線設定的設定模式與連線類別 - Static (靜態)模式: - switch 兩邊的 port 數量是固定的 - 需設定成 Link Aggregation Group (LAG) 群組 - 無容錯能力 - Dynamic (動態) LACP 模式: - Active : 主動的詢問連結的 port 是否為 LACP,若是的話,就加入 LACP 的連線管理方式 。 - Passive: - 若有被 active 詢問 -> 被動達成連線 - 若沒有被詢問 -> 略過 LACP 連線 - 被動方式的接口可以減少 LACP 協議對 CPU 的消耗。 ### LACP 的小限制 一般來說,switch 上面寫有支援 IEEE 802.3ad 或 IEEE 802.1ax 的,理論上就可以支援啦!另外還有一些小細節要注意: - 不能兩端都是 passive - 所有連結的元件都需要全雙工模式 (備註) - 必須使用相同的資料傳輸速度,例如全部都是 1Gbits/s 的速度才行 :::info #### 備註 ![](https://i.imgur.com/LLfz717.png) *我自己畫的 - 單工 - A 只能發信號,而 B 只能接收信號,通信是單向的 - 就像燈塔之於航船 —— 燈塔發出光信號而航船只能接收信號以確保自己行駛在正確的航線上。 - 半雙工 - 指一個時間段內只有一個動作發生 - 就像早期的對講機等 - 全雙工 - 在發送數據的同時也能夠接收數據,兩者同步進行 - 就像平時打電話一樣,說話的同時也能夠聽到對方的聲音。 ::: ### VLAN ( Virtual Local Area Network ) ![](https://i.imgur.com/UtYNXjo.png) *[圖片來源](https://linuxbg.eu/tag/vlan/) 虛擬區域網路建構於 LAN Switch 的網路管理的技術 - 將一個物理的LAN在邏輯上劃分成多個廣播域的通信技術 - 透過 switch 將封包分派到正確的 port -> 邏輯分群(Grouping)管理 - 增加安全性:不同VLAN內的封包在傳輸時是相互隔離的 #### 運作原理與實作方式 - physical layer: 以 switch 的 port 做為劃分 VLAN 的基礎。 (機房最常用) - data link layer: 以每台主機的 MAC_addr 做為劃分 VLAN 的基礎 - 建立資料庫:MAC_addr 與 VLAN 間的對映關係資料庫 - network layer: 以子網路視為 VLAN 設定的依據。 - Tag-based: 透過在每個封包增加額外的欄位,指定不同的 VLAN 號碼。目前 Ethernet 的 VLAN 標準 802.1Q 就是 Tag-based VLAN。 (常用) #### 加了 Trunk 之後 用在不同的 switch 之間進行連接 跨越多個 switch 上建立的同一個 VLAN 的成員能夠相互通訊 ![](https://i.imgur.com/WDdxahY.png) *[圖片來源](https://www.researchgate.net/figure/Multi-switch-VLAN-with-Trunking_fig3_228635953) ## VPN (Virtual Private Network) ![](https://i.imgur.com/bAmOo4Q.png) *[圖片來源](https://zh.wikipedia.org/wiki/%E8%99%9B%E6%93%AC%E7%A7%81%E4%BA%BA%E7%B6%B2%E8%B7%AF) - 用於連接私人網路的通訊方法。 - 將不同的節點連成私有網路 - VPN協定 - PPTP - L2TP - IPsec - SSL VPN - WireGuard - 使用到的技術包括 - 隧道協定(Tunneling Protocol) -> 是一種資料包封裝技術,在兩個網路間建立一個虛擬隧道,跨越網際網路 - ![](https://i.imgur.com/f4FPHGY.png) *[圖片來源](http://avp.toko.edu.tw/docs/class/3/VPN%20%E8%99%9B%E6%93%AC%E7%A7%81%E6%9C%89%E7%B6%B2%E8%B7%AF%E6%8A%80%E8%A1%93%E6%A6%82%E8%AA%AA(%E7%AA%84%E9%A0%BB).pdf) - ![](https://i.imgur.com/Zprjkbx.png) *[圖片來源](http://avp.toko.edu.tw/docs/class/3/VPN%20%E8%99%9B%E6%93%AC%E7%A7%81%E6%9C%89%E7%B6%B2%E8%B7%AF%E6%8A%80%E8%A1%93%E6%A6%82%E8%AA%AA(%E7%AA%84%E9%A0%BB).pdf) - 加解密技術(Encryption & Decryption) - 密鑰管理技術(Key Management) - 使用者與設備身分認證技術 ![](https://i.imgur.com/A5vEw9K.png) *[圖片來源](http://www.chtglobal.com/enterprise/global-mpls-vpn/details.html) ### MPLS-VPN ( Multi-Protocol Label Switching ) - 有很多標籤 > 可以加快封包傳送 - 應用場景:整個分公司和總部之間 ( 處於一個內網裡 ) - 例如:ISP(Internet service provider) ### Ipsec-VPN - Transport mode - 將封包加上檢查標頭 - ![](https://i.imgur.com/r9ytofM.png) [圖片來源](https://www.slideshare.net/sonangrai/vpnvirtual-private-network-89080116) - ![](https://i.imgur.com/V3bS9UI.png) *[圖片來源](http://avp.toko.edu.tw/docs/class/3/VPN%20%E8%99%9B%E6%93%AC%E7%A7%81%E6%9C%89%E7%B6%B2%E8%B7%AF%E6%8A%80%E8%A1%93%E6%A6%82%E8%AA%AA(%E7%AA%84%E9%A0%BB).pdf) - Tunnel mode - 將整個封包封裝 - ![](https://i.imgur.com/1LydDIJ.png) [圖片來源](https://www.slideshare.net/sonangrai/vpnvirtual-private-network-89080116) - ![](https://i.imgur.com/tmopaAv.png) *[圖片來源](http://avp.toko.edu.tw/docs/class/3/VPN%20%E8%99%9B%E6%93%AC%E7%A7%81%E6%9C%89%E7%B6%B2%E8%B7%AF%E6%8A%80%E8%A1%93%E6%A6%82%E8%AA%AA(%E7%AA%84%E9%A0%BB).pdf) ### wireguard - Simple & Easy-to-use - linux kernel 內建 > 多重認證過得 - 最新的加密技術 - 高性能 - 最小的攻擊面(輕鬆進行安全漏洞審核) :crown: 總之來說它真的好棒棒 ## QoS (Quality of Service) QoS 是一種控制機制 - 根據應用程式的要求,保證資料流的性能達到一定的水準 - 針對不同使用者或不同資料流採用不同的優先順序 - 可以設定最低限度跟最高限度 ### 網路傳輸質與量 定量地測量服務質量 - packet loss - bit rate : 速度 - throughput : 頻寬 - transmission delay - availability - jitter : 讓 latency 維持在一個穩定值(封包到達的時間相差不能太大) ### 解決方案 - Over-provisioning。 - 提供足夠的頻寬 - IntServ(Integrated Service) - 使用資源保留協議(RSVP)來通過網絡請求和保留資源 - DiffServ(Differentiated Service) - 根據其所需的服務類型標記服務的優先順序 - ![](https://i.imgur.com/IxNVGTY.png) *[圖片來源](http://gienmin.blogspot.com/2013/12/qos_18.html) - ![](https://i.imgur.com/jtpBsnU.png) *[圖片來源](http://gienmin.blogspot.com/2013/12/qos_18.html) :::info ### 應用 - 影音串流保障的頻寬 - 性命悠關的應用系統,EX:遠端手術 - Online games - 工業控制系統協議 ### SLA ( Service Level Agreement ) 流量約定依服務等級協議是 service provider 與客戶之間的一項承諾,通用指標包刮: - 正常運行時間 uptime - MTTR (Mean Time To Recover): 服務中斷後恢復所需的時間。 - ASA (Average Speed to Answer): 服務台應答所需的平均時間 - TRT (total resolution time) ::: ## SNMP ### 簡介 SNMP #### 介紹 簡易網路管理通訊協定(Simple Network Management Protocol)是目前網路上用來進行網路管理的通訊協定,最主要的目的在於管理網路上各式各樣的設備,此協定由 3 個元件所組成: - SNMP 管理者(SNMP Manager):用以向代理者查詢被管理裝置的相關資訊。 - SNMP 代理者(SNMP Agent):負責監控及回傳被監控設備的相關資訊。 - 被管理物件(Managed Object):被監控的設備節點,資訊存於 MIB( (Management Information Base )裡。 ![](https://i.imgur.com/0DmBmZe.png) *自己畫的 :::info #### Community 群組分類 設定權限 - SNMP 的安全性建立在社群 (communities) 之上 - 是 Manager 與 Agent 間溝通的密碼(明碼) - 三種權限: read-only, read-write, trap - 預設 public 作為 read-only 的 community 名稱 - 例如可以讀取記憶體和 CPU 的用量 - 預設 private 作為 read-write 的 community 名稱 - 寫入存取,例如可以下達重新開機的命令或是更改組態設定檔 ::: #### MIB (Management Information Base) 架構 - 分為標準(Standard)MIB 及私人(Private)MIB 兩大類,標準MIB適用於所有網路設備,而Private MIB則由設備廠商自行定義。 - 採用樹狀結構,是一種階層式分類。 - 每個節點皆有自己特定的類型,並附有**物件識別碼(Object Identifier,OID)** ![](https://i.imgur.com/33eryao.png) *[圖片來源](https://commons.wikimedia.org/wiki/File:Mib_tree_example.png) - [MIB](https://cric.grenoble.cnrs.fr/Administrateurs/Outils/MIBS/?oid=1.3.6.1.2.1.2.2.1.7) - [ifTable](http://www.net-snmp.org/docs/mibs/interfaces.html) : 裝置介面 ( 路由器、橋接器、閘道器 ) 的公共資訊 :::info ### 輪詢 (Polling) manager 主動向 agent 查詢目前網路的使用情形,藉此收集、分析網路目前的使用情形及所需的管理資訊 #### state polling 監視 MIB 變量的狀態更改:ifOperStatus 和 ifAdminStatus 。 - ifAdminStatus 顯示接口是否已啟用操作 - ifOperStatus 揭示接口是否已成功形成鏈接 ##### [EXAMPLE - Link state polling ](https://www.ibm.com/support/knowledgecenter/SSSHRK_4.2.0/poll/concept/poll_linkstate.html) (補充) ![](https://i.imgur.com/raBIIUR.png) *[圖片來源](https://www.ibm.com/support/knowledgecenter/en/SSSHTQ_7.4.0/com.ibm.netcool_OMNIbus.doc_7.4.0/omnibus/wip/user/concept/omn_usr_el_eventseveritylevels.html) #### 遠程ping輪詢 ( Remote ping polling ) - 特定於企業的設備 MIB 用於驗證設備之間路徑的狀態 - Manager 會指示 Provider Edge (PE)設備定期對與其連接的 Customer Edge(CE)設備執行 ping 操作。 - 這 Cisco 和 Juniper 設備有支援。 #### 閾值輪詢 ( Threshold polling ) - 必須觸發值 ( Trigger threshold Required ) : 當一個或多個 MIB 變量的值超過閾值時,將生成一個事件。 - 可選清除門檻 ( Clear threshold Optional ) : 當 MIB 變量的值低於閾值時,將生成清除事件。 - 如果未指定清除閾值,則當一個或多個 MIB 變量的值不再超過觸發閾值時,將自動清除引發事件。 :arrow_right: 主要用來避免 flapping 的狀況 ##### EXAMPLE - Threshold polling :person_frowning: 監視管理員希望識別所有 Cisco 29xx 路由器的 CPU 使用率大於 75 %。 :female-student: 使用 SNMP 輪詢,管理員可以監視網路中所有 Cisco 29xx 路由器的行為 - 當 CPU 使用率超過 75% 時生成一個事件 - CPU 使用率降至 60 % 以下時生一個事件 - 如果未指定清除閾值,則當 CPU 使用率不再超過 75 % 時,將自動生成清除事件 。 ::: #### 操作指令 SNMP 傳送訊息一般使用 UDP 161 TRAP透過 UDP 162 傳送 ![](https://i.imgur.com/Dukobdz.png) *自己畫的 - GET - Request: Manager 發出要求查詢設備的狀態(一條資訊) - Response : Agent 回應設備狀態 - NEXT Request : 用來反覆得到資訊 - BULK :一次要求**大量資料**。 - SET - Request :由 Manager 下達指令,來**更改 Agent 的設備的狀態**。 - Response : Agent 對於 SET Requset 的回應 - TRAPS : Agent 在發生事件時向 Manager 發出的訊號。 - INFORM - 最初被定義為 Manager 之間的通信 - 後期開放 Agent 與 Manager 的溝通,以確認是否有收到 TRAP 訊息 ### SNMP 版本 #### SNMPv1 1. 沒有定義管理者對管理者的關係 -> 不適合大型的網路環境 2. 無法一次傳送大量的資料 3. 僅提供簡單的身分認證機制,在安全性上具有相當大的疑慮。 #### SNMPv2 - SNMPv2 - SNMPv2c : 採用社群認證 - SNMPv2u : 採用用戶認證 - 封包將包含一個用戶名 - Manager 和 Agent 擁有一個表格紀錄密碼與用戶的關聯 - SNMPv2*: 由企業聯盟開發的獨立協議,不是正式的標準 - 更多的操作類型 - GetBulk 操作所對應的基本操作類型是 GetNext 操作,通過對 Non repeaters和Max repetitions 參數的設定,高效率地從 Agent 獲取大量管理對像數據。 - Trap 封包發出去之後不會收到響應封包,而inform 封包在發出報文之後能收到響應封包。 - 提供了更豐富的錯誤代碼,能夠更細緻地區分錯誤。例如: wrongLength 、 authorizationError 等。 :::info 封包格式 #### SNMP1 ![](https://i.imgur.com/5ImhnR4.png) *[圖片來源](https://www.twblogs.net/a/5bafbea32b7177781a0f4b21) - Community:團體名,用於 Agent 與 NMS 之間的認證。 - 執行 Get、GetNext 操作,則採用可讀 community 進行認證 - 執行 Set 操作,則採用可寫 community 進行認證 - PDU Type:表示本 PDU 的命令型態 - 0 → Get-Request - 1 → Get-Next-Request - 2 → Set Request - 3 → Get-Response - Request ID:當 SNMP Manager 下達某一命令,都會針對每一命令編碼一個 Request ID(隨機變數),SNMP Agent 回應時,再針對哪一個 Request ID 回應訊息。 - Error status:SNMP Manager 所下達的命令無法達成時, Agent 依照錯誤狀態回應給 Manager。 ![](https://i.imgur.com/QV1cK92.png) *[圖片來源](http://216.92.67.219/free/t_SNMPVersion1SNMPv1MessageFormat-2.htm) - Error index:差錯索引。當出現異常情況時,提供變量綁定列表(Variable bindings)中導致異常的變量的信息。 - variable binding:**每一管理物件以《物件名稱,數值》(Object-n, Value-n)** 來表示, - Get 與 GetNext 不理會物件的數值(Value) - **Set 命令表示設定物件的數值**, - **Response 表示回應物件的數值內容**。 #### SNMPv2 ![](https://i.imgur.com/Ohv3k42.png) *[圖片來源](https://www.twblogs.net/a/5bafbea32b7177781a0f4b21) - Non-repeaters:描述本要求訊息中後面可變連結(Variable Binding)中物件事項(Object Instances)不要超過一次擷取資料的數量。 - Max-repetitions:定義最大可以重複擷取的次數。 #### SNMPv3 在網路管理通訊中加入 **以使用者為主的安全性模型**。 - 增加了 USM(User-based Security Model),提供身份驗證和隱私(加密)功能,提高了安全性。 ![](https://i.imgur.com/3lkBabj.png) ##### 新的概念 - snmpEngineID : 一個可管理的域名內的一個SNMP引擎的唯一標識 - snmpSecurityLevel:有三個可能的安全級別 - snmpEngineBoots 自從snmpEngineID最後一次設定以來SNMP引擎重啟或重新初始化的次數 - snmpEngineTime - 自從 snmpEngineBoots 計數器最後一次增加以來的秒數 - 如果 snmpEngineTime 達到最大值(2147483647) -> snmpEngineBoots +1 & snmpEngineTime 再次從 0 開始計數 ##### 封包格式 ![](https://i.imgur.com/RexWjqr.png) *[圖片來源](https://www.itdaan.com/blog/2013/03/11/4b1a4a2172059fcbed109b419fdf575a.html) *[更多詳細解說](https://www.drdobbs.com/snmpv3-user-security-model/199100972) - msgID:msgID 用於協調管理器和代理之間的請求和響應,響應中的 msgID 必須和接收到的請求中的 msgID 相同 - msgFlags:用於指定包是否被認證和是否被加密 - msgSecurityModel :指定安全模型 - 0 > reserved for any - 1 > reserved for SNMPv1 - 2 > reserved for SNMPv2c - 3 > User-Based Security Model ( USM ) - msgSecurityParameters:這些值被用於認證模塊來確保數據完整性和數據源認證 ::: ### TRAP VS Syslog - Syslog:收集日誌以進行故障排除和監視 - 是一種用來在網際網路協定(TCP/IP)的網路中傳遞記錄檔訊息的標準 - 將系統日誌或事件消息發送到特定服務器(稱為syslog 服務器)的標準協議 - ![](https://i.imgur.com/UZ3nMyl.png) *[圖片來源](https://www.paessler.com/it-explained/syslog) - trap:實時收集事件以進行管理和監視 - 冷啟動(coldStart):直接將電腦的電源關閉再打開(電源重啟),讓電腦執行其啟動程式。 - 溫啟動(warmStart):不關閉打開電源的情形下進行的重新啟動或作業系統在溫啟動前關閉所有的程式,以及結束所有未完成的輸入/輸出動作,這種溫啟動也稱為 restart - 介面斷線(linkDown) - 介面恢復(linkUp) - 驗證失敗(authenticationFailure) - 企業專屬事件(enterpriseSpecific) ![](https://i.imgur.com/ncbT6Su.png) - SNMP Trap 警告機制 * 無條件轉送訊息內容 * 有條件轉送訊息內容 1. 依數據條件(最小警報臨界值值與最大警報臨界值) 2. 依字串條件比對 若上述條件成立則為異常事件,將發出警報並觸發系統命令 ### RMON (Remote Monitoring ) - 是一個標準的監視規範 - 監視一整個子網域的資訊 -> 用以協助 manager - RMON1: 負責 OSI 第一、二層 - RMON2: 負責 OSI 第三到七層 - Probes (監視設備)負責收集訊息 ![](https://i.imgur.com/WOm0sjz.png) *[圖片來源](https://www.ques10.com/p/3344/what-is-atm-remote-monitoring-1/) ![](https://i.imgur.com/oAf4UmG.png) *[圖片來源](https://slidesplayer.com/slide/15057071/) | 比較項目 | MIB | RMON | | -------- | -------- | -------- | | 管理範圍 | 單一設備監控 | 代理器所在子網域 | | 功能及目的 | 提供特定主機的資訊 | 提供某個子網域的整體資訊 | | 資訊回報方式 | 對管理者發出即時訊息 | 整合統計資訊後再回報 | |與管理者間的通信型態 | 被動的polling結構 | 使用在問題與要求發生的情況 | :::info ### 比較 #### CMIP ( Common Management Information Protocol ) 與其說它是一個網路管理協定,不如說它是一個網路管理體系 - 優點 - 根據託管對象對管理訊息進行建模,並允許對託管對象進行修改和執行操作 > 勝過SNMP - 完全安全性。它擁有驗證、訪問控制和安全日誌等一整套安全管理方法 - 它的每個變數不僅傳遞訊息,而且還完成一定的網路管理任務。 - 實現了跨組織以及跨供應商的網路管理。 - 缺點 - 在 Internet 上,大多數 TCP / IP設備都支援SNMP,而不支援 CMIP 。 這是因為 CMIP 代理和管理系統的複雜性和資源要求 。 - 它是一個大而全的協定,所以使用時,其資源占用量是SNMP的數十倍,對硬體設備的要求過高。 :arrow_right: 主要受電信設備支援 ::: ### LAB1 ``` sudo apt install snmp snmpd sudo apt install snmp-mibs-downloader ``` ``` echo 'rocommunity public' > /etc/snmp/snmpd.conf ``` 重新啟動snmpd ``` service snmpd restart ``` 用 snmp 輸出其他系統資訊 ( Ex: 輸出記憶體的總容量 ) - -v 1 或 2 代表snmp版本 - -c 連結 SNMP 的 Community ``` snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.4.5.0 ``` ### LAB2 MRTG 是一套可用來繪出網路流量圖的軟體,它利用了 SNMP 送出帶有物件識別碼(OIDs)的請求給要查詢的網路設備。 網路設備的流量圖、伺服器的硬碟使用量、CPU 的負載 安裝apache ``` sudo apt-get install apache2 ``` ``` $ sudo vim /etc/snmp/snmpd.conf rocommunity public localhost ``` 重新啟動進行更改 ``` $ sudo systemctl restart snmpd ``` 安裝mrtg ``` $ sudo apt-get install mrtg ``` MRTG工作目錄 ``` mkdir /var/www/mrtg ``` 將所有者更改為 www-data,是 Apache Web服務器的預設用戶帳戶。 ``` chown -R www-data:www-data /var/www/mrt ``` ``` cat /etc/mrtg.cfg | grep -v "^#" ``` WorkDir: /var/www/mrtg WriteExpires: Yes Title[^]: Traffic Analysis for ``` cfgmaker public@localhost > /etc/mrtg.cfg #cfgmaker 是 mrtg 做某設備 run 網頁跟圖形的 config 產出器 ``` ``` ls /var/www/mrtg/ ``` ![](https://i.imgur.com/DrxoibU.png) ``` indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html ``` ``` vim /etc/apache2/sites-available/mrtg.conf ``` 編輯mrtg.conf ``` <VirtualHost *:80> ServerAdmin admin@yourdomain.com DocumentRoot "/var/www/html/mrtg" ServerName 10.0.2.15 <Directory "/var/www/html/mrtg/"> Options None AllowOverride None Order allow,deny Allow from all Require all granted </Directory> TransferLog /var/log/apache2/mrtg_access.log ErrorLog /var/log/apache2/mrtg_error.log </VirtualHost> ``` ``` sudo a2ensite mrtg ``` ``` systemctl reload apache2 ``` 開啟瀏覽器輸入 http://ip-address/mrgt ![](https://i.imgur.com/UPjJoCT.png) ## 參考資料 - http://avp.toko.edu.tw/docs/class/3/VPN%20%E8%99%9B%E6%93%AC%E7%A7%81%E6%9C%89%E7%B6%B2%E8%B7%AF%E6%8A%80%E8%A1%93%E6%A6%82%E8%AA%AA(%E7%AA%84%E9%A0%BB).pdf - https://www.slideshare.net/sonangrai/vpnvirtual-private-network-89080116 - https://linoxide.com/linux-how-to/install-configure-mrtg-ubuntu/ - http://linux.vbird.org/linux_enterprise/0110network.php - https://www.guidingtech.com/wpa3-vs-wpa2/

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully