Configure port forwarding with NAT

本文详细介绍了如何使用NAT配置在虚拟机应用中设置端口转发规则,实现虚拟机监听特定端口并在主机上进行转发,以暴露相同端口供主机访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

From: http://scriptogr.am/kevinshen/post/configure-port-forwarding-with-nat

terminology:

  • guest: virtual machine like Ubantu

  • host: physical machine where virtual machine is running on, e.g. Windows 7

  • virtual machine app: VMware, Virtual Box etc.

with NAT configuration:

guest lives in a private network virtual machine app created. host and other guest can't access the service it exposes. use port forwarding will let virtual machine app listens to the certain ports on the host and forward to guest. we will utilize it to expose same port on both host and guest

Steps:

  1. create a rule in the virtual machine application, set Host IP: 127.0.0.1, set HostPort: 3000, set Guest Port: 3000
  2. in guest, listen to port 3000.
  3. in host, open a web browser, type: localhost:3000. it will send get request to guest
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值