aFish
    • 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 --- # Week7 - Book mode https://hackmd.io/@ncnu-opensource/By4H6JLNW ## 虛擬化 part 2 [本日報告組別共筆](https://hackmd.io/LAfo8U5CTpSvUXheIEO5MQ?both) [簡報:嘿! 我想了解 虛擬化!](https://docs.google.com/presentation/d/1KNHJIlPJUG_Vs8UR4ZpiBm-H3SfdaNafSryJ8gTAPVs/edit#slide=id.g836db8aaab_2_8) ### Container vs VM - VM: 需安裝 OS,效率差,體積龐大 - Container: 以 Process 為主進行虛擬化,不須從底層開始,效率較好,體積輕便 :::info <span class="bt"> &nbsp;BT 補充&nbsp; </span> VM 也可以做敏捷開發,But 沒有聽說有人這樣做 Why? 因為做敏捷開發時,需要建立一個乾淨的環境來做測試,如果每次都要用 VM 來做,那太花時間成本了,因此通常都是使用 Container ::: ### 敏捷開發 `CI(Continuous Intergration )` 持續整合,將 Program 放到模擬機器中 `CD(Continuous Deployment)` 把已經整合的 Program,放到目標機器 ||VM|container| |---|---|---| | 特點 |安全性較高 |較效率、較輕量| |適合情境|需要完整 OS 的環境、比起速度更要求安全的應用|輕量化的服務與軟體佈署| | |須管理、更動系統底層的應用 |移植性更高的應用情境| |啟動程序|要呼叫開機程序... |只呼叫執行檔| :::info <span class="bt"> &nbsp;BT 補充&nbsp; </span> About 需要完整 OS 的環境 其實 Container 裡也可以安裝完整的 OS LXC: Linux 早期發展使用的工具,這玩意通常是把輕量的作業系統包進去 Ex: 海聯今天需要一個環境,計中要給 VM or Container? Container 因為跟所有人共用 Kernel,因此還是有風險的 ==總結==: 給一般使用者通常可控性較低,因此為了安全,還是給 VM 若是一個公司內部做一些部署,可控性高,用 Container 會節省非常多資源 ::: ## SELinux & AppArmor - LSM 即 Linux Security Modules (Linux 安全模組) ## Binary Translation ![](https://i.imgur.com/oIaZl0D.png) - OS can be virtualized with the help of Binary Translation and direct execution-based technique - Guest OS 的 kernel code 須先經由 hypervisor去做 Binary translation 才能對 正在運作的VM 產生作用 - The hypervisor gives virtual machines all the services provided by the hardware such as virtual BIOS, virtual memory, and access to virtual devices - VMM 會先識別特權與敏感指令,並將他們放在 VMM 中,並模擬這些指令的行為,其中使用的方法稱為 二進位制轉譯 - 全虛擬化中將二進制轉譯和直接執行結合在一起,guest OS 與 硬體完全被分離(decoupled) ,guest OS 不知道指令已被虛擬化 ## 網路虛擬化 - 軟體定義網路(SDN) - 網路功能虛擬化(NFV) ### 傳統網路架構 ![](https://i.imgur.com/NzDeO2G.png) - STP 生成樹協議: - 可以避免網路風暴(Broadcast Storm) - 核心層(Core Layer) - 為進入資料中心的封包提供高速轉發 - 為多個匯聚層提供連線性,Core Switch 為通常為整個網路提供一個彈性的 L3 路由網路 - 匯聚層(Aggregation Layer) - 通常至少兩台以上,避免其中一個出包 - 可以做為防火牆等 - Aggregation switch 連線 Access switch,同時提供其他的服務,例如防火牆,SSL offload,入侵檢測,網路分析等 - active-passive的 HA模式 - STP使得對於一個VLAN網路只有一個匯聚層交換機可用,其他的匯聚層交換機在出現故障時才被使用(上圖中的虛線) - 存取層(Access Layer) - 通常位於機架頂部,所以它們也被稱為 ToR(Top of Rack)交換機,它們物理連線伺服器 :::info <span class="bt"> &nbsp;BT 補充&nbsp; </span> 以宿網來講,宿舍的每個網路孔每台電腦都可以插到 Core Switch,但是會非常貴(頻寬問題,交換能力越高,越貴),因此宿舍的每一層樓或每幾個房就會有一個 Access Switch 來收集,然後再用一台等級差不多的 Switch 做彙整,再打入計中 Ex: 在宿舍電腦開一個網路芳鄰,大概就只會連到附近的電腦,這些流量並不需要去 Core ,在 Local 就可以處理掉 買 Switch 的時候,上面可能只有少少的 port,但是可以透過連接多個 Switch 的方式讓能交換的電腦變多,但是要注意的是,如果都是 L2 的 Switch,只透過 Mac Address,那他就必須要去記錄現在收到的 Mac address 是他的哪個 Port 下面哪台 Switch 的,因此需要注意 Switch 的記憶體大小(能記憶多少 MAC address),如果下面的 Switch 都用 48 port 的,那就完了,因為實在太多了,所以在部署的時候需要注意這個小細節 Q: 幾千跟幾萬的 switch 差在哪? A: 有沒有提供控管的能力 一般機房會有三個 Plane Data Plane Control Plane Manage Plane ::: - RIP(Route Information Protocol) - 只能在小型網路(x? - 該封包不能走太久,到了就死 - OSPF(Interior GateWay Protocol) - LSA (Link-State Advertisements) - 可以用在比較大、複雜的網路環境(x? - 計算到哪比較好(最短路徑) - 網路拓撲資料庫(Topological Database) - 最短路徑優先演算法(SPF) - 最短路經優先(SPF)樹狀結構 - 存放網路路徑的Routing Table - BGP(Border Gateway protocol) - 可以支援不同種協議中的流通 - 向量性協定 - 紀錄該區路由狀態 - [bgp hijacking](https://www.ithome.com.tw/news/136758) :::info <span class="bt"> &nbsp;BT 補充&nbsp; </span> 一般借處不到BGP, 只有計中 沒有一台 switch 可以記住全世界每一個 mac addr 或一個網路為小的變動 例如 : 學校有兩條線路,一條連中興,一條連成大,那要怎麼連到國外? 因此每一個組織或自治單位,都會有一個對外的 Router,透過申請取得一個 as number 告訴周圍的 Router ,他可以處裡送往某個網段的封包,充滿了互相信任 因此 BGP 非常不安全,如果你偽造或不小心打錯 as number,就可能導致整個世界的網路 GG 所以在部署網路的時侯,會一直 traceroute 去監控,避免被劫持封包,發現有什麼不對,就趕緊處理 ::: ### SDN ![](https://i.imgur.com/XpQRwRv.png) 將傳統網路中,管理網路的**控制面(Control Layer)**與**資料層(Data Layer,或又稱Forwarding Layer,意思為傳送封包的轉送面**分離開來,將網路的管理權限,交由控制層的控制器(Controller)軟體負責 - SDN structure - Application Layer - Control Layer - 網路控制的核心 - SDN Controller - 包含許多控制模組 (Control Program/Bundle) - Infrastructure layer - Switch 設備 - 提高網路使用資源率 - 集中管理網路 :arrow_right: 大幅提升網路資源控管與使用效率 - 傳統網路設備為一個封閉、分散式架構,網路設備為分散式的自主學習,但對於網路使用者及應用服務來說,使用者無法確切掌握應用服務的網路封包流向及路徑,導致管理彈性不佳 - 強調管路管理的集中化與可程式化 - SDN 負責維護所有的網路架構,網路中所有的資料傳輸路徑皆由網路來定義 - focus : 網路 - 虛擬化 2-3 層 - 維護上僅需對 Controller 進行更改,降低營業費用(operating expense, OPEX) 的支出 ### NFV ![](https://i.imgur.com/g5qQOef.png) - 將實體設備的網路以軟體型態呈現 - 著重在將網路功能虛擬化 ![](https://i.imgur.com/MlTWXv4.png) - 優勢 : 降低 power usage (現在機房計價方式) - 提升服務部屬靈活性 - focus : 設備 - 虛擬化 4-7 層 ### SDN vs NFV | | SDN | NFV | | -------- | -------- | -------- | | Strategy | Control Layer 與 Data Layer 分離<br>集中化網路控制<br>重構網路架構 | 軟體與硬體分離 <br> 網路功能虛擬化 <br> 改變設備型態 | |BENEFIT |智能化控制網路<br>網路資源靈活調度<br>減少成本<br> **提高網路資源使用率**|快速佈屬多樣化業務需求<br>基礎設備利用率提升<br>加快產品和新業務推向市場的速度,因為無需改變硬體<br> **提升服務佈屬靈活性** <br>| | protocol | OpenFlow | 尚未被定義 | |Formalization| Open Network Foundation (ONF)|ETSI<br>NFV Industry Specification Group (ISG)| |OSI|2~3層|4~7層| |ORGIN|起源於 Campus <br>成熟於 Data center|Created by service provider(服務供應商)| :::info <span class="bt"> &nbsp;BT 補充&nbsp; </span> NFV 通常在一般的標準平台都可以裝,提供一個管理功能 一般機房機器掛掉的時候,會直接急 CALL 工程師來修,但這中間的 DOWN TIME 很長,錢依然在損失,而如果全部都軟體化的話,可以減少 down time 其實很多東西從硬體轉向軟體,並很多都從特規硬體轉向一般硬體,為的是降低成本增加靈活性等 但是這些一開始設計成這樣是有目的的,如果直接把東西都轉到軟體,那效率是會降低的 那如何兼顧效率和管理彈性? FPGA(Field Programmable Gate Array) - 可直接燒錄邏輯閘 Router和switch的補充 router 處理IP層的資料交換,可以跨網段作資料的交換 ::: ### Lab https://hackmd.io/gW7GbdtWRe-3_kvrnRML1w?view <style> .bt { background-color: gray; color: white; font-size: 20px; font-weight: bolder; border-radius: 50% 20% / 10% 40%; } </style>

    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