Sunday, June 7, 2026

Bypassing HTTP: The Fastest Way to Find Your External IP via Command Line

Ever found yourself needing your public IP address while staring at a headless server terminal?

The standard approach for most developers is to ping an external HTTP service using curl or wget. While that works perfectly fine, there is a faster, more elegant way to do it that bypasses the web protocol entirely.

In this post, we’ll look at the traditional web-based methods, unpack a clever DNS-based trick that drastically speeds things up, and show you how to implement it on both Linux and Windows.

The Traditional Way: HTTP Requests

Most of us have these commands permanently burned into our muscle memory:

# The classic curl method
curl ifconfig.me

# Reliable alternatives
curl icanhazip.com
curl api.ipify.org

If you are on a fresh Linux install without curl, you might fall back on wget:

wget -qO- ifconfig.me

The Downside to HTTP

While reliable, these tools require your machine to perform a full TCP handshake, negotiate SSL/TLS encryption certificates, and download a web request. It’s a lot of overhead just to get a single string of numbers back.

The Power-User Alternative: The DNS Trick

If you want maximum speed, you can bypass HTTP entirely and query DNS (Domain Name System).

Because DNS is built on lightweight UDP packets, it doesn’t require the heavy setup of a web connection. It fires a single packet out, and gets a single packet back.

On Ubuntu/Linux, you can leverage Cloudflare's diagnostic tools using the dig command:

dig +short txt ch whoami.cloudflare @1.1.1.1

How Does This Sorcery Work?

Let’s break down exactly what that command is doing:

  • dig: The Domain Information Groper, Linux's native tool for probing DNS servers.
  • +short: Tells dig to suppress its usual verbose network text and only output the answer.
  • txt: Specifies that we are looking for a text record rather than a standard domain mapping (A record).
  • ch: Stands for Chaosnet. While 99% of the web uses the IN (Internet) class, historical network classes like Chaosnet are still used for local server diagnostics.
  • whoami.cloudflare: Cloudflare specifically programmed their servers so that if you ask for the "whoami" record, it reflects your own public IP right back to you.
  • @1.1.1.1: Forces the query directly to Cloudflare's public DNS resolver, bypassing your local router or ISP.

Bringing the Trick to Windows (.bat)

Windows doesn't include dig out of the box, but it does include nslookup, which can achieve the exact same result.

If you want a portable script you can drop onto any Windows machine, here is the complete translation formatted as a standard Windows Batch (.bat) file:

@echo off
REM Check which is your external IP using native Windows tools.

REM Windows native alternative to curl (if needed):
REM powershell -Command "(Invoke-WebRequest ifconfig.me).Content"

REM Using nslookup (Windows native fastest alternative to dig, no HTTP)
REM -query=txt: Requests the raw text record where Cloudflare stores the IP.
REM -class=chaos: Uses the Chaosnet class for diagnostic routing.
REM whoami.cloudflare: The zone designed to reflect your IP back.
REM 1.1.1.1: Forces the query directly to Cloudflare's DNS server.

nslookup -query=txt -class=chaos whoami.cloudflare 1.1.1.1

Wrap Up

The next time you are scripting an automation workflow or debugging a network from the CLI, swap out your curl requests for a DNS lookup. It's lighter on resources, blazing fast, and works even if standard web traffic (ports 80 or 443) is being throttled or blocked on your network.

Thursday, January 8, 2026

Wednesday, December 31, 2025

How to Stop MySQL from Auto-Updating on Ubuntu Server 22.04 (and Verify It Won’t Happen)

If you run MySQL on Ubuntu Server 22.04, you already know the problem:
Ubuntu is very helpful about updates — sometimes too helpful.

An unattended MySQL upgrade can:

  • Restart the service

  • Break replication

  • Introduce subtle behavior changes

  • Ruin a carefully controlled production setup

This post shows how to stop MySQL from auto-updating and how to prove in advance that no update will sneak in.

No hand-waving. Real commands. Verifiable results.


The Real Culprit: Unattended Upgrades

Ubuntu uses a background service called unattended-upgrades to silently install updates. That includes MySQL unless you explicitly stop it.

You have three levels of control. Most servers should use Level 1 or 2.


Option 1 — Freeze MySQL with apt-mark hold (Recommended)

This is the simplest and safest approach.

sudo apt-mark hold mysql-server mysql-client mysql-common

What this does:

  • APT will refuse to upgrade these packages

  • Even if someone runs apt upgrade

  • Even if unattended-upgrades runs overnight

Verify the hold:

apt-mark showhold

Expected output:

mysql-server mysql-client mysql-common

To undo later:

sudo apt-mark unhold mysql-server mysql-client mysql-common

Option 2 — Let Ubuntu Update Everything Except MySQL

If you want security updates for the OS but not for MySQL, blacklist it from unattended upgrades.

Edit the config:

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

Find:

Unattended-Upgrade::Package-Blacklist { };

Add:

Unattended-Upgrade::Package-Blacklist { "mysql-server"; "mysql-client"; "mysql-common"; };

Restart the service:

sudo systemctl restart unattended-upgrades

This keeps the system secure while freezing MySQL.


Option 3 — Disable Automatic Updates Entirely (Use With Caution)

This is a blunt instrument.

sudo systemctl disable --now unattended-upgrades

Or:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades

Set:

APT::Periodic::Unattended-Upgrade "0";

Only do this if you commit to manual patching.


How to Verify Beforehand That MySQL Will NOT Update

This is the part most guides skip. Don’t trust configuration — verify behavior.


1. Check What APT Thinks Is Upgradable

apt list --upgradable | grep -i mysql

Correct result: no output
If you see MySQL packages here, they are not frozen.


2. Simulate a Full Upgrade (Dry Run)

sudo apt -s upgrade | grep -i mysql

The -s flag means simulate only.
Nothing will be installed.

Correct result: no MySQL packages listed.


3. Simulate Unattended Upgrades Directly

This tests the exact logic Ubuntu uses overnight.

sudo unattended-upgrades --dry-run --debug | grep -i mysql

If MySQL is held or blacklisted, it will be skipped.


4. Double-Check Package Holds

apt-mark showhold

If MySQL isn’t listed, it’s not protected.


5. (Optional) Verify Pinning Rules

If you’re using apt pinning:

apt-cache policy mysql-server

You should see a pin priority preventing upgrades.


The “I’m Safe” Checklist

Run these three commands:

apt list --upgradable | grep -i mysql apt -s upgrade | grep -i mysql unattended-upgrades --dry-run --debug | grep -i mysql

If all three return empty, MySQL will not update. Period.


Final Advice

  • Production server? Use apt-mark hold

  • Security-conscious server? Use unattended-upgrade blacklist

  • Never rely on assumptions — always simulate

Ubuntu does exactly what you tell it to do.
The problem is most admins never tell it not to touch MySQL.

My Year with ChatGPT













 

See here: https://chatgpt.com/share/695563c9-a894-800c-ab7e-7ee18881a635 

Another year of walking

I failed again reaching my 1800 miles goal, 150 miles monthly. August was my weakest month.

Let's see on 2026. 

 

SQL Queries

I have written so many SQL queries during my life as a software developer that I lost count.

SQL-Queries is a GitHub repository that I'm going to use for publishing those queries.

This is a work in progress.

 

Java code to create a .XLSX Excel file from a PDF file

I uploaded some Java code that I wrote earlier this year that creates a .XLSX Excel file from PDF file.

GitHub code: https://github.com/64board/account_summary_u