DEV Community

alok-38
alok-38

Posted on

How to Access SSH and HTTP from Windows on a VMware Ubuntu VM

Commands to execute and test both SSH and HTTP after you set up a Ubuntu VM on VMware workstation pro

# Bring interface up
sudo ip link set ens33 up
sudo dhclient -v ens33

# Check IP & routes
ip a
ip route

# Test Internet & DNS
ping -c 3 8.8.8.8
ping -c 3 google.com

# Set temporary DNS
sudo nano /etc/resolv.conf
# nameserver 8.8.8.8
# nameserver 8.8.4.4

# Install SSH and HTTP servers
sudo apt update
sudo apt install openssh-server apache2 nginx -y
sudo systemctl enable --now ssh
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp

# Resolve Apache/nginx port conflict
sudo nano /etc/apache2/ports.conf       # Listen 8080
sudo nano /etc/apache2/sites-available/000-default.conf  # <VirtualHost *:8080>
sudo systemctl restart apache2
sudo systemctl enable apache2

# Check running services & listening ports
sudo systemctl status apache2
sudo systemctl status nginx
sudo lsof -i :80
sudo lsof -i :8080

# VMware NAT port forwarding
# Host → VM mapping:
# 2222 → 22 (SSH)
# 8080 → 8080 (Apache)
# 80 → 80 (nginx)

# Restart VMware NAT services (Windows)
# VMware NAT Service
# VMnetDHCP Service

# Test TCP connectivity from Windows
Test-NetConnection -ComputerName 127.0.0.1 -Port 2222

# SSH from Windows
ssh alok@127.0.0.1 -p 2222

# HTTP from Windows
# nginx → http://127.0.0.1
# Apache → http://127.0.0.1:8080
Enter fullscreen mode Exit fullscreen mode

Top comments (0)