EP5: Basic Networking in VMware Workstation

In this episode, you’ll learn how to set up basic networking in VMware Workstation, and how to configure IP addresses in RHEL or Rocky Linux 9 using the command line — exactly like you’ll do in the RHCSA exam.


🧩 How Networking Works in VMware Workstation

VMware creates virtual network adapters to connect your VM to the real world.

Most common options:

Mode

Description

Use Case

NAT

VM uses host’s IP to access internet

Default mode, works for browsing

Bridged

VM gets its own IP from your LAN/router

✅ Best for RHCSA labs

Host-only

VM only talks to host, no internet

For isolated labs

Recommendation: Use Bridged Adapter so your VM behaves like a real server on your network.


🛠️ Step 1: Set VM to Bridged Mode in VMware Workstation

  1. Shut down your VM

  2. Right-click → Settings

  3. Go to Network Adapter

  4. Select Bridged: Connected directly to the physical network

  5. (Optional) Check: Replicate physical network connection state

  6. Click OK, then Power ON the VM


🖥️ Step 2: Check Network Inside Linux (RHEL / Rocky 9)

nmcli stands for:

Network Manager Command Line Interface

1. Check Interface Status

nmcli device status

Look for interfaces like ens33, enp0s3, or eth0

2. Show IP Address

ip a

✅ If DHCP is working, your VM should get an IP like 192.168.1.X or similar from your router.


⚙️ Step 3: Enable Interface (if no IP)

nmcli connection show
nmcli connection up ens33

Replace ens33 with your actual interface name

If still not working:

systemctl restart NetworkManager

🔧 Step 4: Set Static IP Address (RHCSA Requirement)

In the RHCSA exam, you must know how to set a static IP using CLI.

Example (using nmcli):

nmcli con mod ens33 ipv4.addresses 192.168.1.100/24
nmcli con mod ens33 ipv4.gateway 192.168.1.1
nmcli con mod ens33 ipv4.dns 8.8.8.8
nmcli con mod ens33 ipv4.method manual
nmcli con up ens33

🔍 Replace ens33 with your actual interface name.


🔍 Step 5: Test & Verify Network

ip a
ping -c 3 google.com

✅ If you can ping, your networking is working.


🧠 Common Networking CLI Commands

Command

Purpose

nmcli device status

Check device status

nmcli con show

List saved connections

nmcli con mod

Modify connection

nmcli con up <name>

Activate interface

ip a

View IP address

ping <host>

Check connectivity

systemctl restart NetworkManager

Restart networking service

🎁 Bonus: Basic Static Routing in Linux


🧠 Why Add a Static Route?

Sometimes, your VM/server needs to reach a different subnet (e.g., 10.10.10.0/24), and the default gateway (example: R1) doesn’t know where that is.

A static route tells your Linux system:

“To reach this network, send traffic through this gateway.”


🔧 1. Add Static Route – Non-Persistent (Temporary)

Pro-Tips:

Use Non persistent first and use specific route for example 10.10.10.100/32 for less destructive. In production

This method adds the route immediately, but it will be lost after reboot.

🔹 Command:

ip route add 10.10.10.0/24 via 192.168.19.1 dev ens34

Field

Meaning

10.10.10.0/24

Destination network you want to reach

via 192.168.19.1

Gateway to reach that network

dev ens34

Your active network interface

🔹 Check the route:

ip route show

🔐 2. Make Static Route Persistent (Survives Reboot)

For RHCSA and real servers, persistent routing is preferred.

There are two ways depending on RHEL/Rocky version:


nmcli connection modify ens33 +ipv4.routes "10.10.10.0/24 192.168.19.1"
nmcli connection up ens33

The + appends the route (so you don’t overwrite existing config)

🔍 Then check:

nmcli connection show ens33 | grep ipv4.routes

✅ Option B: Edit config file (alternative method)

For interface ens33, edit this file:

sudo nano /etc/sysconfig/network-scripts/route-ens33

Add this line:

10.10.10.0/24 via 192.168.19.1 dev ens33

Save and exit.

Then:

sudo systemctl restart NetworkManager

🛠️ Troubleshooting Commands

Check command

What it does

ip route

View current routing table

nmcli connection show

View active network profile

nmcli connection reload

Reload modified connection

ping <ipaddress>

Test if route is working

traceroute <ipaddress>

See the routing path

Updated on