CGNAT Inspector

CGNAT Inspector

Leader 42 123 280
calendar_today agoschedule2 min read

If you've ever tried to self-host a website, game server, VPN, or NAS from your home network, you've probably encountered one frustrating problem: Carrier-Grade NAT (CGNAT).

Many Internet Service Providers now place customers behind CGNAT to conserve IPv4 addresses. While this works fine for everyday internet browsing, it can prevent inbound connections, making self-hosting much more difficult.

The challenge is that many people don't even realize they're behind CGNAT.

That's why I built CGNAT Inspector.

What is CGNAT?

Carrier-Grade NAT allows an ISP to let multiple customers share a single public IPv4 address.

Instead of your router receiving a unique public IP address, it receives another private or shared address from your ISP. As a result, services like:

  • Home servers
  • WireGuard VPN
  • Minecraft servers
  • Plex
  • Nextcloud
  • SSH access
  • Port forwarding etc.

may not work as expected.

Introducing CGNAT Inspector

CGNAT Inspector is a lightweight Bash utility that performs several independent tests to determine whether your network is behind CGNAT.

Rather than relying on a single check, it combines multiple detection techniques to provide a more reliable result.

Features

  • Detect Carrier-Grade NAT
  • Compare router WAN IP with your public IP
  • Detect private WAN addresses
  • Analyze traceroute for ISP NAT
  • Identify Double NAT scenarios
  • JSON output for automation
  • Colorized terminal output
  • Machine-readable exit codes
  • Lightweight with minimal dependencies

Example Output

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
      CGNAT Inspector v1.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Local Address
192.168.1.54

Router WAN
100.91.14.23

Public IP
102.89.32.17

Result

STATUS : CGNAT DETECTED

Confidence : 100%

Why I Built It

As someone who enjoys building homelabs and self-hosted services, I've spent countless hours troubleshooting networking issues that eventually turned out to be CGNAT.

Existing methods often involve manually comparing IP addresses, checking router settings, or running multiple networking tools. I wanted a simple command-line utility that could perform these checks automatically and present the results in a clear, actionable way.

CGNAT Inspector is the result.

Who Is It For?

This tool is useful for:

  • Homelab enthusiasts
  • Self-hosting beginners
  • Linux users
  • System administrators
  • DevOps engineers
  • Network engineers
  • Anyone wondering why port forwarding isn't working

Future Plans

The project is just getting started. Planned improvements include:

  • IPv6 diagnostics
  • STUN-based NAT detection
  • Docker image
  • Prometheus exporter
  • Home Assistant integration
  • Interactive terminal interface
  • Port reachability testing

Get Involved

CGNAT Inspector is open source, and contributions are always welcome. Whether you'd like to report a bug, suggest a feature, improve the documentation, or submit code, your help is appreciated.

If you find the project useful, consider starring the repository and sharing it with other homelab and self-hosting enthusiasts.

Happy networking!

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

What Is SARIF and How Does It Help Security Tools Work Together?

Ganesh Kumar - Jul 4

If I Lost My Setup Today, Here’s the First Script I’d Rewrite (Laravel + Node.js Dev Environment)

Gift Balogun - Apr 6

SmartAlert-T (SAT)

Gift Balogun - Jun 19

Building More Than Software: Why I Started Royal Bcode Ventures Ltd

Gift Balogun - Jul 3

The Rise of ARM Servers: Should Developers Care My Take?

Gift Balogun - Jun 19
chevron_left
16.7k Points445 Badges
Rivers State, Nigeriagiftbalogun.name.ng
84Posts
362Comments
48Connections
I’m a backend-focused full stack developer with over 6 years of experience building scalable, secure... Show more

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
4 comments
2 comments

Contribute meaningful comments to climb the leaderboard and earn badges!