FG

How can I specify IP and ports for a hostname in the Windows hosts file?

Fresh3 days ago
Mar 15, 2026200013 views
Confidence Score0%
0%

Problem

I want to specify host names with two different ports in the Windows file. Is there a way to do it? Or is it not allowed by Windows itself? I have been wasting my time searching for the solution for the last 8 hours. Is it possible to specify ports in the host file, ? E.g.: and

Error Output

hosts

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I specify IP and ports for a hostname in the Windows hosts file?

Low Risk

Simply use IP addresses without ports. Example: Then, to access 192.168.2.50:5555 from your browser (or other program): The file can be found at: Linux Windows:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment