Skip to main content

Command Palette

Search for a command to run...

Self-Hosting in Malaysia: Overcoming CGNAT for Your Homelab

Updated
3 min read
Self-Hosting in Malaysia: Overcoming CGNAT for Your Homelab
H

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 :-)

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.

S
sussy_weeb7mo ago

Good day, Mr.Hong, thank you for sharing this blog post, reading it has helped me plan for my homelab networking to be used outside of my local network. Regarding the ISP in Malaysia using CGNAT, i am abit confused because when i query chatgpt regarding external access to my computers, it mentioned that using DDNS would not work if the ISP is using CGNAT, but i would assume that you got it working using DDNS, would it mean that the ISP in Malaysia are not using CGNAT? Thank you for reading. Your insight in this topic would be much appreciated.

H
Hong7mo ago

With CGNAT, you are sharing a pool of public IPs with other subscribers. So even with DDNS setup, incoming connections will not be forwarded to you. You need to get a dedicated public IP address.

I am a MAXIS Fiber subscriber, MAXIS is using CGNAT. Setting up DDNS alone is not enough. In this article I mentioned additionally paying RM 10.00 monthly for allocating public IP. That allocated (dynamic) public IP will be dedicated to me and not shared with other subscribers. Then I setup DDNS to point (sub)domain names to this public IP.

H
Hong7mo ago

Btw, I am not sure if all Malaysia ISP use CGNAT. Based on my experience, TM and MAXIS are both using CGNAT.

More from this blog

Hong's Tech Blog

110 posts

The blog is older than you know. I prefer counting from the emergence of one integral anomaly to the emergence of the next, in which case this is the forth version.

Self-Hosting in Malaysia: Overcoming CGNAT for Your Homelab