为什么我们在Port Forwarding的时候一定要使用8001端口?

Why do we have to use port 8001 when Port Forwarding?

我已经尝试尽可能多地研究这件事,但我似乎无法理解一件事。对于我的大学项目,我们需要执行以下操作:

  • In VirtualBox Manager select File>Preferences. Select Network and choose NatNetwork (or the one you are using).
  • Chose the edit network icon.
  • Select Port Forwarding
  • In the dialogue box provide a name for the rule (e.g. web), leave the host IP blank, provide a host port (e.g. 8001), then enter the Guest IP as the IP address of UBUNTU#1 and Guest port as 80 for a web server (answer yes to any Firewall questions).
  • Start a simple web server on UBUNTU#1 by using the following command in the terminal window:

    sudo python2 -m SimpleHTTPServer 80
    
  • Start Wireshark on the private network.
  • Start a web browser on the host computer and enter x.x.x.x:8001, where x.x.x.x is the IP address of your host computer.

现在我们需要解释一下为什么要使用这个地址和端口号?

我的理解是,正在使用的 IP 地址属于网络上的 router/client,我们希望 Internet 上的计算机可以访问该地址。

我不明白的是为什么我们必须使用端口 8001?

我看到端口 8001 用于诊断,我也看到 8001 被使用是因为它是一个可用端口。但是如果是别人在用怎么可能有。

只要服务器和客户端都同意端口号,您可以使用任何您喜欢的端口。

通常,大多数服务都使用 "well known" 端口来方便其他人连接到它们(例如,TCP 25 用于 SMTP,UDP 53 用于 DNS,TCP 80 用于 WWW,...)。