Skip to content

macOS VMware Fusion Ubuntu Virtual Machine Static IP Configuration Pitfall Record ​

Illustration of pitfalls encountered when configuring a static IP for an Ubuntu virtual machine in VMware Fusion on macOS

The Entire Troubleshooting Process for a "Mysterious" Network Problem Caused by an Incorrect Gateway Address

Background ​

Running an Ubuntu 22.04 virtual machine with VMware Fusion on macOS, after configuring a static IP the network is unreachable, but everything works fine in DHCP mode.

symptom ​

phenomenonStatus
ping 192.168.101.1(host bridge)Through
ping 8.8.8.8(Public IP)Not through
ping bing.comUnreachable (DNS cannot resolve it either)
DHCP modeCompletely normal

Misconfiguration ​

yaml
network:
  version: 2
  ethernets:
    ens33:
      dhcp4: false
      addresses:
        - 192.168.101.100/24
      routes:
        - to: default
          via: 192.168.101.1      # Error! This is the host bridge, not the NAT gateway.
      nameservers:
        addresses:
          - 223.5.5.5
          - 114.114.114.114

Troubleshooting process ​

1. Confirm that the IP has taken effect ​

bash
ip addr show ens33
# inet 192.168.101.100/24 ... Static IP is now active

2. Test gateway connectivity ​

bash
ping 192.168.101.1
# 64 bytes from 192.168.101.1 ... The gateway can be pinged.

3. Test external network connectivity ​

bash
ping 8.8.8.8
# 100% packet loss, external network unreachable

4. Check the routing table ​

bash
ip route show | grep default
# default via 192.168.101.2 dev ens33 proto dhcp src 192.168.101.129 metric 100

Key findings: The gateway obtained in DHCP mode is 192.168.101.2, rather than 192.168.101.1!

5. Check the host network interfaces ​

bash
ifconfig
# bridge102: inet 192.168.101.1  ← This is the host-side bridge interface

Root cause analysis ​

In a VMware Fusion NAT network, IP addresses are assigned as follows:

IP addressRoleDescription
192.168.101.1Host bridgeThe bridge102 interface on macOS, used for communication between the host and virtual machines.
192.168.101.2NAT GatewayThe address that the VMware NAT service (vmnet-natd) listens on, responsible for forwarding traffic to the external network
192.168.101.128/129Virtual machine IPThe address assigned to the virtual machine by DHCP

Therefore:

  • 192.168.101.1= Host bridge (virtual machine ↔ host machine)

  • 192.168.101.2 NAT gateway (virtual machine ↔ external network)

Point the default route to 192.168.101.1, the packets stop once they reach the host bridge and cannot be forwarded to the external network.

Correct configuration ​

Step 1: First use DHCP to obtain the correct gateway address. ​

bash
sudo dhclient -v ens33
ip route show | grep default
# default via 192.168.101.2 dev ens33 ...   ← Note down this gateway address

Step 2: Disable cloud-init (to prevent it from being overwritten after reboot) ​

bash
sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg <<EOF
network: {config: disabled}
EOF

Step 3: Configure static IP ​

bash
sudo tee /etc/netplan/50-cloud-init.yaml <<'EOF'
network:
  version: 2
  ethernets:
    ens33:
      dhcp4: false
      addresses:
        - 192.168.101.100/24
      routes:
        - to: default
          via: 192.168.101.2      # Key: Use the gateway obtained via DHCP.
      nameservers:
        addresses:
          - 223.5.5.5
          - 114.114.114.114
EOF

Step 4: Apply configuration ​

bash
sudo netplan apply

Step 5: Verification ​

bash
ping 8.8.8.8
ping bing.com

Pitfall Avoidance Guide ​

pitCorrect approach
Write the network card name.eth0Ubuntu 22.04 实际网卡名是 ens33
Gateway write 192.168.101.1Use first ip route show View the actual gateway obtained via DHCP
Write gateway comments gateway4Ubuntu 22.04 is deprecated gateway4, must use routes
cloud-init is not disabledThe configuration will be overwritten on every restart; you need to add 99-disable-network-config.cfg

Summary ​

Core lesson: When configuring a static IP,Don't make up the gateway address. The correct approach is:

  • Start in DHCP mode first.

  • Execute ip route show | grep default Get the real gateway

  • Configure a static IP using this gateway.

bash
# Golden Triple Combo
sudo dhclient -v ens33          # Get DHCP assignment
ip route show | grep default    # View real gateway
# Configure a static IP using the discovered gateway.

This document was recorded on 2026-08-20, macOS 13.3.1 + VMware Fusion 13.6.3 + Ubuntu 22.04

Last updated on11/07/2026, 02:16 PM
@fishfinal | @fishfinals | [email protected]