Skip to content
Go back

Setting Static IP using nmtui on vmware workstation.

Published:

For Your Linux Virtual Machine (VM) running in VMware Workstation:

This is where the magic happens for consistent access. If you want your VM to always have the same IP address from the perspective of your host machine, or if you want it to be accessible consistently on the current local network you’re on, you should primarily use NAT networking in VMware Workstation.

A. VMware Network Adapter Setting for the VM: Use NAT (Network Address Translation)

output

B. Static IP Configuration Inside the VM (using nmtui)

outpust

C. Accessing the VM:

  1. From your Host Laptop (most common): You will always connect to your VM using its static IP address within the NAT network.

    • Example: ssh [email protected]
    • This IP will never change, regardless of where your laptop is. out
  2. From Other Devices on the Same Physical Network as your Laptop (e.g., another PC in your home network): This requires Port Forwarding on your Host Laptop (within VMware Workstation).

    • In VMware Workstation, go to your VM’s Network Adapter settings (ensure it’s NAT).
    • Click the “Port Forwarding” button (or similar in VMware Fusion/Workstation Pro, it’s usually under NAT settings in Virtual Network Editor).
    • Add a rule:
      • Host Port: 2222 (or any other unused port on your host, not 22 to avoid conflicts)
      • Virtual Machine IP: 192.168.100.10 (your VM’s static IP)
      • Virtual Machine Port: 22 (or your service’s port, e.g., 3306 for MySQL)
      • Protocol: TCP
    • Now, from another device on your local network, you would connect to your Host Laptop’s current IP address on the Host Port you just configured.
      • Example: If your laptop’s current Wi-Fi IP is 192.168.1.50, then from another PC: ssh [email protected] -p 2222
    • The downside: Your laptop’s 192.168.1.50 IP will change when you move networks. So, you’d need to find your laptop’s current IP each time if you want to connect from other local devices.

Suggest Changes

Previous Post
🐧💻 Linux Directories & Config Files Demystified - What Every DevOps Should Know
Next Post
Zsh Setup with Auto-Suggestions, Syntax-highlighting & Themes