Alan Lin
  • 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
    [toc] 本篇內容將透過Azure Portal來建立site-to-site VPN連線,並且搭配Hub-Spoke網路架構。 >[Azure Hub-spoke network topology 架構參考](https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke?tabs=cli) ![](https://i.imgur.com/MpsjF35.png) ![](https://hackmd.io/_uploads/H1WUV70jh.png) ## 1/ 建立Hub Vnet * 建立Hub虛擬網路,新建一個資源群組存放此次建立S2S VPN的相關資源。 ![](https://hackmd.io/_uploads/r1ZWIXRi3.png) ``` 假設Cloud Hub Vnet網段為: 10.20.0.0/24 Cloud Hub Subnet網段為: 10.20.0.192/26 - GatewaySubnet (For VPN Gateway) ``` * ==**虛擬網路IPv4位址空間**== : 輸入**10.20.0.0/24**。 * ==**新增子網路**== : 新增`GatewaySubnet` - **10.20.0.192/26**。 ![](https://hackmd.io/_uploads/SyWG_QCo2.png) ## 2/ 建立VPN Gateway * ==**命名**== VPN Gateway。 * ==**閘道類型**==:選擇VPN。 * ==**SKU**==:選擇VpnGw1。 > 建立虛擬網路閘道時,根據工作負載、輸送量、功能和SLA的類型,選取符合需求的 SKU。[查看 Gateway SKUs](https://docs.microsoft.com/zh-tw/azure/vpn-gateway/vpn-gateway-about-vpn-gateway-settings#gwsku) * ==**虛擬網路**==:選擇剛才建立的Vnet (`NetworkLab-Hub-vnet`)。 * ==**子網路**== 會自動帶入剛才建立的`GatewaySubnet` * 為VPN Gateway建立一個新的 ==**公用IP位址**==。 * 填完相對應資訊後點選建立。 ![](https://hackmd.io/_uploads/HJ9tKQCo3.png) :::warning :warning: **注意 !** * 建立VPN Gateway通常可能需要**40分鐘左右或者更久**,視選取的**Gateway SKU**而定。 * 等待的同時我們可以先去建立Local Network Gateway。 ::: ## 3/ 建立Local Network Gateway * 上方Search bar搜尋**區域網路閘道**或**Local Network Gateway**。 ![](https://i.imgur.com/arYk1kg.png =80%x) * 在建立Local Network Gateway的時候需要地端的一些資訊,例如:地端VPN設備的對外IP、地端要連線上雲端的IP網段。 :::warning :warning: **注意 !** * 地端的網段不能和雲端的網段重疊。 * [建立VPN連線必要條件。](https://docs.microsoft.com/zh-tw/azure/vpn-gateway/tutorial-site-to-site-portal#prerequisites) ::: ``` 假設地端VPN設備對外IP為: 20.123.124.125 地端IP網段為: 10.10.0.0/24 10.10.1.0/24 ``` * ==**IP位址**==:填入地端VPN設備對外IP。 * ==**位址空間**==:填入地端要連上雲端的IP網段。 ![](https://hackmd.io/_uploads/BJif67Co3.png) ## 4/ 設定地端VPN設備 * 設定地端 VPN 設備時,需要下列值: * ==**共用金鑰Pre-Shared Key**==:在建立S2S VPN Connection的時候也需要相同的共用金鑰。 * ==**Cloud VPN Gateway的Public IP**==。 ![](https://hackmd.io/_uploads/H18HSNCsh.png) * >:memo: [**已經驗證的 VPN 裝置及裝置設定指南**](https://learn.microsoft.com/zh-tw/azure/vpn-gateway/vpn-gateway-about-vpn-devices#devicetable) ## 5/ 建立Connection * 上方Search Bar搜尋**連接**。 ![](https://i.imgur.com/o7S6VDr.png =70%x) * 基本 * ==**連接類型**== 選擇 ==**站對站(IPSec)**==。 ![](https://hackmd.io/_uploads/Sk4iHNAj3.png) * 設定 * ==**虛擬網路閘道**== 選擇剛才建立的Virtual Network Gateway。 * ==**區域網路閘道**== 選擇剛才建立的Local Network Gateway。 * ==**共用金鑰(PSK)**== 輸入在地端VPN設備設定的Pre-shared key。 * 其餘選項使用預設即可。 ![](https://hackmd.io/_uploads/SyuTSNAjh.png) * Connection建立完後,若地端VPN設備沒有同步設定完成,則Connection狀態會顯示 ==**未連接**==, ==**連入資料**== 和 ==**連出資料**== 都會是0B。 ![](https://hackmd.io/_uploads/Bys_L4Co2.png) * 地端VPN設備有同步設定成功的話,Connection狀態會顯示 ==**已連接**== ,且 ==**連入資料**== 和 ==**連出資料**== 過一段時間會開始有流量顯示。 ![](https://i.imgur.com/X1aOzVX.png) :::info :memo: **測試連線** * Connection設定成功後,可以建立一台VM去Ping地端的機器是否可以Ping通,來驗證我們建立的S2S VPN服務是否正常。 ::: ## 6/ 建立S2S VPN所需創立的資源 * 可以在 ==**資源群組**== 中看到我們建立S2S VPN所需的資源有哪些。 ![](https://i.imgur.com/pAmqMO9.png) - [x] **==VNet、Subnet==** - [x] **==VPN Gateway==** - [x] **==VPN Gateway Public IP==** - [x] **==Local Network Gateway==** - [x] **==Connection==** :::info :bulb: **提醒** * 如果只是嘗試建立S2S VPN的話,測試完畢後,記得將資源群組刪除,才不會有額外的費用產生。 ::: ## 7/ 建立Spoke Vnet * 建立Spoke虛擬網路 ![](https://hackmd.io/_uploads/rk3tgEAo2.png) ``` 假設Cloud Spoke01 Vnet網段為: 10.20.1.0/24 Cloud Spoke01 Subnet網段為: 10.20.1.0/26 - app01-snet ``` * ==**虛擬網路IPv4位址空間**== : 輸入**10.20.1.0/24**。 * ==**新增子網路**== : 新增`app01-snet` - **10.20.1.0/26**。 ![](https://hackmd.io/_uploads/rkAAgVRsn.png) ## 8/ 建立對等互連 - Peering 1. 點選剛才建立的Hub Vnet (`NetworkLab-Hub-vnet`) 2. 點選對等互連 - Peering ![](https://hackmd.io/_uploads/ByvUwERsn.png) 3. 此虛擬網路 * ==**命名**== 對等互連Peering名稱 * **==虛擬網路閘道或路由伺服器==**:若要使Spoke01 Vnet也能夠使用Hub Vnet的Virtual Network Gateway的話(地端流量可以通到Spoke01 Vnet),記得勾選 **==使用此虛擬網路的閘道或路由伺服器==** > 這裡的"使用此虛擬網路的閘道或路由伺服器"指的是Hub Vnet的Virtual Network Gateway ![](https://hackmd.io/_uploads/By3pvECjn.png) 4. 遠端虛擬網路 * ==**命名**== 對等互連Peering名稱 * **==虛擬網路閘道或路由伺服器==**:若要使Spoke01 Vnet也能夠使用Hub Vnet的Virtual Network Gateway的話(地端流量可以通到Spoke01 Vnet),記得勾選 **==使用遠端虛擬網路的閘道或路由伺服器==** > 這裡的"使用遠端虛擬網路的閘道或路由伺服器"指的也是Hub Vnet的Virtual Network Gateway ![](https://hackmd.io/_uploads/Hkpbd40o3.png) :::info :memo: **測試連線** * 新增對等互連Peering後,可以在Spoke01 Vnet建立一台VM去Ping地端的機器是否可以Ping通,來驗證我們剛才建立的Peering是否正確。 ::: ## Reference * [在Azure入口網站中建立站對站VPN連線](https://docs.microsoft.com/zh-tw/azure/vpn-gateway/tutorial-site-to-site-portal) * [使用Azure入口網站建立和管理VPN閘道](https://docs.microsoft.com/zh-tw/azure/vpn-gateway/tutorial-create-gateway-portal) * [Azure Hub-Spoke Network Topology](https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke?tabs=cli) * [虛擬網路對等互連](https://learn.microsoft.com/zh-tw/azure/virtual-network/virtual-network-peering-overview)

    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