Running Anycast DNS with Docker in DN42

2020-03-16 Notes There is an updated scheme compared to this post, see Sharing Network Namespace Among Docker Containers for Bird Anycasting . It is suggested to read only the concept explanations in this post, and use the above scheme instead for deployment. What's Anycast The commonly used routing protocol on Internet, the BGP, works like this: I own an IP range, 172.22.76.104/29, on DN42. With a BGP software like BIRD, I "announce" that my server has access to IP range 172.22.76.104/29. Servers with peering to me will record this message: "Over this path, I can access 172.22.76.104/29 which is 1 step away." These servers continue to announce to others with peering to them: "This server is 1 step away from the source of 172.22.76.104/29." Similarly,...

Illustration for Bird-lg in Go (Bird Looking Glass)

Bird-lg in Go (Bird Looking Glass)

What's BIRD? And What's Bird-lg? BIRD is a popular BGP routing software used on Linux. I mainly use Bird in the DN42 network , to establish connections with other users. Bird-lg is a Python 2 based program developed by GitHub user sileht. It provides a web interface to show the status of BIRD routing software on each server, as well as query routes to specified IPs. Why Rewrite in Go? Bird-lg is based on Python 2 and Flask and takes more memory (20-30MB). Bird-lgproxy also takes around 20MB and is required on every server. On the 512MB VPS where this site is hosted, there had been multiple cases where memory ran out, and the on-disk SWAP was too slow. In this case, Docker, Nginx, MySQL, PHP would crash one after one, and a reboot would be necessary....

Illustration for Writing Stories in Traceroute

Writing Stories in Traceroute

2020-10-11 Update Now a better way exists that doesn't involve a bunch of Docker containers. Please refer to Writing Stories in Traceroute, Elegantly . Intro Traceroute is one of the popular tools for network inspection. It shows the IP addresses of routers on the route from your computer to a destination server, similar to: Domains are shown on the last 2 hops, which is the IP's reverse DNS record. Reverse DNS records exist as PTR records in the format of 4.3.2.1.in-addr.arpa . For more information, you may refer to Setting IP Reverse Records in DN42 (Chinese Only) . However, PTR records need not be real domains. They can be any string that "looks like" a domain. With this, we can write one sentence on each hop of a Traceroute path to make a story: This story is set up in DN42....

Illustration for Registering Domain in DN42

Registering Domain in DN42

DN42, aka Decentralized Network 42, is a large VPN network. Unlike traditional VPNs, DN42 uses a lot of technology involved in Internet backbones (such as BGP) and is a great simulation of a realistic network environment. In a previous post (Chinese only) , I joined DN42 and connected most of my VPSes to it. (The ones left are OpenVZ VPSes without Tun/Tap support.) I knew from the beginning that DN42 has its own domain name system. For example, DN42's wiki ( https://wiki.dn42.us/Home ) can be accessed as https://internal.dn42 in DN42. I didn't register a domain back then since I didn't have time, and I didn't have much knowledge of DN42. I finished the registration this month and would like to share my experience....

RoboMaster Development Log (Updated 2018-05-28)

Our school organized a RoboMaster team and planned to attend the competition this year. Since we are all new students at a new campus, we do not have any reference materials available from previous students, and we have to figure out bugs after bugs on our own. This post describes some of the problems we met during software development. Hardware: RoboMaster Official Development Board MCU Model: STM32F427IIHx Software: ChibiOS 18.2.0 Board Has 12 MHz HSE Clock Instead of Commonly Seen 8MHz The pitfall is that neither the manual nor the hardware schematics mentioned the clock frequency. Due to this problem, the actual frequency we programmatically set with STM32CubeMX or other software is much higher than expected. This caused the following problems:...

Support WebP on IE and Firefox

I wrote a PHP snippet to fetch high-resolution images from the website of the Himawari 8 satellite and combine them into one high-resolution image. The way to fetch satellite images is available here . However... The combined 4d resolution PNG image (2200x2200) is over 7 MB in size, and due to the bad connectivity between China and the US, it takes over a minute to load the image (from my server). Way too slow! Google provided a solution: the WebP image format. WebP is famous for its high compression ratio on lossless compression scenarios. After converting the 7 MB earth photo PNG file to WebP, the resulting file size is less than 700 KB. For a photo with resolution 2200x2200, this is pretty small. But... Some browsers, including IE and Firefox, don't support WebP,...

Illustration for Show Earth Satellite Images with PHP and Javascript

Show Earth Satellite Images with PHP and Javascript

The Himawari 8 weather satellite is one of the Himawari satellites made by JAXA, weighs around 3500kg and has an expected lifespan of over 15 years. The satellite was successfully launched on October 7, 2014 with the H2A rocket and is mainly used to monitor storm clouds, tsunamis, and active volcanos. After launch, in addition to preventing natural disasters, Japan also released photos taken by the satellite on the Internet, which can be downloaded by enthusiasts. The photo is released on the official website at http://himawari8.nict.go.jp/ m and is updated every 10th minute (like 9:30, 9:40...), with a 30-minute delay (the photo you see at 10:00 is taken at 9:30). Next, we're going to investigate how to obtain these pictures. With the network monitor functionality of the browser,...