陳彥夫
    • 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ###### 撰寫日期:2023/07/19 ###### 作者:陳彥夫 # IGMP網際網路群組管理通訊協定 {%hackmd BJrTq20hE %} 負責管理multicast成員的通訊協定 ### 參考資料 [IP Multicast Technology Overview](https://www.cisco.com/c/en/us/td/docs/ios/solutions_docs/ip_multicast/White_papers/mcst_ovr.html#wp1009068) [IGMP基础](https://www.cisco.com/c/en/us/td/docs/ios/solutions_docs/ip_multicast/White_papers/mcst_ovr.html#wp1009068) # IGMPv1 IGMP查詢路由器每隔一段時間發送Membership query給主機的地址(假設224.0.01),有啟用multicast的主機就會接收query,然後回傳report,表示他要接收這個組發的mullticast封包。 IGMPv1中運行查詢的路由器由群播路由協定決定。主機透過不回應query來退出群組。 * 封包類型:Membership query(0x11)、Menbership report(0x12) * Membership query封包:查詢器週期性發送訊息給網路上所有主機 * Menbership report封包:若是對某個組的訊息感興趣,就會回傳此訊息給查詢器以表示加入群組 * Version:版本值為1 * Type:0x11為query封包,0x12為report封包 * Unused:預設為0,接收時被忽略 * Group address:multicast地址,query封包中為0,report封包中為加入的群組地址 ![IGMPv1封包](https://img.onl/jAY63g) RouterA向224.0.0.1(區網內所有主機和路由器)發送query訊息,收到的組成員開啟計時器(0~10s)。 HostA計時器超時,發送G1report訊息。如果HostB收到,就會暫停計時器停止送G1report訊息以減少網路上的流量。 RouterA在收到HostA的report訊息就知道G1有成員,由群播路由協定產生(*,G)的群播轉發表。 ![](https://img.onl/LQRZFR) ## 新成員加入 HostC不等待query訊息來,自己主動發送G2report以加入G2。 RouterA收到report後,知道了G2的成員,則產生群播轉發表(*,G2) ![](https://hackmd.io/_uploads/Hkg9bNUc3.png) ## 離開機制 IGMPv1沒有定義離開組的訊息 * 假如HostA想退出G1,就不再發送G1report的封包,但是因為區網中還有HostB會繼續發送G1report的封包,所以RouterA不會察覺HostA的離開 * 假如HostC想退出G2,就不再發送G2report的封包,但因為區網中不存在其他G2成員,RouterA則會在一定時間內刪除G2的群播轉發表 # IGMPv2 IGMPv2機制和v1大致相同,而v2增加了離開群組的機制。 * Type: 0x11Membership query:General-Group query和Group-specific query 0x12Membership report:IGMPv1\0x16membership report:IGMPv2 0x17Leave:離開的訊息 * Max resp time:成員在接收query訊息時要再最大響應時間內回復 * Group address:General-Group query中為0.0.0.0,Group-specific query為要查詢的群播地址,在membership report中為要加入的群播地址 ![](https://hackmd.io/_uploads/r1B1GEU5n.png) ## 查詢器選舉 1. 最初所有運行IGMPv2的RouterA、B都以為自己是查詢器想本地所有主機和路由器發送query訊息.在RouterAB都收到對方的query訊息後將封包的srcIP和自己端口的IP地址做比較,地址較小的就會成為查詢器。 2. 之後就由查詢器RouterA向區網內所有的主機和路由器發送General-Group query。routerB則會啟動一個計時器,在計時器超時前收到A的封包就會重置,若超時就會重啟選舉過程 ![](https://hackmd.io/_uploads/HJpFr4Lq3.png) ## 離開群組機制 1. HostA向本地所有的組播路由器(224.0.0.2)發送G1leave的訊息 2. 查詢器在收到leave訊息後會發送G1query的訊息,同時啟動計時器Timer-Membership 3. 若還有G1組還有成員則會在收到query後繼續發送report封包以維護組成員的關係 4. 若G1組沒有成員,在計時器超時後就會刪除(*,G1)的群播轉發表 ![](https://hackmd.io/_uploads/BJQ2SEIc3.png) # IGMPv3 IGMPv3訊息:query和report兩類,沒有定義成員leave的訊息 Query新增Group-and-Source-Specific Query:用於查詢該組成員是否願意接收特定來源的流量。 Membership report新增filter mode:INCLUDE/EXCLUDE表示想要接收那些特定來源的流量。 ## 封包類型 S:若該值為1時,所有收到此query訊息的路由器不啟動 計時器 QQIC:IGMP查詢器的query間隔(秒)。 Number of source:封包中群播來源的數量。對於 General-Group query和Group-specific query來說這個值是0, 對於Group-and-Source-Specific Query為非0。 ![](https://hackmd.io/_uploads/rJNddEUch.png) ## IGMPv3 record type IGMPv3 report訊息的目的地是224.0.0.22,透過訊息中攜帶的group record在加入組的同時還能要求接收或不接受特定來源的群播封包. Type record:MODE_IS_INCLUDE、MODE_IS_EXCLUDE、CHANGE_TO_INCLUDE_MODE、CHANGE_TO_EXCLUDE_MODE、ALLOW_NEW_SOURCES、BLOCK_OLD_SOURCES 透過更改fliter mode來加入或離開群組。 CHANGE_TO_INCLUDE_MODE表示從exclude到include,將接收include表中的來源流量,如果表是空的則會離開群組。 CHANGE_TO_EXCLUDE_MODE表示從include到exclude,將拒絕exclude表中的來源流量,如果表是空的則代表加入群組。 對應到[mininet實驗](https://hackmd.io/VDzwloB6QNq92zQ-w-svuA?view) CHANGE_TO_INCLUDE_MODE離開群組 ![](https://hackmd.io/_uploads/BJuiYV853.png) CHANGE_TO_EXCLUDE_MODE加入群組 ![](https://hackmd.io/_uploads/rkvTFNL5n.png) # IP multicast address 群播地址是一群主機加入的組并且對特定群播流量感興趣 IP class D address:224.0.0.0~239.255.255.255 224.0.0.0~224.0.0.255 路由器不會轉發這些地址出區網外 ex:224.0.0.22 IGMPv3 report、224.0.0.1 發送到子網路中的所有系統 ## layer 2 multicast mac address mapping IPv4 => MAC MAC 映射範圍01:00:5e:00:00:00 到 01:00:5e:7f:ff:ff ![](https://hackmd.io/_uploads/By_is4Lq3.png) 由於IP轉MAC地址時有5位元被捨棄因此224.128.1.1 、224.0.1.1、239.128.1.1 等IP地址都會被映射到 01:00:5e:00:01:01,如下圖。 ![](https://hackmd.io/_uploads/r15en4Iq3.png) 如果一個用戶訂閱了A組(如 224.1.1.1),而其他用戶訂閱了B組(如 225.1.1.1),則他們A和B的封包都會接收。 ## IGMP snooping 預設的layer2 switch會把所有的群播流量發送到目標區網的每一個port。switch監聽主機和路由器之間的IGMP report massage。根據收到的port建立群播轉發表。 ![](https://hackmd.io/_uploads/SkA7JS8ch.png)

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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