Self-Hosting in Malaysia: Overcoming CGNAT for Your Homelab

HongHong
3 min read

Dreaming of running your own server or "homelab" in Malaysia? Many internet service providers (ISPs) like TM Unifi and Maxis Fiber utilize Carrier-Grade NAT (CGNAT) for IPv4 address management. This means your home router is assigned a private IP address, not a public one, which prevents direct external access to your server or even your Wi-Fi camera when you're away. But don't worry, there are effective solutions!

The RM 10 Solution: Public IP Allocation

Both TM Unifi and Maxis Fiber offer a straightforward solution: a public IP address allocation for a nominal monthly fee of RM 10. Simply contact their customer service hotline to request this. They will schedule a date for the change, which usually just requires you to restart your router. The best part? No complex configurations are needed on your end.

Important Note: This is a dynamic public IP address, meaning it will change periodically. For seamless access, you'll want to pair this with a dynamic DNS solution (covered next).

Seamless Access with a Domain Name and Dynamic DNS (DDNS)

Constantly tracking a changing IP address is impractical. The ideal solution is to use a (sub)domain name to access your homelab. This is where Dynamic DNS (DDNS) comes in.

My Preferred Method: Custom Domain with Cloudflare

I personally recommend purchasing your own domain name (e.g., from Namecheap) and managing its DNS records through Cloudflare. Cloudflare offers robust DNS management and additional security features. To keep your domain linked to your dynamic IP, you can set up a cron job to execute a simple shell script that automatically updates your DNS records via the Cloudflare API. (Pro-tip: AI tools can even help you generate this script!)

Free Alternative: Duck DNS

For those on a budget or looking for a quick setup, Duck DNS provides free subdomains and ready-to-use scripts for automatic DNS record updates. Additionally, if your router has built-in Dynamic DNS (DDNS) support, you can often configure it directly with a service like Duck DNS for automatic IP updates.

Advanced Connectivity Alternatives

For more robust or specialized homelab setups, consider these advanced methods:

  • Tailscale: This creates a secure mesh VPN network between your devices, allowing you to access your homelab as if all your devices were on the same local network, regardless of their physical location or underlying network configuration (including CGNAT). It's excellent for secure, direct access.
  • Cloudflare Tunnel: This service securely connects your internal applications and servers to Cloudflare's network without exposing any public IP addresses or opening firewall ports. Traffic is proxied through Cloudflare, providing enhanced security and performance, and it's particularly useful for exposing web services.

By implementing these strategies, you can easily overcome the challenges of CGNAT and unlock the full potential of self-hosting your homelab in Malaysia.

0
Subscribe to my newsletter

Read articles from Hong directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hong
Hong

I am a developer from Malaysia. I work with PHP most of the time, recently I fell in love with Go. When I am not working, I will be ballroom dancing :-)