VM 查看vmnet8网关(Mac版)

由于配置虚拟机网络时候需要配置gateway,
在这里插入图片描述
但是在VM Mac中无法查看
所以需要打开终端
输入:cat cat /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf

找到
NAT gateway address
在这里插入图片描述
第一个为gateway,第二个为netmask

然后去虚拟机修改网关就哦了

vmnet8VMware 中默认的 NAT 网络,它可以为虚拟机提供 NAT 服务,使其可以与主机和其他虚拟机相互通信,同时也可以访问外部网络。下面是配置 VMwarevmnet8 NAT 的步骤: 1. 在主机上VMware 安装目录,进入 "networking" 文件夹,到 "nat.conf" 文件。 2. 使用文本编辑器打开 "nat.conf" 文件,在文件末尾添加以下内容: ``` [incomingtcp] # Use these with care - anyone can enter into your VM through these... # The format and example are as follows: #<external port number> = <VM's IP address>:<VM's port number> #8080 = 192.168.39.129:80 [incomingudp] # Use these with care - anyone can enter into your VM through these... # The format and example are as follows: #<external port number> = <VM's IP address>:<VM's port number> [outgoingtcp] # Use these with care - anyone can enter into your VM through these... # The format and example are as follows: #<VM's IP address>:<VM's port number> = <external port number> #192.168.39.129:80 = 8080 [outgoingudp] # Use these with care - anyone can enter into your VM through these... # The format and example are as follows: #<VM's IP address>:<VM's port number> = <external port number> ``` 3. 修改上述配置文件中的端口映射规则,将外部端口与虚拟机的 IP 地址和端口号对应起来。例如,将外部的 8080 端口映射到虚拟机的 192.168.39.129:80 端口上。 4. 保存 "nat.conf" 文件后,重启 VMware Workstation 服务或者重启主机,让新的配置生效。 5. 在虚拟机中,使用 DHCP 自动获取 IP 地址,或者手动配置 IP 地址和默认网关,确保虚拟机与主机和其他虚拟机在同一局域网内。 6. 如果需要访问外部网络,可以在虚拟机中配置默认网关和 DNS 服务器,或者在 NAT 配置中添加端口转发规则,将虚拟机的网络流量转发到主机或其他外部网络中。 需要注意的是,vmnet8VMware 中默认的 NAT 网络,如果修改了默认的 NAT 配置,可能会影响其他虚拟机的网络通信。因此,在修改 NAT 配置时,需要谨慎处理,并且备份原始配置文件,以便在出现问题时进行恢复。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值