惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
IT之家
IT之家
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
H
Help Net Security
V
V2EX
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
博客园 - 叶小钗
J
Java Code Geeks
博客园 - 【当耐特】
月光博客
月光博客
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件

Dallas Lu

一些没有意义的事情 博客程序的一次大重构 OpenWRT 使用 udp2raw 对抗 WireGuard 阻断 如何证明你是原创作者 Nginx 泛域名配置的隐患与对策 WISeID S/MIME 证书 V2EX 刑满释放记 使用 Radicale 在 Ubuntu 24.04 中搭建 vCards CardDav 服务 邮件服务的域名成功从 SURBL 黑名单移除 The Domain of Mail successfully removed from SURBL blacklist 网站多语言的设计细节 Website Multilingual Design Details 网站评论系统的目前进展和展望 Current Progress and Outlook of the Website Comment System 在公网使用 iptables 转发端口时保留客户端 IP Retaining Client IP with iptables Port Forwarding on Public Networks 邮件投递平台 Postal 的使用经验 Experience with Using Postal, the Mail Delivery Platform 自建 Postal 完美替代 SendGrid Build Your Own SendGrid: Postal SMTP Server 互联网在崩塌吗,然后呢 Is the Internet collapsing and then what 在 SvelteKit 应用中使用 JSON-LD Using JSON-LD in SvelteKit Applications 网页的打印样式应该怎么写 How to write print styles for web pages “茴字的四种写法”之 IP 与域名 怎么伪造 Git 提交的时区 How to fake the timezone of a git commit 供大众交流的论坛和其它替代产品还是不好用
Trivia: Special ways of writing IP and domain names
Dallas Lu · 2024-04-14 · via Dallas Lu

X user plantegg, while testing MySQL connection issues, used IP 127.1, which piqued the interest of some netizens. When I first learned of this, I also doubted the legitimacy of my computer networking course. Thus, I’ve compiled some obscure knowledge akin to the “four ways to write the character ‘hui’.” Dear readers, remember! These facts are worth remembering. They’ll come in handy when you work as a network administrator and need to write rules. (Earnest face)

IPv4

While studying IPv6, everyone knows that consecutive zeros can be omitted, represented as ::. This abbreviation applies to IPv4 as well.

Abbreviations in IPv4

As plantegg mentioned11, 127.1 represents 127.0.0.1 by simply omitting the intermediate zero values.

The common IP format 127.0.0.1 uses dotted decimal notation, where four octets are separated by dots .. However, you could also write it in hexadecimal as 0x7f000001, in decimal as 2130706433, or in octal as 017700000001, all of which represent 127.0.0.1.

Dotted decimal notation does not necessarily require four parts; the first octet can be separated alone, for example, 1.65793 corresponds to 1.1.1.1. Each part does not need to be in the same base, for example, its octal equivalent is 1.0200401. Similarly, 127.0.0.1 can be written as 0x7f.01.

From this, it should be clear that IPv4 can only omit zero-value octets, e.g., 127.1.1.1 can be written as 127.65793, and by the same token, 127.0.0.1 can be abbreviated as 127.1.

IPv4 essentially is a 32-bit integer, and these alternative notations are automatically converted to integer values at the network layer. Typically, when outputting, they are formatted into the standard four octet format.

The Shortest IPv4 Address

Cloudflare has a DNS/Warp service IP 1.1.1.1 which is quite cool2. In fact, its alternate IP 1.0.0.1 is cooler, as it can be simply written as 1.1, making it the coolest Class A IPv4 address available at the beginning of its range.

In non-monospaced fonts, 1 is generally narrower than other characters, so 1.1 might be the shortest printed public IPv4 address.

Domain Names

In popular understanding, there’s often a difference in perception of terms and rules compared to professional fields.

Omitted Dot at the End

For example, the definition of second-level domains and top-level domains. Popularly, a top-level domain refers to domains like dallas.lu that require registration, while second-level domains are its subdomains like cdn.dallas.lu. However, .lu is the actual top-level domain. Above top-level domains is the root domain, represented as .. Thus, dallas.lu. constitutes a complete domain name. In everyday use, the top-level domain suffix .lu is sufficient to distinguish it from hostnames/local domains, making the last . optional.

If you’ve owned a domain and set up CNAME or NS records, you might have encountered the necessity to add a . at the end. Nowadays, providers like Cloudflare allow domain names to be specified without being fully absolute. Many people have gradually forgotten this, so adding a . at the end can have unexpected effects. For instance, AliCloud prohibits unregistered at MII domains from providing web access, but it didn’t account for domains ending with ., allowing them to be accessed normally. I’ve used this method for many years until it stopped working about three years ago.

Interestingly, different websites handle the last .in domain names differently. For example, http://tesla.com. and http://google.com. redirect to their respective non-dot-ending URLs; http://microsoft.com. leads to a 404 page; http://x.com. and http://amazon.com. show a blank page; http://baidu.com. results in a reset connection; http://openai.com. is accessible normally.

The Shortest URL

Top-level domains are not directly accessible because they consist of at least two letters, causing conflict with the format of hostnames/local domains. However, adding a . after them allows for domain name resolution.

Thus, one of the shortest URLs is http://to., which currently redirects to www.to.. Another is http://ai., which is accessible normally.

Similar Domain Names

IDN domains can use a broader range of characters. Many of these characters look very similar to Latin letters, and if the browser does not encode them for display, it can be difficult for users to distinguish them visually. For example, try visiting https://раураӏ.com/, and you’ll find it’s not the real PayPal—the аis not the standard lowercase letter a. The topic of legitimate versus deceptive domain names goes beyond the scope of this article and will not be discussed in detail here.

Conclusion

Did you learn something? (Sigh + pity face)


  1. plantegg. https://x.com/plantegg/status/1773162126254952769. X. 2024-03-27. ↩

  2. Ólafur Guðmundsson. Introducing DNS Resolver, 1.1.1.1 (not a joke). The Cloudflare Blog. 2018-04-01. ↩