Skip to content

Setting Up a Home Router for Hosting and Server Access: Homelab Experience

After configuring my homelab using Proxmox and Ubuntu-based services (Nextcloud, web hosting, etc.), I needed to make these services accessible from outside my network. With the right router setup and a few precautions, it’s absolutely possible to run a public-facing server from home.

In this guide, I’ll walk you through how I configured my home router to route traffic to my self-hosted servers, while keeping the network secure and stable.

1. Prerequisites

Before configuring your router, make sure:

• Your server/VM has a static local IP (e.g., 192.168.1.50)

• Your router supports port forwarding (most consumer routers do)

• You either:

• Have a public static IP from your ISP, or

• Use a Dynamic DNS (DDNS) service (e.g., DuckDNS, No-IP)

2. Assign a Static IP to Your Server

This ensures the port forwarding rules always point to the same internal device.

Option 1: Set static IP on the server itself

Edit /etc/netplan/ config on Ubuntu:

network:

  version: 2

  ethernets:

    enp3s0:

      dhcp4: no

      addresses: [192.168.1.50/24]

      gateway4: 192.168.1.1

      nameservers:

        addresses: [1.1.1.1, 8.8.8.8]

Apply:

sudo netplan apply

Option 2: Use DHCP reservation in your router

Login to your router’s admin panel (usually at 192.168.1.1), find DHCP Reservation or Static Lease, and bind the server’s MAC address to a specific IP.

3. Configure Port Forwarding on the Router

Log into your router and find the Port Forwarding section.

Common Services:

Service Port Protocol Example Forwarding To

HTTP 80 TCP 192.168.1.50:80

HTTPS 443 TCP 192.168.1.50:443

SSH 22 TCP 192.168.1.50:22 (change externally!)

Proxmox GUI 8006 TCP 192.168.1.50:8006

WireGuard VPN 51820 UDP 192.168.1.50:51820

Tip: For security, forward external ports like 2222 → 22 or 8443 → 443 to avoid scans.

4. Set Up Dynamic DNS (If You Have a Dynamic IP)

Most ISPs assign dynamic IPs, which can change. Use a free DDNS service like DuckDNS, No-IP, or Cloudflare DNS with API updates.

Example: DuckDNS on Ubuntu

sudo apt install curl

mkdir -p ~/duckdns

nano ~/duckdns/duck.sh

Paste:

echo url=”https://www.duckdns.org/update?domains=yoursubdomain&token=YOUR_TOKEN&ip=” | curl -k -o ~/duckdns/duck.log -K –

Make it executable and schedule with cron:

chmod +x ~/duckdns/duck.sh

(crontab -l ; echo “*/5 * * * * ~/duckdns/duck.sh >/dev/null 2>&1”) | crontab –

Now your yoursubdomain.duckdns.org always points to your home IP.

5. Secure the Setup

• Use UFW or iptables on your server to allow only necessary ports

• Use Let’s Encrypt SSL (via Certbot) for HTTPS

• Change default ports for SSH or disable password login

• Regularly update and patch all services

• Monitor traffic using fail2ban, logs, or a web dashboard

6. Test Remote Access

From outside your network (mobile data or external Wi-Fi):

• Open http://yourdomain.duckdns.org — should load your website or Nextcloud

• Try ssh -p 2222 user@yourdomain.duckdns.org (if forwarded SSH)

• Try connecting with the WireGuard client if VPN is set up

Conclusion

By configuring my home router with static IPs, port forwarding, and a DDNS service, I was able to expose websites, SSH access, Proxmox, and VPN to the internet securely and reliably. This turns my homelab into a real-world hosting environment — perfect for development, remote access, and IT experimentation.

With just a few firewall rules and domain tools, you can host from home like a pro.

Leave a Reply

Your email address will not be published. Required fields are marked *

wpChatIcon
wpChatIcon