포트(PORT)
GOAL: What do I want from knowing well about port?
음… 기본적인 우리 프로젝트의 구조를 더 잘 이해할 수 있다. 우리는 똑같은 IP에 port번호만 다르게 띄우고 있으니까…
- https://local.i3t-dev.com:3000/ (hospital)
- https://local.i3t-dev.com:8001/ (api)
등등…
포트를 조금 더 잘이해해서 port forwarding 등등을 하게 되면 포트 포워딩 등등이 필요한 상황에 적절하게 잘 활용하여 개발을 조금 더 쉽게 할 수 있다.
장비 셋업을 할 때 IP가 달라야하는지, 포트가 달라야 하는지 등등 조금 더 잘 이해할 수 있다.
What is PORT?
A port number is virtual address that maps to specific process or program on your device.
A port is a virtual point in your device where a network connection begins and ends. In contrast to an IP address, a port is specific to the process, not the device.
If an IP address were a building address, a port number would be an apartment number.
A port is a virtual point where network connections start and end. Ports are software based and managed by a computer’s operating system. Each port is associated with a specific process or service.
What is port number?
A port number is a digital label that helps identify different ports inside a device. It’s like an apartment number appended to the building address, represented by the IP address.
Types of port number
A port number can hold 65536 numbers, with the following division.
- 0 to 1023 - Well known port numbers. Only special companies like Apple QuickTime, MSN, SQL Services, Gopher Services and other prominent services have these port numbers.
- 1024 to 49151 - Registered ports; meaning they can be registered to specific protocols by software corporations.
- 49152 to 65535 - Dynamic or private ports; meaning that they can be used by just about anybody
Some of the most commonly used ports, along with their associated networing protocol.

Q: 한 포트에 2개 이상의 서버가 접근할 수 없는건가?
- No. In general, one application listens on a single port
- The answer differs depending on what OS is being considered. In general though:
- For TCP, no. You can only have one application listening on the same port at one time. Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number. (stackoverflow)
Q: 한 개의 주소에 여러개의 서버는 어떻게 떠있을 수 있는건가?
- 이거는 이제 내가 답변을 할 수 있을 것 같다. IP address는 network 에서의 device 주소이고, 내 device는 여러개의 application(process)을 각각의 포트에 띄울 수 있으니까 여러 개의 서버(application)을 여러 개의 포트에 띄워주는 거지
Q: What is port forwarding?
오늘 포트 포워딩이 머리에 약간 들어오지는 않네.
Port forwarding, sometimes called port mapping, allows computers or services in private networks to connect over the internet with other public or private computers or services.
So basically…it allows computers or services in private networks to connect over the internet with other public or private computers or services.
포트 포워딩은 router의 WAN IP address랑 device(host)의 LAN IP address 사이에 map을 만들어서 가능하게 된다.
NAT Table - Network Address Translation Table
LAN - Local Area Network(private network)
- ex) home Wi-Fi, office Wi-Fi, free Wi-Fi at a coffee shop
WAN - Wide Area Network(public network)
- ex)
When you’d like to connect to the internet — say, to check your email, visit social media, or access cloud file storage — a connection request gets sent from your device to the router, detailing your device’s IP address and an associated port for the request. Your device is the host or source for the connection. The router then reads the request and masks (maps) your device’s IP address and port with the router’s public-facing IP address and a relevant port. (If you’re particularly curious, here’s the full ICANN port registration list.) After masking your host IP address with the router’s public-facing IP address, it sends the connection request forward to its destination.
Q: Can’t you IP forwarding? Not too sure of this yet… maybe I will look forward in the future
Exercise: Let’s port forward!
근데 이거보니까… 뭔가 여러 개의 서비스를 한 번에 forwarding 할 수 있는 것 같다 말이야. cloudflare에..
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/configure-tunnels/local-management/configuration-file/#origin-configuration 요기를 한 번 자세히 봐보자.
References
- What is a computer port? - cloudflare
- What is difference between IP address and Port Number in networking? - stackoverflow
- What is my port number and how can I find it?
- What Is Port Forwarding? - A Beginner's Guide
- Read this how general overview of port forwarding. It explains very well how the request is sent to the destination and gets back from destination
- https://www.codecademy.com/resources/blog/port-forwarding/
- A guide to port forwarding - Reddit
- port forwarding explained in the more human readable way.
Future Todos
- Can you port forward multiple services?
- cloudflare에 답이 있는지 참조. 왠지 그 얘기를 하고 있는 것 같아서 말이다.
- gpt에 물어봐도 가능하다고 얘기하는 듯…