陳柏儒
    • 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 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

    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
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 網路協定分層 ###### tags: `Technology` `Communication` `Internet` ## 五層網際網路協定堆疊 1. **應用層** (Application layer) 2. **傳輸層** (Transport layer) TCP、UDP 3. **網路層** (Network layer) 最主要的3項元件: IP協定、繞送協定(RIP、OSPF、BGP)、ICMP 4. **連結層** (Data link layer) 5. **實體層** (Physical layer) 將個別的位元(bits)從一個節點傳送到下一個節點 ## 應用層 網路應用程式與其協定所在的層級,如:HTTP協定(網頁文件)、FTP協定(檔案傳輸) ## 傳輸層 負責將下層網路層所收到的資料交給上層應用層正確的**行程(process)** 。例如:你正在使用筆電同時下載網頁、執行FTP傳輸和一筆Telnet會談,所以你總共有3筆應用程式行程正在執行,因此當你從網路層收到資料時,傳輸層需要將此資料交給其中一個行程。為端點對端點之間的傳輸。 ### 多工與解多工 (multiplexing and demultiplexing) 行程可以擁有一或多個**socket**,socket是行程跟網路之間的門戶,且每份socket都會有獨一無二的識別碼。而傳輸層實際上也是將資料交給中介的socket而不是行程,如下圖所示。 ![process_socket](https://i.imgur.com/lrY7YSb.png) * **多工(multiplexing)**: 跟不同的socket蒐集資料,並將每份資料片段與標頭資訊封裝再一起建立區段(segment),然後將此區段交給網路層。 * **解多工(demultiplexing)**: 將傳輸層區段(segment)送給正確的socket。 每份區段都需要特殊欄位來指示要交給哪個socket,這些特殊欄位包含**來源端埠號欄位(source port number field)** 及**目的端埠號欄位(destination port number)** 。而每筆埠號都是16位元數字,所以可能埠號為0 ~65535,其中0 ~1023為**公認埠號(well-known port numbers)** ,例如:FTP使用21、SMTP-25、HTTP-80 。 ### 傳輸層 v.s. 網路層 傳輸層是**行程**間的邏輯通訊,網路層是**主機**間的邏輯通訊,舉個比喻。 現在清大跟交大的學生要互相傳送信件,兩邊宿舍都各有一個信件管理員,清大為Bob交大是Cindy,信件管理員負責每天蒐集學生寫的信並送到對方,也要將收到的信分送給學生,而每封信都會寫下學校地址並透過郵政服務傳送到對方。兩校的關係與傳輸層與網路層的關係如下: * 應用程式訊息=信件內容 * 行程=兩校學生 * 主機=學校 * 傳輸層協定=信件管理員 * 網路層協定=郵政服務 信件管理員只會在各自學校處理信件,並不會干涉到他校事務及郵政服務狀況,同樣的,傳輸層只會運作在各自的終端系統上,並不會詢問網路層的服務狀況。 此外,假設有一天Bob跟Cindy一起請假去內灣玩:heart::heart:,由兩個較年輕的Steven和Jane代理,他們收發信件的的方式跟Bob和Cindy不一樣,可能他們的收發信頻率不同,或者是不會保證信件是否送達,這代表他們提供不同的服務模型,類似地,傳輸層提供多種協定給不同的應用程式。 ## 網路層 ## 連結層 ## 實體層 ## 七層OSI參考模型 1. **應用層** (Application layer) 2. **呈現層** (Presentation layer) 3. **會談層** (Session layer) 4. **傳輸層** (Transport layer) 5. **網路層** (Network layer) 6. **連結層** (Data link layer) 7. **實體層** (Physical layer)

    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