This is YDJSIR’s first attempt in the field of embedded devices, and obviously it will not be the last.

If you just want a router that supports CERNET’s IPv6, why not just buy a new router from Xiaomi/Huawei/TP-Link, set the IPv6 mode to Bridge mode and then enjoy the native education network’s IPv6 address happily? If you have no budget for a new one, just buy Netgear router and set the IPv6 mode into penetration.

(ASUS’s firmware may not work)

Introduction

The Tragedy of not Buying Qualified Products

At first, YDJSIR spent ¥45 to buy an unbranded ancient server with dual Gigabit network interface…(Can you believe that it has a Pentium 5200?) However, YDJSIR soon realized that the noise of it could make YDJSIR’s roommate crazy.

Later, YDJSIR saw a ZTE CT320 mini-station on Xianyu, which owns a D2550 CPU (wow! 2C4T@1.86Ghz), DDR3 dual-channel 4GB memory, 1080p output (HDMI, DVI-24 which supports physical VGA converter), dual USB 3.0 socket, dual Gigabit LAN interface! Handsome and professional like appearance! At the price of ¥160, YDJSIR got excited and bought it.

Unfortunately, YDJSIR found that the machine was a huge pit. Because of the stupid graphics card in this machine (there may be no 64-bit driver for D2550’s integrated graphic card and the BIOS may probably locks 64-bit functions), it is impossible to install a 64-bit system on the machine. Additionally, the performance of the device is quite low and even unable to handle a 480p video on Bilibili. Worse still, its BIOS makes YDJSIR crazy. YDJSIR tried its best to make it recognize the bootable USB flash drive, however YDJSIR failed even after YDJSIR enables “Boot from USB” and disable all security boot options. There is a SATA port in this machine, but the power supply cable is specially customized, and the strange 2.5-inch disk cannot be plugged when using ordinary cable… YDJSIR searched every where for this kind of cable but all YDJSIR’s effort was in vain.

YDJSIR finally knows why it was so cheap.

You get what you pay for when selecting these devices.

So Finally, YDJSIR had to burn a x86 OpenWRT image with nearly all popular plugins into it and use it as a rooter and NAS(via external USB3.0 portable HDD).

Afterwards, thanks to a dalao, YDJSIR got a Seagate 1TB Portable HDD and connect it to my ZTE CT320 which operated under 32-bit Windows 7. YDJSIR let my mini-station focus on PT NAS, and found that it is quite suitable for this kind of application.

These pictures below may be vague.
image-20201112193020120
image-20201112193252709
image-20201112193434694

Main Body

After lots of research in advance together with the help of a classmate of YDJSIR( GitHub:hexclover ), YDJSIR decided to start my new trial from a Newifi 3 D2 router.

These pictures below may be vague.
image-20201112193640499

Here comes YDJSIR’s collection of reference pages about how to deploy IPv6 in CERNET.

Reference

OpenWRT IPv6 三种配置方式 | Kompass

进阶类教程:多种无PD的情况下给内网配置IPv6的方法

Solution 1: NAT

Reference

WAN口获取单一IPv6地址时,内网使用IPv6的方法(教育网可用) - 华硕固件 - KoolShare - 源于玩家 服务玩家

Initially, the page mention above is not based on OpenWRT. Secondly, you must ensure that the router can get a IPv6 address from its wan interface. However, YDJSIR tried various firmware, none of them are able to get IPv6 in YDJSIR’s dormitory.

Who can tell YDJSIR why the IPv6 system of CERNET is so strange?

(SLAAC mode rather than DHCPv6)

There is no fundament for this solution, so YDJSIR gives it up directly.

Screenshot
image-20201112194648360 image-20201112194734532

YDJSIR recommends Merlin or Padavan users to try this solution.

Reference

老毛子 Padavan 路由器固件开启教育网 IPv6 并实现IPv6转发 - rebeca8 - 博客园

Solution 2: Relay

YDJSIR found that it didn’t work, even in official firmware provided in OpenWRT’s official website.

Reference

OpenWRT IPv6 三种配置方式 | Kompass

Solution 3: Penetrate

Reference

教育网DD-WRT/OpenWrt用上IPv6——以南京大学为例 - Penguin

In fact, this tutorial is also YDJSIR’s classmate’s solution , and it is also the only way YDJSIR gain temporary success. He used the OpenWRT firmware compiled by himself (based on the 18.06 stable version). However, it is a pity that he did not save the configuration that was used for compiling, nor did he save the firmware at that time.

YDJSIR certainly knows that deploying other plugins is much more complicated than deploying the IPv6 related settings in this tutorial. Therefore, YDJSIR initially chose to adapt such a solution for a third party firmware with several plugins.

Then YDJSIR found that in OpenWRT, kmod-ebtables is not a package that is included by default during compilation. What’s worse, this kernel-related package is not that easy to install! You must ensure that the kernel version is exactly the same! (It is accurate to which push on GitHub). This means that most of the integrated firmware found by YDJSIR cannot be used directly! This means that YDJSIR needs to compile the firmware by himself.

You can only get this module for stable versions of OpenWRT.
image-20201112194840654
image-20201112194852880

YDJSIR first tested the 19.07 STABLE version of the official firmware provided by OpenWRT, which can successfully download and install the ebtables family bucket through opkg. YDJSIR deployed IPv6 on it successfully according to the above tutorial! Both IPv4 and IPv6 in the dormitory can reach the gigabit level! (900+Mbps)

Then YDJSIR found that a complete Linux environment is needed for compiling OpenWRT firmware. Both the Lienol and Lean source code repositories used by YDJSIR recommend Ubuntu 18.04 LTS x86_64. YDJSIR first switched to the school’s KMS to change the activation type to the educational version and tried WSL1, but found that various compilation dependencies could not be installed. So YDJSIR updated the system to 2004, upgraded WSL to WSL2, and found that all kinds of dependencies still failed . (All are the default configuration, using the Ubuntu 20.04 LTS obtained from the Windows Store. After testing by zty classmates, the Ubuntu 20.04 LTS installed on the physical machine can be compiled successfully).

YDJSIR considers that YDJSIR may had to reinstall the Ubuntu in WSL2.

There are many successful example of using WSL2 to compile OpenWRT.

YDJSIR finally reluctantly used Hyper-V to simulate a complete Ubuntu based on its newly purchased 32G memory stick based on its XPS 15 7590 (i5-9300H+1650).

Compiling firmware…
image-20201112195102740
image-20201112195208685

HyperV is so NICE!

OK, now YDJSIR can compile OpenWRT firmware. What is helpless is that YDJSIR was tortured by the configuration file n times during the compilation process. YDJSIR didn’t dare to start threads, but only dared to compile in a single thread, and it would take 3 hours to compile for one time… YDJSIR thought that I might encounter more weird bugs with this thing in the future, so…YDJSIR finally chose to let others compile and bring plug-ins and kmod-ebtables.

However, YDJSIR soon discovered that the file size directly compiled was much larger than the firmware specially optimized by the third party and get unable to be burnt into YDJSIR’s router…

Worse still, even after YDJSIR get firmware that at a appropriate size, YDJSIR found that the strange firmware with the plugins will lead to severe problem after the following instruction is executed.

1
brctl addif br0 vlan2

YDJSIR was frustrated to find that the transmission speed of both IPv4 and IPv6 packets will rapidly increase from 0 to 100Mbps and then quickly drop to 1-2Mbps, and the time cost of DNS resolution has also increased significantly. In sharp contrast, the original system after all the settings can run at Gigabit.

What is even more bizarre is that the router load is not heavy (as is shown below). So what is the cause?

Pic 1 is the abnormal result while Pic 2 shows the normal situation
image-20201112194452700
image-20201112194318125

Cheers for NJU’s full gigabit network access!

NJU will provide Wifi 6 access in all dormitories before December, 2020

As YDJSIR has installed too many plugins and make it quite complex to locate the conflict and YDJSIR’s roommates had got unsatisfied with the Wifi which frequently stopped, YDJSIR decided to delay YDJSIR’s trial after Wifi 6 is deployed.

Conclusions

YDJSIR’s ideal career is not embedded engineers. However, since YDJSIR focuses on the back-end technologies, obviously YDJSIR must be familiar with all network-related equipment. OpenWRT provided YDJSIR an opportunity to know more about network technologies. More importantly, its open source features and powerful community resources give YDJSIR nearly unlimited space for exploration.

At the same time, YDJSIR was also shocked by GitHub:MrChenWithCapsule ‘s network system which is based on Hyper-V and forces all traffic of the physical machine system and other virtual machines to flow through an OpenWRT network system which supports IPv6 . To reach this level, YDJSIR still has a long way to go.

To be continued

Obviously, YDJSIR will never choose those SNAPHOT versions in the future. YDJSIR will definitely choose STABLE versions to ensure that YDJSIR can install kmods with opkg when any weird kmod module is missing.

In fact. The ebtables package seems to have not been updated in OpenWRT for a long time…

However, opkg will never let you install packages with the wrong kernel version.

YDJSIR does not have any special requirements for new functions, YDJSIR just needs to be able to use it. Therefore, YDJSIR will choose the release version without hesitation.

YDJSIR has two solution in plan up to now.

Solution 1: Directly Modify the Compilation Configuration to Directly Compile the Required Firmware

Solution 2: Starting from the Official Firmware, Rely on opkg to Add Plugins One by One

YDJSIR is convinced that this is a more stable solution. At least YDJSIR can control variables more quickly for quick trial…

Well, YDJSIR should first enjoy this powerful and low-cost excellent router!

Consider that you are able get a Gigabit dual-band router which can accurately identify traffic and perform various processing and forwarding for less than one hundred RMB. Amazing!