Localhost vs Network IP - Explained

Understanding why some URLs only work on your computer and how to access services from other devices.

The Two Types of Addresses

127.0.0.1 (Localhost)

What it means: "This computer only"

Also known as: localhost

Who can access it: Only the machine running the service

Example: http://127.0.0.1:5001/

Network IP (e.g., 10.0.0.134)

What it means: Your computer's address on the local network

Who can access it: Any device on the same WiFi/network

Example: http://10.0.0.134:5001/

Visual Diagram

Your Laptop (10.0.0.134) ┌─────────────────────────────────────────┐ │ │ │ 127.0.0.1 ──► Only works HERE │ │ ▲ │ │ │ │ │ [Web Server on Port 5001] │ │ │ │ │ ▼ │ │ 10.0.0.134 ──► Works from ANYWHERE │ │ on the network │ └─────────────────────────────────────────┘ │ │ WiFi Network ▼ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │ Phone │ │ TV │ │ Tablet │ │ │ │ │ │ │ │ Can access: │ │ Can access: │ │ Can access: │ │ 10.0.0.134 │ │ 10.0.0.134 │ │ 10.0.0.134 │ │ │ │ │ │ │ │ CANNOT access:│ │ CANNOT access:│ │ CANNOT access:│ │ 127.0.0.1 │ │ 127.0.0.1 │ │ 127.0.0.1 │ └───────────────┘ └───────────────┘ └───────────────┘

Why Does This Happen?

127.0.0.1 is a "Loopback" Address

When you type 127.0.0.1, your computer says "talk to myself" - the request never leaves your machine.

Every computer has its own 127.0.0.1, so when your phone tries to access 127.0.0.1, it's trying to talk to itself, not your laptop!

Network IP is Your "Real" Address

Your router assigns each device a unique IP address (like 10.0.0.134).

Other devices use this address to find and talk to your computer over the network.

How to Find Your Network IP

Linux/Kali Command

ip addr show wlan0 | grep "inet "

Or for all interfaces:

hostname -I

What to Look For

Home networks usually use:192.168.x.x or 10.0.x.x
Ignore these:127.0.0.1 (localhost)

Making Services Accessible on Network

The Server Must Bind to 0.0.0.0

For other devices to access your service, it must listen on all interfaces:

app.run(host='0.0.0.0', port=5001)

0.0.0.0 means "listen on ALL network interfaces" (both localhost AND network IP)

If It Only Binds to 127.0.0.1

app.run(host='127.0.0.1', port=5001)

This will ONLY work from the same computer - other devices cannot connect!

Quick Reference

Common Scenarios

Kismet Web UI On laptop: http://127.0.0.1:2501
From phone: http://10.0.0.134:2501
Live RF Sensors On laptop: http://127.0.0.1:5001
From phone: http://10.0.0.134:5001
BirdNET On laptop: http://127.0.0.1:PORT
From phone: http://10.0.0.134:PORT

Troubleshooting

Can't Connect from Phone/TV?

Check if Port is Open

sudo ss -tlnp | grep 5001

Look for 0.0.0.0:5001 (accessible from network) vs 127.0.0.1:5001 (local only)

IP Address Changes?

Your local IP can change after rebooting or reconnecting to WiFi.

Always re-check with: hostname -I

Summary

127.0.0.1This computer only (loopback)
0.0.0.0Listen on ALL interfaces (for servers)
10.0.0.x / 192.168.x.xYour real network address (shareable)