Turning off the router's NAT acceleration, the download dropped from 940 MB to 200 MB.
I installed a new router, AX3000T, on Friday night. I plugged in the Gigabit Broadband and measured the speed at 940 Mbit/s. It was a blast for two days. On Saturday, I wanted to limit the uplink speed of the TV box. I went into the background and looked for QoS intelligent speed limit. Once I started saving, I retested the speed. The download speed was only a little over 200 MB. After turning off QoS, it returned to 940 MB. After struggling for a long time, I discovered that it was not the QoS that was broken, but the "NAT acceleration" that was turned on by default on the router.
NAT acceleration is turned on, and forwarding takes the hardware fast path. Gigabit broadband can run at full capacity. ; However, the hardware fast path bypasses the system kernel, and the QoS, parental control, port forwarding, and traffic statistics rules set in the background are all invalid. Turn off NAT acceleration, all functions are normal, but the cost is that the CPU does the work itself, and the Gigabit broadband drops to about 200 Mbit/s.
This article records the whole process of me stepping on this trap.: What exactly is NAT acceleration, why switches conflict, where are the switches of routers of various brands hidden, and the actual measured numbers of AX3000T on and off.
first step: Understand what NAT acceleration is
NAT acceleration, some brands are called CTF (Cut-Through Forwarding), some are called HNAT (Hardware NAT), and some are called fast forwarding. They are essentially the same thing.: There is a hardware circuit in the router SoC that is dedicated to forwarding data packets. After the data packets come in, they are not handed over to the Linux kernel for processing, but are directly forwarded by this circuit.
Ordinary forwarding goes through the kernel protocol stack, and the data packet enters the memory from the network card. The kernel protocol stack parses it layer by layer, then checks the routing table, does NAT, makes firewall judgment, and finally sends it out. The CPU needs to be involved in this process, and the CPU usage can soar to 60% to 80% when the gigabit broadband is full.
NAT accelerates the hardware fast path. Data packets basically do not enter the kernel protocol stack and are forwarded directly by hardware. The CPU usage is reduced to less than 5%, and Gigabit broadband can easily reach more than 900 Mbit/s. Sounds like all good, right?
The pit is here: Because the packet bypasses the kernel, all functionality that relies on kernel netfilter rules is disabled. QoS speed limit, parental control, port forwarding, firewall filtering, traffic statistics, and Internet behavior auditing, all of these must be intercepted and viewed in the kernel. The hardware fast path will directly bypass them, and it will be useless even if you set them up in the background.
My AX3000T turns on NAT acceleration by default, so I set the QoS to limit the upstream transmission of the TV box. The data packets take the hardware fast path and the QoS rules cannot block it at all. Of course, the speed limit has no effect. I wrote before Should router QoS be turned on? That article talked about how to set up QoS to make it effective, but it didn't mention the prerequisite for NAT acceleration, so I'll add that now.
Step 2: When NAT acceleration is turned on, which functions will be disabled?
After I turned off the NAT acceleration of the AX3000T, I tried the background functions one by one, and all of them failed.:
| Backend functions | NAT acceleration is on | Turn off NAT acceleration |
|---|---|---|
| Gigabit download speed | 900~940 MB | 180~220 trillion |
| CPU usage (no load) | 5%~8% | 12%~18% |
| QoS intelligent speed limit | ❌ Total failure | ✅ Effective normally |
| Parental Controls/Internet Time | ❌ Photo of device online | ✅ Disconnect the Internet on time |
| Port forwarding/virtual server | ❌ Can’t connect to external network | ✅ Can be accessed normally |
| Traffic statistics/device usage | ❌ The data is inaccurate or 0 | ✅ Statistics are normal |
The things in the table were tested by me personally and are not copied from official copywriting. Especially for port forwarding, I have a NAS that needs to be accessed remotely. After turning on NAT acceleration, the external network cannot connect to the NAS, and it only recovers after turning it off. The mapping rules are clearly written in the background, but the data packet does not go to the kernel's firewall list at all. I wrote before The difference between port forwarding and DMZ That article talks about two ways to open the door for external network access, but these two methods cannot be connected when NAT acceleration is turned on. This is a prerequisite that many people ignore.
Step 3: Where is the NAT acceleration switch for each brand of router?
Different brands have different names and locations. I went through several machines at my home and a friend’s home and compiled them as follows.:
| brand | Switch name | background path | Default state |
|---|---|---|---|
| ASUS | NAT acceleration/CTF | Professional settings → LAN → NAT acceleration (some models are in WAN) | open |
| TP-Link | Express Forwarding/HNAT | Advanced Settings → System Tools → System Parameters → Fast Forwarding | open |
| Xiaomi(MIWiFi) | No independent switch | The firmware is welded on and cannot be turned off by the user. | On (cannot be turned off) |
| Tenda | Hardware acceleration/short cut forwarding | Advanced Settings → System Management → Below Software Upgrade (some older models do not have this option) | open |
| OpenWrt | ctf/flowoffload | LuCI → Network → Firewall → General Settings, or /etc/config/firewall | mostly off |
Notice: Xiaomi's official firmware does not allow users to turn off NAT acceleration. AX3000T and AX6000 machines have it turned on by default. If you want to turn it off, you can only flash third-party firmware, as I wrote Flash OpenWrt on Xiaomi router That way. OpenWrt is the opposite. Most builds turn off hardware acceleration by default, and all functions are normal, but Gigabit broadband CPUs may not be able to handle it.
My AX3000T uses Xiaomi firmware and there is no place to turn off NAT acceleration. I later refreshed OpenWrt and manually turned off ctf. QoS and port forwarding returned to normal. However, when the gigabit broadband was full, the CPU core dropped to 90%+, and the download dropped to just over 200 MB.
Step 4: Actual test before and after of my AX3000T switch
The broadband is Telecom Gigabit. To test the speed, use a computer to plug directly into the router's LAN port. Turn off WiFi to avoid wireless interference. Run Speedtest three times to take the average.:
| test scenario | NAT acceleration enabled | NAT acceleration off | gap |
|---|---|---|---|
| Single thread download | 930~940 MB | 190~210 trillion | Lost about 700 trillion |
| upload speed | 45~50 trillion | 42~46 trillion | almost no difference |
| LAN NAS copy | 110~115MB/s | 108~112MB/s | Indifferent |
| Game delay (domestic server) | 35~42ms | 36~44ms | Indifferent |
| Router CPU peak | 8%~12% | 88%~95% | CPU does the work itself |
Just look at the table and you’ll understand.: NAT acceleration is on, the single-thread download is more than 900 MB, and the CPU is very idle. ; After turning it off, the single-thread download dropped to about 200 MB, and the CPU ran full one core. However, there is almost no difference between LAN NAS copy and game latency, which shows that NAT acceleration mainly affects routing and forwarding in the wide area network (WAN) direction, and LAN switching does not take this fast path.
When I turn on NAT acceleration and set the QoS speed limit to 20 Mbit/s for the TV box, the box can still run 4K at full bandwidth. ; After turning off NAT acceleration, QoS takes effect and the box is limited to 20 MB, but the computer can only run 200 MB when downloading large files.
Step 5: Should it be on or off?
It’s not black and white, choose according to your home scene:
- It is recommended to enable NAT acceleration: Gigabit and above broadband, only surfing the Internet to watch videos and downloading, no QoS or port forwarding, few devices at home, no need to carefully manage network speed. The vast majority of families fall into this category, which is the easiest to drive.
- It is recommended to turn off NAT acceleration: Broadband within 100 Mbit/s (200 Mbit/s is enough for downloading), QoS speed limiting, port forwarding to NAS/cameras, parental control to control children’s Internet access, and OpenWrt to mess with the firewall.
- compromise: Normally, NAT is turned on to speed up the bandwidth. Occasionally, when it is necessary to limit the speed or do port forwarding, go to the background and turn it off, and then turn it on again after use. AX3000T Xiaomi firmware can't do it, but OpenWrt can do it with one click.
My own last choice: AX3000T flashed OpenWrt, NAT acceleration is turned off by default, QoS is used to manage home devices, the TV box is limited to uplink, and NAS port forwarding is normal. When downloading large files, 200 MB is enough. I don’t pursue 940 MB in a single thread.
If you are like me, you have set a speed limit but find that the device continues to run regardless of the limit. First go to the background and look for the NAT acceleration switch. It is most likely that it is leaking water.
