M2 Vmware Fusion13 ping不到主机和百度网络

mac的terminal里配置

创建目录和文件

sudo mkdir -p /Library/Preferences/VMware\ Fusion/vmnet8
sudo touch /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf


 

用文本编辑器编辑nat.conf文件

sudo nano /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf

更新后的 nat.conf 文件

# VMware NAT configuration file
# Manual editing of this file is not recommended. Using UI is preferred.

[host]

# Use MacOS network virtualization API
useMacosVmnetVirtApi = 1

# NAT gateway address (update to match your subnet)
ip = 192.168.1.1
netmask = 255.255.255.0

# VMnet device if not specified on command line
device = vmnet8

# Allow PORT/EPRT FTP commands (they need incoming TCP stream ...)
activeFTP = 1

# Allows the source to have any OUI.  Turn this on if you change the OUI
allowAnyOUI = 1

[incomingtcp]
# Forward host port 2222 to guest port 22 (SSH)
2222 = 192.168.1.100:22

[incomingudp]
# Example: forward host port 3333 to guest port 3333
# 3333 = 192.168.1.100:3333


 

配置虚拟机的静态IP

查询ip地址

ip addr

这里我的文件是ens160

配置文件ens160

sudo nano /etc/sysconfig/network-scripts/ifcfg-ens160

  1. IPADDR 是虚拟机的静态 IP 地址。
  2. PREFIX=24 等同于子网掩码 255.255.255.0
  3. GATEWAY 是网关地址(与你的 nat.conf 文件中一致)。
  4. DNS1DNS2 是 DNS 服务器地址,可以根据需要更改。

重启网络服务

sudo systemctl restart network

最后试

ping baidu.com

和ping 主机

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值