LAN Hosting Guide: Access Your Projects Across Home Devices
#networking#local server#ssh#web development#home networking
Share your local development projects across devices without complex setups or cloud services
What is LAN Hosting?
LAN Hosting (Local Area Network Hosting) allows you to run a project on one machine and access it from any device on the same WiFi network.
Step-by-Step Implementation
1. Configure Your Backend (Machine A)
Node.js (Express) Example
const express = require('express');const app = express();
app.get('/', (req, res) => { res.send('Project accessible across network!');});
// Critical: Bind to 0.0.0.0const PORT = 3000;app.listen(PORT, '0.0.0.0', () => { console.log(`Server running at http://0.0.0.0:${PORT}`);});Python Simple Server
# Hosts current directory at port 8000python -m http.server 8000 --bind 0.0.0.0Key Configuration:
Always bind to 0.0.0.0 instead of localhost to allow network access.
2. Find Your Local IP Address
Windows
- Open Command Prompt
- Execute:
ipconfig - Look for
IPv4 Addressunder your WiFi adapter
(Example:192.168.1.100)
Linux/macOS
- Launch Terminal
- Run:
ifconfigorip a - Find
inetaddress underwlan0/en0
(Example:192.168.1.100)
3. Access from Another Device (Machine B)
- Ensure both machines are on the same WiFi
- On Machine B’s browser, visit:
http://<Machine-A-IP>:<PORT>
(Example:http://192.168.1.100:3000)
SSH Access Troubleshooting
Encountering “Connection refused” when trying to SSH between machines? Follow these steps:
1. Verify SSH Service Status
systemctl status sshd2. Start and Enable SSH Service
sudo systemctl start sshdsudo systemctl enable sshd # Enable on bootAdvanced Techniques
Persistent Access with Local DNS
Assign a fixed local domain:
# On Machine B's /etc/hosts192.168.1.100 touch.grassAccess via: http://touch.grass:3000
Security Considerations
- Temporary Exposure: Disable network binding when not testing
- Firewall Restrictions: Only open necessary ports
- Authentication: Add basic auth for sensitive projects
// Express basic authconst basicAuth = require('express-basic-auth')app.use(basicAuth({users: { username: "password" },challenge: true,}));