KangMoo
    • 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
    # 네트워크 (4) - 전송 계층(Transport Layer)과 NAT(Network Address Translation) ## 전송계층(Transport Layer) ![image](https://hackmd.io/_uploads/BJvmtcftn.png) - 패킷이 전송 과정에서 아무 문제 없이 제대로 수신지 컴퓨터에 도착할 수 있도록 패킷 전송을 제어하는 역할은 전송 계층이 담당한다 - 다양한 애플리케이션이 동작하는 컴퓨터 내에서 어떤 애플리케이션이 사용하는 데이터인지 식별하여 수신지 컴퓨터에 도착한 데이터를 수신지 컴퓨터 내의 애플리케이션에 배분하는 역할을 한다 - 주로 사용되는 프로토콜로는 TCP(Transmission Control Protocol)와 UDP(User Datagram Protocol)가 있으며, 이들은 각각 신뢰성 있는 연결 지향적 통신과 신뢰성이 낮지만 속도가 빠른 비연결성 통신을 지원한다. - 전송 계층은 애플리케이션 계층에서 보낸 데이터를 세그먼트라는 단위로 분할하고, 이를 네트워크 계층으로 전달한다. 수신 측에서는 이 세그먼트를 다시 조립하여 애플리케이션 계층으로 전달한다. - **포트 번호를 사용**하여 특정 프로세스 혹은 서비스와 데이터 패킷을 연결하며, 이를 통해 동일한 IP 주소 내에서 여러 프로세스나 서비스가 동시에 네트워크 통신을 할 수 있게 해준다. ![image](https://hackmd.io/_uploads/HyQ4KcMK3.png) ### 포트 번호의 분류 ![image](https://hackmd.io/_uploads/ByliFqGKh.png) - 포트 번호는 크게 세 종류로 구분된다 - 0번 ~ 1023번: 웰 노운 포트 (well-known port) - 1024번 ~ 49151번: 등록된 포트 (registered port) - 49152번 ~ 65535번: 동적 포트 (dynamic port) ### 웰 노운 포트 (Well-Known Ports) ![image](https://hackmd.io/_uploads/ryLjYczFh.png) - 웰 노운 포트는 0~1023의 범위를 가지며, 잘 알려진 서비스나 프로토콜이 사용하는 포트 번호이다. - 이들 포트 번호는 IANA(Internet Assigned Numbers Authority)에 의해 표준화되어 관리된다. - 예를 들어, HTTP는 80번 포트를, HTTPS는 443번 포트를, SSH는 22번 포트를 사용한다. - [TCP/UDP의 포트 목록](https://ko.wikipedia.org/wiki/TCP/UDP%EC%9D%98_%ED%8F%AC%ED%8A%B8_%EB%AA%A9%EB%A1%9D) ### 등록된 포트 (Registered Ports) - 등록된 포트는 1024~49151의 범위를 가지며, 사용자 또는 소프트웨어가 임의로 사용할 수 있는 포트 번호이다. - 이들 포트 번호는 IANA에 의해 등록되며, 특정 서비스나 애플리케이션에 사용하기 위해 예약할 수 있다. - 하지만, 필요에 따라 일반적인 애플리케이션에서도 이 범위의 포트 번호를 사용할 수 있다. ### 동적 포트 (Dynamic Ports) 또는 개인 포트 (Private Ports) - 동적 포트 또는 개인 포트는 49152~65535의 범위를 가지며, 일반적으로 클라이언트 애플리케이션에서 임시적으로 사용하는 포트 번호이다. - 이들 포트 번호는 일반적으로 컴퓨터의 운영 체제에 의해 동적으로 할당되며, 클라이언트가 서버와의 연결을 시작할 때 사용된다. - 동적 포트는 일시적인 통신을 위한 것이므로, 연결이 종료되면 해당 포트는 재사용을 위해 해제된다. ![image](https://hackmd.io/_uploads/H1zkoqMY3.png) ![image](https://hackmd.io/_uploads/HkaCj5GY2.png) ### 전송 계층 통신 방식 ![image](https://hackmd.io/_uploads/ryz5nczFh.png) #### 연결형 통신 - 연결형 통신은 데이터를 전송하기 전에 송신자와 수신자 간의 통신 경로를 설정하는 통신 방식이다. - 이 방식은 **TCP(Transmission Control Protocol)** 와 같은 프로토콜에 의해 지원된다. - 연결형 통신에서는 데이터의 순서, 에러 검출 및 복구 등을 보장하며, 이로 인해 신뢰성 있는 데이터 전송이 가능하다. - 하지만, 연결을 설정하고 유지하기 위한 오버헤드로 인해 비연결형 통신에 비해 속도가 느릴 수 있다. #### 비연결형 통신 - 비연결형 통신은 데이터를 전송하기 전에 통신 경로를 설정하지 않는 통신 방식이다. - 이 방식은 **UDP(User Datagram Protocol)** 와 같은 프로토콜에 의해 지원된다. - 비연결형 통신에서는 데이터의 순서나 에러 검출, 복구를 보장하지 않으므로 신뢰성이 낮다. 하지만, 이는 연결 설정과 관련된 오버헤드 없이 데이터를 빠르게 전송할 수 있게 해준다. - 실시간 서비스, 게임, 스트리밍 등 신뢰성보다는 속도나 효율성이 중요한 경우에 주로 사용된다. ## NAT (Network Address Translation) ![image](https://hackmd.io/_uploads/SJ4JPe3Kh.png) - NAT은 IP 패킷에 적힌 소켓 주소의 포트 숫자와 소스 및 목적지의 IP 주소 등을 재기록하면서 라우터를 통해 네트워크 트래픽을 주고 받는 기술이다 - 주로 프라이빗 네트워크와 퍼블릭 네트워크 간의 IP 주소를 변환하기 위해 사용된다. 이는 프라이빗 네트워크 내의 여러 장치가 하나의 공용 IP 주소를 공유하도록 해 인터넷에 접근할 수 있게 한다. - NAT를 사용하면 제한된 수의 유효한 IP 주소를 가진 네트워크에서 많은 수의 장치를 운영할 수 있어, IP 주소 부족 문제를 해결하는 데 도움이 된다. - 일반적으로 NAT는 홈 라우터에서 가장 일반적으로 발견되며, 이는 네트워크 내의 모든 장치가 단일 인터넷 연결을 공유할 수 있게 한다. - NAT는 또한 보안 측면에서 이점을 제공하며, 외부 네트워크에서 직접적으로 프라이빗 네트워크 내의 특정 장치를 타겟팅할 수 없기 때문이다. - NAT의 종류에는 `Static NAT`, `Dynamic NAT`, `Port Address Translation (PAT)`등이 있다 - Static NAT - Static NAT는 프라이빗 IP 주소를 공인 IP 주소로 1:1 매핑하는 방법이다. - 이 방식은 내부 네트워크의 특정 호스트가 인터넷에 직접 노출되도록 설정하는 데 주로 사용된다. - 이 설정을 통해, 외부 네트워크에서 특정 프라이빗 IP 주소로 직접 접근할 수 있게 된다. - 장점 : Static NAT은 IP 주소 매핑이 고정적이므로 외부에서 내부 네트워크의 특정 장치를 항상 동일한 퍼블릭 IP 주소로 액세스할 수 있다. 이로 인해 외부에서 내부 서버에 대한 일관된 액세스를 제공하는 데 유용하다. - 단점 : 각 내부 IP 주소에 대해 퍼블릭 IP 주소가 필요하므로, IP 주소가 고갈될 수 있다. 또한, 모든 내부 장치가 인터넷에 고정적으로 노출되므로 보안 측면에서 우려가 있다. - Dynamic NAT - Dynamic NAT는 프라이빗 IP 주소를 공인 IP 주소 풀 중에서 동적으로 선택된 주소로 매핑하는 방법이다. - 공인 IP 주소는 일반적으로 제한적이므로, 이러한 방식은 네트워크 내부의 많은 장치들이 제한된 수의 공인 IP 주소를 공유할 수 있게 한다. - 그러나 이 방식은 외부에서 내부 네트워크의 특정 장치에 직접 접근하기 어렵다는 단점이 있다. - 장점 : Dynamic NAT은 퍼블릭 IP 주소 풀을 사용하여 내부 IP 주소를 동적으로 매핑한다. 이 방식은 IP 주소 사용률을 효율적으로 관리하고, 모든 내부 장치가 동시에 외부 네트워크에 액세스할 필요가 없는 경우에 유용하다. - 단점 : 퍼블릭 IP 주소 풀의 크기가 내부 네트워크의 장치 수보다 작을 경우, 동시에 모든 장치가 외부 네트워크에 액세스할 수 없을 수 있다. 또한, Dynamic NAT은 매핑이 동적이므로 외부에서 특정 내부 장치를 지속적으로 액세스하는 것이 어렵다. - Port Address Translation (PAT) - PAT는 하나의 공인 IP 주소를 여러 개의 프라이빗 IP 주소와 연결하기 위한 방법으로, 이는 NAPT(Network Address Port Translation)의 한 형태로 볼 수 있다. - PAT는 각각의 프라이빗 IP 주소와 공인 IP 주소 사이의 연결을 포트 번호를 통해 구분한다. - 이 방법을 사용하면, 하나의 공인 IP 주소를 사용하여 내부 네트워크의 여러 장치와 외부 네트워크 간의 통신을 가능하게 한다. - 장점 : PAT은 여러 내부 IP 주소를 단일 퍼블릭 IP 주소에 매핑할 수 있으므로, IP 주소 공간을 가장 효율적으로 활용한다. 또한, 보안 측면에서도 유리한데, 외부에서 내부 네트워크의 특정 장치를 직접 액세스하기 어렵기 때문이다. - 단점 : PAT은 복잡한 통신 패턴이나 일부 특정 애플리케이션에서 문제를 일으킬 수 있다. 예를 들어, 같은 퍼블릭 IP 주소와 포트 번호를 사용하는 여러 세션을 정확하게 구별해야 하는 경우, PAT은 이를 처리하는데 어려움을 겪을 수 있다. 이로 인해 PAT을 사용하는 네트워크에서는 일부 애플리케이션 호환성 문제가 발생할 수 있다. ### 포트 포워딩 ![image](https://hackmd.io/_uploads/ByZJ5RiF2.png) - 포트 포워딩, 또는 포트 매핑은 외부 네트워크와 내부 네트워크 간의 데이터 통신을 가능하게 하는 기술이다. - 이 기술은 특정 IP 주소와 포트 번호의 통신 요청을 다른 IP와 포트로 리다이렉션할 수 있다. - 이는 주로 NAT(Network Address Translation) 환경에서 내부 네트워크의 특정 호스트에 직접적인 접근이 필요할 때 사용된다. - 예를 들어, 홈 네트워크에 있는 개인 서버에 외부에서 접근하기 위해 사용할 수 있다. - 포트 포워딩은 라우터 설정을 통해 구현되며, 외부에서 특정 포트로 들어오는 트래픽을 내부 네트워크의 특정 IP 주소와 포트로 전달하도록 설정한다. - 이를 통해 외부 사용자들이 내부 네트워크의 특정 서비스(웹 서버, FTP 서버 등)에 접근하거나, 게임과 같은 애플리케이션에서 P2P 통신을 가능하게 할 수 있다.

    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