林廣哲
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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
    --- title: 網路課 week4 筆記 tags: 網路課tcp/ip --- # 網路課 week4 筆記 [上一頁](https://hackmd.io/@yAywlvh8QrOW-y_aYbMdCQ/r1mPzgOZo) ![](https://i.imgur.com/zbhCouD.png) ### TTL 1. 限制封包可以傳多遠 每經過一個路由器就-1 直到TTL=0 還沒送達就丟棄 送一個ICMP封包(功用:1.控制2.錯誤回報) 2. 防止故障 網路發生錯誤時,避免封包一直存活在網路上 不同OS送的封包TTL可能不同 所以可以由封包TTL回推 傳送方的OS ### Header Checksum (檢查標頭有沒有發生錯誤) 1. 第一欄Ver Version(4 bits) 0100(ipv4) 0110(ipv6) 2. 第二欄IHL Internet Header Length(5個單位= 20 byte) 一個單位是4個byte 若大於5個單位 代表有選擇項 若<5個單位 代表是錯誤的 正常來說: IPv4 header:20 byte TCP header:20 byte UDP header:8 byte 3. 第三欄TOS Type Of Service 封包送出去希望有甚麼服務 Precedence 3 Bits 優先權(最小0~最大7) 1. D Delay 封包送出去到接收到的時間差 若D設為1 代表 不希望Delay ex:即時通訊 (Delay sentitive) 若D設為0 代表 不需要即時性 ex:備份 **應用程式通常分4類** 1. 語音類型 重視 延遲時間 資料量小(PCM編碼 每秒取樣8000次 每個sample 8個bit) 所以所需頻寬為 64kbps 壓縮後可能只需2~3kbps 2. 影音類型 影像(ex:看youtube或直播)對延遲要求不高 因為可以透過Buffering(緩衝)吸收網路的抖動 但是對頻寬的要求比較高 (720p 1080p 4K...所需頻寬漸高) 聲音 對延遲的要求 希望從 接收到>編碼>壓縮>傳送>解壓縮>還原 控制在 100 minisec ~ 200minisec 3. 一般資料傳輸 ex:網頁 不重視延遲 重視完整性 4. 背景資料 ex:備份 不需要講求速度 慢慢傳就可以 **吞吐量** 單位時間的傳送/接收量 >throughput OSI第2、3層 封包接收量 ex:mac ip tcp (有header) >good put 應用層封包接收量 不用考慮header 所以通常good put <= through put 而且底層throughput也會計算到傳送失敗丟失的封包(封包可能會重複發送) 而在應用層只會收到底層 成功傳送的封包(每個封包只會算到一次 不重複) 通常傳送檔案看到的速率就是goodput 而throughput則是實際真正的流量 影像、一般資料傳輸 對throughput要求比較高 2. R reliability 可靠度 若R設為1 代表 需要高可靠度、完整 ex: data類型(網頁) 若R設為0 代表 不需要很高的可靠性 ex: video voice 丟失一點點沒關係 3. C cost 成本 光纖 無線網路 同軸電纜 材質特性不同 可以標記要走快速通道或節省通道等 若C設為1 代表 以最小成本路徑傳輸 若C設為0 代表 以一般成本路徑傳輸 4. 最後一個位元 保留欄位 設為0 表示未做定義 ### DS Differentiated Service 差異式服務 講求差異 (DSCP 就是把資料分類 只要某一類比另外一類好 就好了) ### IS Integrated Service 整合式服務 講求絕對 精準型QoS(ex:要求1M傳輸通道 只有我可以透過這條專屬通道傳輸 但是成本高 太多人用會造成負荷量過高 所以只會在實驗中實作) ### ECN Explicit Congestion Notification 1. 當TCP封包送出後,若成功送達會傳回ACK 而網路過於壅塞時便會在傳回的封包中加入ECN的資訊代表網路壅塞 需要降低傳輸速率 2. Hacker可以偽裝成路由器 傳ECN給其他使用者騙它網路發生壅塞 降低網速 Hacker便可以利用網路資源 ### TL Total Length <pre> v IHL v TL-IHL __________________ | IP | payload | ------------------ ^ TL payload的長度為 TL-IHL </pre> #### 封包的分割與重組 IPv4 允許封包在傳輸過程切割 IPv6 只能在來源端切割 傳送前先尋找Path MTU(最大的傳輸單元) 1. ID 識別代碼 封包切割完後 ID會相同 (重組只在接收端進行) 2. Flags 旗標 DF (Don't Fragment) 不切割 0:可以切 (一般封包) 1:不可以切 (對完整性(安全性)有要求的封包) 若設為1 但封包太大 便會丟棄封包回傳ICMP MF (More Fragment) 1: 後面一個封包也是被切割的 0: 後面一個封包不是被切割的 3. FO (Fragment Offset) 分片位移 用來記錄重組回去的位置 位移量是以 8byte 為單位 ![](https://i.imgur.com/I1FOoMD.jpg) ### PROT Protocol #### 識別項 <pre> 1 : ICMP 6 : TCP 17 : UDP </pre> ![](https://i.imgur.com/AdzJda2.jpg) #### 安全補丁 (在IP層做的) 50 ESP 內容加密 完整性 51 AH 驗證身分 HC Header Checksum 傳輸過中 檢查 header 有沒有發生錯誤 SA 來源IP 32bits DA 目的IP 32bits ### OPT option 長度不定 1. Source Route 來源端路徑 `$ route print` 查看路由表 ![](https://i.imgur.com/KUPrOJh.png) 目的IP和遮罩做ADD運算後等於路由表上網路目的地的 取遮罩1最多的作為轉發的選擇 並且從 該介面送出 若遮罩數相同 挑計量小的送 在封包傳送過程中 明確指出 要經過哪些站(測試 除錯) 2. Route Record 路徑紀錄 記錄封包經過哪些路由器 3. Time Stamp 時間標記 經過某路由器的時間點 可以推算經過兩個路由器的時間差(檢查壅塞) 4. Security Label 安全標誌 ### PAD padding 填充 IP header 一定要是4的倍數 若不足就在PAD補0 #### Strict Source Routing 嚴格源路行徑 明確指定哪一站要經過哪些節點 #### Loose Source Routing鬆散源路行徑 會經過指定的節點但中間可插入其他中間節點 ### **IPv6 vs IPv4** <pre> 位置長度: 128bit 32bit 安全性 : 安全性設計在協定中 只有安全補丁 效能 : (封包大小固定40byte) 大小不固定 需要計算大小->引響效能 IP 設定: 基本上使用自動 可以自動也可以手動 </pre> IPv6適合應用在 物聯網IoT Internet of Things ### IPv6的傳播方式 1.單播 Unicast 2.群播 Multicast 3.任播 Anycast (路由器在使用的)

    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