Mac无法连接NAT虚拟机,需要配置DNS网段

问题

  1. 无法ping通NAT网段为172.16.1.x的虚拟机

解决方案

  1. 查看/etc/resolv.conf中网段配置,修改nameserver为172.16.1.1即可
panzhijie-mac:~ panzhijie$ cat /etc/resolv.conf 
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
#   scutil --dns
#
# SEE ALSO
#   dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
nameserver fe80::1xx5:76xx:502e:60
nameserver 172.20.10.1 #修改nameserver为172.16.1.1即可
  1. 测试ping命令是否连通
panzhijie-mac:~ panzhijie$ ping 172.16.1.10
PING 172.16.1.10 (172.16.1.10): 56 data bytes
64 bytes from 172.16.1.10: icmp_seq=0 ttl=64 time=0.379 ms
64 bytes from 172.16.1.10: icmp_seq=1 ttl=64 time=0.518 ms
64 bytes from 172.16.1.10: icmp_seq=2 ttl=64 time=0.522 ms
64 bytes from 172.16.1.10: icmp_seq=3 ttl=64 time=0.508 ms

你可能感兴趣的:(Mac无法连接NAT虚拟机,需要配置DNS网段)