Scott Liao
    • 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
    # AWS Certified Advanced Networking - Specialty ###### tags: `aws-certified` --- ## 涉及領域 & 服務 ### Scopes 1. 網路進階概論 1. Multi Network 設計 (50) - Multi On-Premies - Multi VPC 1. Security (30%) - IPSec - Site-to-Site VPN 1. Direct Connect (70%) - HowTo setup - Troubleshooting 1. CloudFront (10%) 1. Others (20%) ## 網路進階概論 - 概觀 - Network:由很多 `AS (Autonomous System)` 組成 - AS:由很多 `Subnet` 組成 - Subnet:由很多 `IP Address` 組成 - IP Address:一台 `Device` 一個 - Network Packet:在不同的 `IP Address` 之間移動 ### AS (Autonomous System) - 概念 將 Network 改變成兩層的結構。以 Gateway 做區隔,最外層是 Internet,使用 EGP 來做聯繫。閘道內是以 AS 來做管理。 ``` Internet: > Gateway-TW: { ASN } | <BGP or EGP> | > Gateway-US: { ASN } ``` 一個 AS 會有一個 ASN (AS number),而 AS 通常是由一個單位管理,例如 ISP、超級大學校、大公司等等,什麼都大的組織。每個 AS 裡面的路由表都自己管,只要事先宣告自己持有什麼網段就行了,故名 autonomous。 ### BGP (Border Gateway Protocol) BGP 協定本身並沒有考慮到「安全」 目前有人提出加強安全的協定了,不過還沒有廣泛地被使用。 - Port 179/TCP - 同一個 AS 多個實體之間的 BGP 稱為 iBGP (Internal/Interior BGP) - 多個 AS 之間的 BGP 稱為 eBGP (External/Exterior BGP) - 優先順序:IGP > eBGP > iBGP (200) #### BGP Hijacking [BGPStream](https://bgpstream.com/) 顯示目前全球網路上有哪些地方正在發生 BGP Leak/狹持 ##### BGP Hijacking,大概可以分成幾種: - 部分狹持,一個自治系統隨便宣告自己持有某個網段,這網段可能同時是別人持有的, > 有可能一或兩個自治系統宣告說,擁有同一個網段,區間也相同。 > 所以這個狀況之下,一個封包有可能依照「最短路徑」或是「最好路徑」(這個可以由自治系統本身決定)來傳遞封包。因此,這種狀況下,只有一定的機會會狹持到封包。 - 完全狹持,一個自治系統,宣告網段時,宣告了比原本更大的區間(CIDR),故為完全狹持 > 一個自治系統宣告說,自己有比其他人更好的路,這路很棒,叫大家趕快來 #### BGP Leak 與 `BGP Hijacking` 相似,但通常是 `操作者不小心手滑,寫錯路由表` > 舉例: > > 有一個自治系統實際上和兩個 ISP 對接。這個自治系統只是為了其他因素,所以跟兩邊對接 > > 他本身並不想要幫忙在兩間 ISP 之間傳資料。結果操作者不小心告訴兩家 ISP 的其中一邊說,自己有和另一邊接上,結果那邊就很快樂地把很多資料傳過來了。 ### Differentiated Services Code Point (DSCP) RFC-2474, Layer 3 的 QoS 方法,使用 IP header 中的 6-bit DS (Differentiated Services) 進行封包分類,通常可以從 Wireshark 擷取到 DSCP ## VPC - Internet Gateway - 讓 VPC 連接 Internet 使用 - 也另外提供 Egress Only Internet Gateways 僅 outbound 不提供 inbound 但只有 IPv6, 若 IPv4 則使用 NAT Gateway - Carrier gateways - 連接至有提供 5G Wavelength 的 ISP 路由 Gateway (attach subnet route) - NAT Gateway - [Rules and Limitations](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-limits) - Support `TCP`, `UDP`, `ICMP` - Not Security Groups and Port 1024 ~ 65535 - 不支援 VPC Peering - Customer gateway (CGW) - 通過 CGW 串接 On Permises 的 Firewall, Router 或可 VPN 設備,每一個 VPN 建議至少 2 組 CGW tunnel - Routing and switching - All traffic is unicast (所以沒有 ARP) - All Subnet default - 如果 EC2 充當 Proxy, Firewall, Router 角色必須接收和 EIP 不同的 IP 流量時必須關閉 [source/destination checks](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html#EIP_Disable_SrcDestCheck) - MTU 依 EC2 instance type 而定,支援從 1500, 9001 MTU 或更高,而 Wavelength Zone 最大 MTU 1300,當流量離開 VPC 時最大 MTU 為 1500. Ref: [Network maximum transmission unit (MTU) for your EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/network_mtu.html) - VPC Peering ### Limitations - BGP Route per Table 最高 100 條 (hard limit) - Subnet 僅能 attach 一個 NACL ### References - Amazon VPC for On-Premises Network Engineers [[Part 1]](https://aws.amazon.com/tw/blogs/apn/amazon-vpc-for-on-premises-network-engineers-part-one/), [[Part 2]](https://aws.amazon.com/tw/blogs/apn/amazon-vpc-for-on-premises-network-engineers-part-two/) - [How do I enable BFD for my Direct Connect connection?](https://aws.amazon.com/premiumsupport/knowledge-center/enable-bfd-direct-connect/) ## Direct Connect ### Prerequisites - Router need support `single-mode fiber` with a 1000BASE-LX (1310 n) transceiver for 1 gigabit Ethernet or 10GBASE-LR (1310 nm) transceiver for 10 gigabit Ethernet - Devices (Router) need Support `Border Gateway Protocol (BGP)` and BGP `MD5 authentication` - `802.1Q VLAN` encapsulation must be supported across the entire connection, including intermediate devices. - (Optional) Support `Bidirectional Forwarding Detection (BFD)` ### Step-by-Step - Step 1: Sign up for AWS - Step 2: Request an AWS Direct Connect dedicated connection or accept a hosted connection - `request` and receive an `email` then `accept` your hosted connection - Step 3: Download the LOA-CFA (Dedicated connection) - If working with an `AWS Direct Connect Partner or network provider, send them the LOA-CFA` so that they can order a cross-connect for you at the AWS Direct Connect location. If they cannot order the cross-connect for you, you can contact the colocation provider directly. - Step 4: Create a virtual interface - Need select public (connect to public AWS services that aren't in a VPC) or private virtual interface - ## EC2 ### Public IP - 當 stop/termination 時會重新分配 Public IP 給 EC2 ### EIP ### Placement Group - 不支援 burstable performance 的 instance. (t2, t3, t3a, t4g) - Partition, Spread 可能會遇到 racks 不夠的問題 #### Cluster ![](https://i.imgur.com/kSiGKG4.png) - 只放在 Single AZ - 建議開啟 Enhanced Networking 和相同類型的 instance 能獲得完整的效能 - 常見用於 `低延遲` 或 `高流量` 等需要極為對網路速度敏感的情境 #### Partition ![](https://i.imgur.com/qTQYszL.png) - 同樣放 Single AZ 但再細分為 logical partitions 可想像放在不同的 `機櫃` 可以避免單一電力, 線路問題 - 可指定部分 instance 放在同一個 logical partition #### Spread ![](https://i.imgur.com/asqHBI0.png) - 同樣放 Single AZ 但每一個 instance 必定放在不同的 `機櫃` ### VPN - AWS Managed Site-to-Site VPN 每一個 VPN Connection 會有 2 個 tunnels. [#Tunnel options for your Site-to-Site VPN connection](https://docs.aws.amazon.com/vpn/latest/s2svpn/VPNTunnels.html) - 使用 Encapsulating Security Payload (ESP) protocol 50 和 UDP Port 500 - Phase 1/2 都支援 AES128 以上加密演算法, SHA1 以上 Hash 演算法 - Phase 1 - DH group: 2, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - Lifetime: 900 - 28,800s (8 hours) - Phase 2 - DH group: 2, 5, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - Lifetime: 900 - 3,600 (1 hours) 數字必須小於 Phase 1 lifetime #### References - [I can’t establish my VPN tunnel: IPsec is failing](https://aws.amazon.com/tw/premiumsupport/knowledge-center/vpn-tunnel-phase-2-ipsec/) - [Site to Site VPN User guide](https://docs.aws.amazon.com/vpn/latest/s2svpn/s2s-vpn-user-guide.pdf) ## CloudFront ### Cookie [Caching Content Based on Cookies](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Cookies.html) - 支援 HTTP/HTTPS Web Distributions 並且 Forward Origin,但 Cookie 不支援 RTMP Distributions - 沒有設定 Forward Cookie Origin 時,當到 Origin 前移除 Set-Cookie header ### Distribution - Web Distribution - Origin 可以是 S3 或者 HTTP/HTTPS Service - RTMP Distribution: Video on Demand and Live Streaming Video - Live Streaming Video - 支援 Microsoft Soomth Streaming 格式 - RTMP - Adobe Flash Media Server - Adobe designated Flash as end-of-life at the end of 2020 - CloudFront 預設存取 Adobe Flash Media Server 的 `crossdomain.xml` 允許 CROSS Domain。 - Media Player 設定 RTMP 時串流檔案路徑必須位於 cfx/st 之後 > rtmp://abc.cloudfront.net/cfx/st/media.flv ### Limits - CloudFront 最大 Response body 為 20GB ## IAM - 若 IAM User 具備 CloudWatch 權限旦沒有 EC2 權限,仍然可以設定 CloudWatch alarm action,但 EC2 不會被執行動作 ## CloudTrail - 存放所有 AWS API 的存取紀錄 - 可存放至 S3 保存,並且允許 CROSS Account 將多個帳號的資料丟到單一 S3 bucket 儲存,並且可定期轉存到 Glacier ## Config - Custom Config Rules 使用 `InputParameters` (JSON format) 定義參數 ## CloudWatch ### Metrics - Metrics 包含 Metric name, Dimension, Data point unit, namespace 並且依照指定的 time period 計算出數值 - 支援單個資料 `--put-metric-data` 上傳,也能將資料彙整後加上 `--statistic-values` 一次上傳 - `PutMetricData` API 最大支援 HTTP GET 8KB、HTTP POST 40KB - 當沒有數據時,建議可以上傳 0 值便於統計 (e.g. Average),但也可選擇不上傳 data ## GuardDuty - 支援 Organizations 啟動 GuardDuty 並且指定 Account 集中管理 ## Directory Service - AWS Hosted AD vs. AD Connector - AD Connector ## SNS - SNS 原支援 CloudWatch 5-minute metrics,但在 2021/01/29 後開始[支援 1-minute metrics](https://aws.amazon.com/about-aws/whats-new/2021/01/amazon-sns-now-supports-1-minute-cloudwatch-metrics/)。 ## DDoS - AWS Shield, CloudFront, WAF 可以緩解 DDoS 攻擊

    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