<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>trivia &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/trivia/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Mon, 14 Jul 2025 04:19:12 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>trivia &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Get the location of the ISS using DNS]]></title>
		<link>https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/</link>
					<comments>https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 06 Jul 2025 11:34:33 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[trivia]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=61693</guid>

					<description><![CDATA[I love DNS esoterica. Weird little things that you can shove in the global directory to be distributed around the world instantly(ish).  Domain names, like www.example.com usually resolve to servers. As much as we think of &#34;the cloud&#34; as being some intangible morass of ethereal Turing-machines floating in probability space, the more prosaic reality is that they&#039;re just boxen in data centres. They …]]></description>
										<content:encoded><![CDATA[<p>I love DNS esoterica. Weird little things that you can shove in the global directory to be distributed around the world instantly(ish).</p>

<p>Domain names, like <code>www.example.com</code> usually resolve to servers. As much as we think of "the cloud" as being some intangible morass of ethereal Turing-machines floating in probability space, the more prosaic reality is that they're just boxen in data centres. They have a physical location.</p>

<p>Got a tricky machine which is playing silly-buggers? Wouldn't it be nice to know exactly where it is? That way you can visit and give it some <a href="https://tvtropes.org/pmwiki/pmwiki.php/Main/PercussiveMaintenance">percussive maintenance</a>.</p>

<p>Enter the DNS LOC record!</p>

<p>The snappily titled <a href="https://www.rfc-editor.org/rfc/rfc1876.html">RFC 1876</a> is an <em>experimental</em> standard. It allows you to create a DNS record which specifies the latitude and longitude of your server. Of course, some data-centres are very tall and some are underground. So it also contains an altitude parameter.</p>

<p>The standard allows for a minimum altitude of -100,000 metres - deep enough for any bunker! The maximum altitude is 42,849,672 metres which is high enough to allow it to be used on <a href="https://www.esa.int/Enabling_Support/Space_Transportation/Types_of_orbits#GEO">satellites in geostationary orbit</a>.</p>

<p>So, as a bit of fun, I decided to create <code>where-is-the-iss.dedyn.io</code></p>

<p>It isn't a website. You can't ping it. There's no way to interact with it <em>except</em> by using DNS.  Yup! You can use a DNS query to get the (approximate) location of the International Space Station!</p>

<p>Linux and Mac users<sup id="fnref:win"><a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fn:win" class="footnote-ref" title="I don't think there's a way for Windows users to look up LOC records using PowerShell or the Command Prompt." role="doc-noteref">0</a></sup> can run:</p>

<p><code>dig where-is-the-iss.dedyn.io LOC</code></p>

<p>And receive back the latest position of the ISS:</p>

<pre><code class="language-_">;; ANSWER SECTION:
where-is-the-iss.dedyn.io. 1066 IN  LOC 47 24 53.500 N 66 12 12.070 W 430520m 10000m 10000m 10000m
</code></pre>

<p>The DNS records are updated every 15 minutes on a best-effort basis<sup id="fnref:nasa"><a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fn:nasa" class="footnote-ref" title="Look, I'm not NASA, OK? If you're using this to help you dock then I cannot be held responsible." role="doc-noteref">1</a></sup>.</p>

<h2 id="how"><a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#how">How</a></h2>

<p>The lovely people at <a href="https://www.n2yo.com">N2YO</a> have a website which allows you to track <em>loads</em> of objects in orbit.  They also have an <a href="https://www.n2yo.com/api/">easy to use API</a> with a generous free tier.</p>

<p>Calling <code>https://api.n2yo.com/rest/v1/satellite/positions/25544/0/0/0/1/&amp;apiKey=_____</code> gets back the latest position:</p>

<pre><code class="language-json">{
    "info": {
        "satname": "SPACE STATION",
        "satid": 25544,
        "transactionscount": 7
    },
    "positions": [
        {
            "satlatitude": -21.25409321,
            "satlongitude": 140.3335763,
            "sataltitude": 420.09,
            "azimuth": 292.92,
            "elevation": -70.95,
            "ra": 202.69300845,
            "dec": -32.16097472,
            "timestamp": 1751366048,
            "eclipsed": true
        }
    ]
}
</code></pre>

<p>Note that the altitude is in Km, whereas the LOC format requires m.</p>

<p>The latitude and longitude are in decimal format - they need to be converted to Degrees, Minutes, and Seconds.</p>

<p>There were only a few free domain name providers who offer an API for updating LOC records.  I went for <a href="https://desec.io/">deSEC</a> a charity from Berlin. They have <a href="https://desec.readthedocs.io/en/latest/">comprehensive API documentation</a>.</p>

<p>Adding the initial LOC record is done with:</p>

<pre><code class="language-bash">curl https://desec.io/api/v1/domains/where-is-the-iss.dedyn.io/rrsets/ \
    --header "Authorization: Token _______" \
    --header "Content-Type: application/json" --data @- &lt;&lt;&lt; \
    '{"type": "LOC", "records": ["40 16 25.712 S 29 32 36.243 W 427550m 0.00m 10000m 10m"], "ttl": 900}'
</code></pre>

<p>However, updating the record is a little trickier. it needs to be sent as an <a href="https://desec.readthedocs.io/en/latest/dns/rrsets.html#modifying-an-rrset">HTTP PATCH</a> to a subtly different URl. The PATCH only needs to send the data which have changed.</p>

<pre><code class="language-bash">curl -X PATCH https://desec.io/api/v1/domains/where-is-the-iss.dedyn.io/rrsets/@/LOC/ \
    --header "Authorization: Token _______" \
    --header "Content-Type: application/json" --data @- &lt;&lt;&lt; \
    '{"records": ["40 16 25.712 S 29 32 36.243 W 427550m 0.00m 10000m 10m"]}'
</code></pre>

<p>I set the <a href="https://ttl-calc.com/">Time To Live</a> at 900 seconds. Every 15 minutes my code runs to update the record<sup id="fnref:api"><a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fn:api" class="footnote-ref" title="I suppose you could build an API with unlimited request limits by distributing data via DNS TXT records. Would best suit static or infrequently updating data. Push it once to DNS and let everyone…" role="doc-noteref">2</a></sup>. That keeps me well within the API limits for both services.  I could add TXT records showing when it was last updated, or other sorts of unstructured data, but I think this is enough for a quick proof-of-concept.</p>

<p>There you have it! A complex and silly way to demonstrate how DNS can be used to hold the most unlikely of records<sup id="fnref:naptr"><a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fn:naptr" class="footnote-ref" title="See if you can find the other interesting record I've added to DNS!" role="doc-noteref">3</a></sup>.  Say, I wonder how you'd represent the co-ordinates of the Mars Rover…?</p>

<h2 id="further-reading"><a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#further-reading">Further Reading</a></h2>

<p>For more DNS weirdness, please see my other posts:</p>

<ul>
<li><a href="https://shkspr.mobi/blog/2022/08/dns-esoterica-bimi-svg-in-dns-txt-wtf/">BIMI - SVG in DNS TXT WTF?!</a></li>
<li><a href="https://shkspr.mobi/blog/2022/07/dns-esoterica-why-you-cant-dig-switzerland/">Why you can't dig Switzerland</a></li>
</ul>

<div id="footnotes" role="doc-endnotes">
<hr aria-label="Footnotes">
<ol start="0">

<li id="fn:win">
<p>I don't think there's a way for Windows users to look up LOC records using PowerShell or the Command Prompt.&nbsp;<a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fnref:win" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:nasa">
<p>Look, I'm not NASA, OK? If you're using this to help you dock then I cannot be held responsible.&nbsp;<a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fnref:nasa" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:api">
<p>I suppose you could build an API with unlimited request limits by distributing data via DNS TXT records. Would best suit static or infrequently updating data. Push it once to DNS and let everyone query it semi-locally.&nbsp;<a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fnref:api" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:naptr">
<p>See if you can find the other interesting record I've added to DNS!&nbsp;<a href="https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/#fnref:naptr" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

</ol>
</div>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=61693&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2025/07/get-the-location-of-the-iss-using-dns/feed/</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[DNS Esoterica - Why you can't dig Switzerland]]></title>
		<link>https://shkspr.mobi/blog/2022/07/dns-esoterica-why-you-cant-dig-switzerland/</link>
					<comments>https://shkspr.mobi/blog/2022/07/dns-esoterica-why-you-cant-dig-switzerland/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 14 Jul 2022 11:34:18 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[trivia]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=43028</guid>

					<description><![CDATA[As part of my new job, I&#039;m learning a lot more about the mysteries of the Domain Name System than any mortal should know I thought possible.  The humble unix dig command allows you to query all sort of DNS information. For example, to see name server records for the BBC website, you can run:  dig bbc.co.uk NS  Which will get you:  ;; Got answer: ;; -&#62;&#62;HEADER&#60;&#60;- opcode: QUERY, status: NOERROR, id: …]]></description>
										<content:encoded><![CDATA[<p>As part of my new job, I'm learning a lot more about the mysteries of the Domain Name System than <del>any mortal should know</del> I thought possible.</p>

<p>The humble unix <code>dig</code> command allows you to query all sort of DNS information. For example, to see name server records for the BBC website, you can run:</p>

<p><code>dig bbc.co.uk NS</code></p>

<p>Which will get you:</p>

<pre><code class="language-_">;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 35614
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 17

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 097db2ee4c92b84982083ecf62b5b5f2007906e616035113 (good)
;; QUESTION SECTION:
;bbc.co.uk.         IN  NS

;; ANSWER SECTION:
bbc.co.uk.      900 IN  NS  ddns1.bbc.com.
bbc.co.uk.      900 IN  NS  dns0.bbc.co.uk.
bbc.co.uk.      900 IN  NS  ddns1.bbc.co.uk.
...
</code></pre>

<p>And a whole lot more.  But you can go further down the DNS tree. What are the nameservers for <code>.co.uk</code>?</p>

<p><code>dig co.uk NS</code></p>

<p>And you'll get your answer.  You can go one further and see the nameservers for the Top Level Domain:</p>

<p><code>dig uk NS</code></p>

<p>Which replies with:</p>

<pre><code class="language-_">;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 54061
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 17

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 880427eda8ff71de2ab4f43862b5b65f95e317d29cc10a8e (good)
;; QUESTION SECTION:
;uk.                IN  NS

;; ANSWER SECTION:
uk.         159692  IN  NS  nsc.nic.uk.
uk.         159692  IN  NS  dns1.nic.uk.
uk.         159692  IN  NS  nsd.nic.uk.
...
</code></pre>

<p>And that works with <em>every</em> TLD. Countries like <code>de</code>, generic names like <code>museum</code>, and internationalised domains like <code>在线</code>. All of them work!</p>

<p>Except Switzerland.</p>

<p>Switzerland's country code is <code>ch</code> - after the name <i lang="la">Confoederatio Helvetica</i>. Let's run the <code>dig</code> on it: <code>dig ch NS</code></p>

<pre><code class="language-_">;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: REFUSED, id: 31910
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
</code></pre>

<p>We have been <strong>refused</strong> and <strong>warned</strong>.  But why does this only happen with Switzerland?</p>

<p>The blame - as with most modern ills - lies in the mid-1970s. The Bee Gees were storming the charts with "Jive Talkin'", the Rocky Horror Picture Show was gathering a cult following, and MIT scientists were causing chaos.  Literally.</p>

<p><a href="https://en.wikipedia.org/wiki/Chaosnet">Chaosnet</a> was an early network protocol designed for local networks.  It was technically very clever but, sadly, never really took off.</p>

<p>However, it found its way into DNS records. Let's go back to the answer to <code>dig bbc.co.uk NS</code>:</p>

<pre><code class="language-_">;; ANSWER SECTION:
bbc.co.uk.      900 IN  NS  ddns1.bbc.com.
</code></pre>

<p>OK, the first part is the domain name. The number is the TTL. The <code>IN</code> is the class. The NS says this is a nameserver record. And, finally, we get the domain of the nameserver.</p>

<p>But, in the class, what does <code>IN</code> stand for?</p>

<p>"<strong>Internet</strong>", obviously. Wait... Isn't the DNS on the Internet? Why do we need to specify that these DNS records are for Internet?</p>

<p>Well, isn't it obvious? Because you might want records of a <em>different</em> network. Like, for example, Chaosnet.</p>

<p>And if Internet is abbreviated to <code>IN</code>, what is Chaosnet shortened to? That's right! <code>CH</code>.</p>

<p>So, <code>dig</code> sees you enter <code>ch</code> for Switzerland, but thinks you're asking about <code>CH</code> for Chaosnet. And so it fails.</p>

<p>In order to query the records for <code>ch</code> we need to provide an absolutely fully-qualified domain name. It's as simple as sticking a dot at the end of the domain name:</p>

<p><code>dig ch. NS</code></p>

<pre><code class="language-_">;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 64932
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 11

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: e19b9c23cdfa0f7bcf82750462b5c16b47744386c7974ffb (good)
;; QUESTION SECTION:
;ch.                IN  NS

;; ANSWER SECTION:
ch.         164894  IN  NS  e.nic.ch.
ch.         164894  IN  NS  a.nic.ch.
ch.         164894  IN  NS  f.nic.ch.
</code></pre>

<p>And there we go. A failed 1970s experiment like bell-bottoms and Betamax videos - but with much longer lasting consequences.</p>

<p>You can see some <code>CH</code> records by running like:</p>

<p><code>dig ch txt @f.root-servers.net version.bind</code></p>

<p>That will get you something like:</p>

<pre><code class="language-_">;; ANSWER SECTION:
version.bind.       86400   CH  TXT "cloudflare-f-root-20190930"
</code></pre>

<p>Of course, DNS doesn't <em>only</em> have <code>IN</code> and <code>CH</code> class records.</p>

<p>There's also <a href="https://en.wikipedia.org/wiki/Hesiod_(name_service)">Hesiod</a> - <code>HS</code>. But you already knew that, right...?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=43028&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2022/07/dns-esoterica-why-you-cant-dig-switzerland/feed/</wfw:commentRss>
			<slash:comments>23</slash:comments>
		
		
			</item>
	</channel>
</rss>
