湯镸
    • 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
    # 計算機網路 期末範圍 ## Chapter4 Network Layer : Data plane Router L3: 可執行pdn layer * sender :封裝segments(一段一段的) into datagrams,然後轉給link layer receiver :收到datagram 之後往上層送 中間的router:檢查header裡面的ip 然後給牠一個合適的去處 * **Forwarding** : input後幫她決定適合的output → 出口選對(Data plane * **Routing** : 用 routing演算法找你整條路徑(control plane 每個router都有自己的 routing table--由Routing Algorithm算出來把整個網路串起來 :pre-router control plane 根據routing table執行:data plane 找個傭兵來幫你算routing table:SDN control plane軟體定義網路 ### Network service model 定義傳輸的特性 1. guaranteed delivery(傳送保證): 保證封包一定會抵達目的地 2. guaranteed delivery with bounded delay(有限延遲的傳送保證): 不僅保證封包一定會成功抵達,而且保證會在某個主機到主機的延遲時間上限內送達 此外,網路層也可能提供下列服務給來源端與目的端之間的封包流 1. in-order packet delivery(依順序的封包傳送) 2. guaranteed minimal bandwidth(最低頻寬保證): 只要傳送端主機傳輸位元的速率小於規定的位元傳輸速率,就不會有封包遺失,而且每一個封包都會在預先指定的主機到主機延遲時間內抵達 3. guaranteed maximum jitter(最大時基誤差保證): 保證傳送端連續傳輸兩個封包的時間間隔,會等於他們抵達目的端的時間間隔(或保證此一建格的變化小於某個特定值) 4. 安全性服務: 利用只有來源端主機與目的端主機知道的秘密會談key值,來源端主機的網路層可以將所有要送到目的主機的資料封包內容加密。 => 可以提供機密性給所有來源主機與目的主機之間傳送的傳輸層區段 Quality of service? >Bandwith? Loss? Order? Timing? ![](https://i.imgur.com/5UfZ2ve.png) circuit switching隨著使用的人越來越多 改用vitual circuit 比較多還是用packet switching 但不能提供QoS #### ATM asynchronous transfer mode ![](https://i.imgur.com/GqcYqrD.png) 每個segment固定5+48 bytes 5: VCI VPI 把線路像vlan一樣切 在表頭 #### IntServ vs DiffServ Int:每個服務給固定頻寬 Diff:根據當下需求動態調整給不同服務的頻寬 #### Input port function ![](https://i.imgur.com/p0Echbj.png) ex: R1的routing table: ![](https://i.imgur.com/L0SMMlN.png) 目的IP:180.70.65.140到R1 與Routing table第一個遮罩/26做AND運算 -> 180.70.65.128 :不是m2 遮罩/26表示方法 從左邊算來有幾個1:1111111111111111111111111100000... ### 交換結構switching fabrics ![](https://i.imgur.com/lrxLu30.png) 第一代 速度受 memory bandwidth 限制 存到記憶體裡然後再forward * input port queuing ![](https://i.imgur.com/7iyHN3s.png) ![](https://i.imgur.com/3BW7i5g.png) ECN:我很忙別再丟進來了 output port queuing ![](https://i.imgur.com/lLZ6ziA.png) * Round Robin(RR) 進入buffer(queue)時會先分類 任何header裡的資訊都可以成為分類的依據 會輪流的傳送每一個分類的封包 ![](https://i.imgur.com/aCZoltt.png) * Weighted Fair Queueing(WFQ) 進入buffer(queue)時會先分類 任何header裡的資訊都可以成為分類的依據 原理跟round robin很像,一樣都會輪流傳送每一個class的封包 但差別在於每個class都有自己的權重 會根據每個class的權重大小來決定這個class被輪到後一次可以傳送多少的封包,而不是像RR一樣,每次輪到每個分類都是傳一樣的份量 ![](https://i.imgur.com/hYTINhK.png) ### IP 封包表頭格式介紹 https://joy0626.pixnet.net/blog/post/2109687 ![](https://i.imgur.com/ymSZM6x.png) Internet Header Length:告訴她表頭長度到哪 data從哪開始 type of service diffserv:0-5 ECN:6、7 表頭是固定的 but options+padding不一定 但整個要讓32整除 padding用來填充 * how much overhead? 20bytes of TCP' 20bytes of ip =40 bytes + ### IP addressing : 子網路遮罩等設定 網路位置32位元 剩下就是主機位置 /24=從左至右有24個1 路由器不會把封包送到點上 他只知道要送去哪個網段 送到點是switch做的事 #### classful IP address ![](https://i.imgur.com/M1RyPXf.png) 網路位置|主機位置 網路位置不夠:拿主機位置來補 Network-prefix|Host-number 變成 Network-prefix|subnet-number|Host-number --------這之前都是網路位置---- #### CIDR ![](https://i.imgur.com/YbFSqp0.png) * ex:130.34.12.64/26 切 4 subnets ans:/26 -> /28 (從ip第24個字開始) 1.0100 0000 - 0100 1111 2.0101 0000 - 0101 1111 3.0110 0000 - 0110 1111 4.0111 0000 - 0111 1111 * ex 211.32.45.0 切 6 =>/27 :24+3 新Mask= 舊Mask+log2 總ip數/網段要的ip數 * ex : 167.199.170.83/27 network address? 82= ==010==1 0010 =>0100 0000 or 64 =>the network address is 167.199.170.64/27 * ex : what is the subnetwork address if the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0? =>and運算 34.56 00100010 00111000 240 . 0 11110000 00000000 and=>00100000 00000000:32.0 =>200.45.32.0 * ex : 190.100.0.0/16 分給group1 64customers eachneed 256address group2 128 128 group3 128 64 1.64\*256=16384 address =>套公式 2.128\*128=16384 address =>n=16+log~2~(65536/16384)=16+log~2~4=18 ### DHCP dynamic host configration protocal 應用層協定 用UDP傳 給孤兒們身分證↓ ip address Mask address DNS address Gateway address DHCP會在子網路裡面 每個子網路都有 少數會用兩個port的協定 ![](https://i.imgur.com/QWceaWV.png) ![](https://i.imgur.com/yaj9WTf.png) ### NAT 大家都用同一個IPv4位置 ![](https://i.imgur.com/4UwU0Ye.png) router幫你去外面聯網 以port當代號 我去幫忙買晚餐 再根據訂單 分給同學們 #### ipv6優點 v4太短 speed up: 表頭固定40byte 易於flow cont=>QoS 不用學子網路規劃,router算給你 主機位置用MAC產生 auto conf: (dynamic) stateful addr-DHCPv6 , stateless addr:router算給你 ![](https://i.imgur.com/Q7nvjD3.png) next header 功能擴充 ![](https://i.imgur.com/fR0HGDO.png) #### v4 v6混編 #### IPv6定址 anycast 找最近的 ##### IPv6 Global Unicast address ![](https://i.imgur.com/HJIqVD5.png) 2001開頭 IPv6的公有ip:Global Unicast address FC00是 IPv6的私有位置 ##### Link local 169.254(FE80)開頭 不上網 內網ip 鄰居發現 自動定址等功能 一個IPv6會有兩個IP位置:Global Unicast address、Link local address 沒有DHCP的時候用的 ##### Unique local address FC00開頭 私有 #### Default route address ::/0 #### 和ipv4結合定址 #### interface ID configure EUI-64 prefix設定好後 ID由MAC拆一半再組來生 支援自動組態 ### 管理方式:軟體定義OpenFlow controller SDN 集中管理 flow table router只負責往外丟 軟體定義網路 controller寫好flow Table:給各個router ![](https://i.imgur.com/GDxD7Q1.png) ![](https://i.imgur.com/pbVqWJn.png) 不用再經過and運算 利用軟體實現Router Firewall Switch NAT 軟體化 虛擬化 掛了重裝 備份 復原 都很方便 負載平衡 同一個IP同一個domain name 但實際上有很多機器一起負擔 #### middlebox 中間盒的示例包括防火牆,網絡地址轉換器,負載平衡器和深度數據包檢查盒。 ### IP分段 ![](https://i.imgur.com/qhfI3BN.png) 路由器切封包 16-bit identifier封包的名字 flag:識別你有沒有被切 frg offset:切多大包 ![](https://i.imgur.com/OBduRGk.png) 拆一份多一個header offset field 代表此一分段在整個datagram的相對位置,以8為單位 ## U5 看投影片 global decentralized Dijkstra's algorithm Bellman

    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