Skip to content

Instantly share code, notes, and snippets.

@francoism90
Last active September 6, 2024 14:55
Show Gist options
  • Save francoism90/3dede7973354d067c41bff5e54203fe9 to your computer and use it in GitHub Desktop.
Save francoism90/3dede7973354d067c41bff5e54203fe9 to your computer and use it in GitHub Desktop.
Change country to unlock channels, increase TX-power. (Use at your own risk)

Warning

Following instructions are provided without any warranty, and may even get you in trouble legally. The instructions are provided for testing, and should be use with care. We (including commentators) are not responsible for any damage to your device(s).

Introduction

This may enable additional channels and power (in most cases don't) on ASUS Merlin provided routers.

The nvram settings have been tested on a ASUS RT-AX58U, they may work on other models as well (ASUS RT-AC78U).

Please use nvram dump and adjust when needed, as they may differ on your device!

Credits to the commentators below, and members on the SNBForums posting instructions. Please post your findings, and help others when needed. :)

Login into router using SSH

See https://www.htpcguides.com/enable-ssh-asus-routers-without-ssh-keys/ for instructions.

Backup current settings

nvram dump > dump.txt

NOTE: You need to copy the dump.txt (or output by nvram dump to somewhere else), as they will be lost on reboot

JFFS custom scripts and configs

Make sure Enable JFFS custom scripts and configs, is enabled in System settings. See https://github.com/RMerl/asuswrt-merlin.ng/wiki/User-scripts for details.

Make sure to also run the following commands:

nvram set jffs2_scripts="1"
nvram commit

User-scripts

Create the /jffs/scripts/wl file, and paste the nvram overwrites into this file (see given example file).

Create/adjust /jffs/scripts/init-start:

#!/bin/sh

[ -x /jffs/scripts/wl ] && /jffs/scripts/wl &
# [ -x /jffs/addons/AdGuardHome.d/AdGuardHome.sh ] && /jffs/addons/AdGuardHome.d/AdGuardHome.sh init-start & # place before addons

Create/adjust /jffs/scripts/services-start:

#!/bin/sh

/jffs/scripts/wl >/dev/null 2>&1 & # wl
# /jffs/scripts/scmerlin startup & # scMerlin

Create/adjust /jffs/scripts/service-event:

#!/bin/sh

if echo "$2" | /bin/grep -q "wireless"; then { /jffs/scripts/wl service_event "$@" & }; fi # wl

Create/adjust /jffs/scripts/service-event-end:

#!/bin/sh

if echo "$2" | /bin/grep -q "wireless"; then { /jffs/scripts/wl service_event "$@" & }; fi # wl

Make sure the scripts are executable:

chmod a+rx /jffs/scripts/*

Applying changes

You need to reboot the router to apply changes:

reboot

To make the changes persistent, make sure to add them to the jffs/scripts/wl script.

#!/bin/sh
# Allow all channels
nvram set location_code=#a
nvram set 0:ccode=#a
nvram set 0:regrev=0
nvram set 1:ccode=#a
nvram set 1:regrev=0
nvram set territory_code=CN/02 # or US/02
nvram set wl_country_code=#a
nvram set wl_reg_mode=h
nvram set wl0_chlist="1 2 3 4 5 6 7 8 9 10 11 12 13 14"
nvram set wl0_country_code=#a
nvram set wl0_country_rev=0
nvram set wl0_reg_mode=h
nvram set wl1_chlist="36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140 149 153 157 161 165 169 173 177"
nvram set wl1_country_code=#a
nvram set wl1_country_rev=0
nvram set wl1_reg_mode=h
nvram set acs_dfs=0
nvram set wl_acs_excl_chans_dfs=
nvram set wl_acs_excl_chans=
nvram set wl0_acs_dfs=0
nvram set wl0_acs_excl_chans_base=
nvram set wl0_acs_excl_chans=
nvram set wl1_acs_dfs=0
nvram set wl1_acs_excl_chans_base=
nvram set wl1_acs_excl_chans=
nvram set acs_unii4=1
# Channel selection
# nvram set wl0_chanspec=0 # auto select
# nvram set wl1_chanspec=0 # auto select
# nvram set wl_chanspec=0 # auto select
# nvram set wl0_sel_channel=7/80 # force 2.4GHz channel
# nvram set wl1_sel_channel=149/80 # force 5GHz channel
# Set TX-Power (risky!)
nvram set 0:maxp2ga0=120
nvram set 0:maxp2ga1=120
nvram set 1:maxp5gb0a0=120
nvram set 1:maxp5gb0a1=120
nvram set 1:maxp5gb0a2=120
nvram set 1:maxp5gb0a3=120
nvram set 1:maxp5gb1a0=120
nvram set 1:maxp5gb1a1=120
nvram set 1:maxp5gb1a2=120
nvram set 1:maxp5gb1a3=120
nvram set 1:maxp5gb2a0=120
nvram set 1:maxp5gb2a1=120
nvram set 1:maxp5gb2a2=120
nvram set 1:maxp5gb2a3=120
nvram set 1:maxp5gb3a0=120
nvram set 1:maxp5gb3a1=120
nvram set 1:maxp5gb3a2=120
nvram set 1:maxp5gb3a3=120
nvram set 1:maxp5gb4a0=120
nvram set 1:maxp5gb4a1=120
nvram set 1:maxp5gb4a2=120
nvram set 1:maxp5gb4a3=120
nvram set wl0_txpower=500
nvram set wl1_txpower=500
nvram set wl_txpower=500
# Commit changes
nvram commit
@Hellohi3654
Copy link

confirmed working on ax86u pro

@Squall-Leonhart
Copy link

enabling the missing channels doesn't seem to work on my ac68u, did on my ac88u both on merlin 386.14,

the country codes reset on reboot,

@dionvl
Copy link

dionvl commented Aug 7, 2024

settings for 5G

wl -i eth7 down wl -i eth7 regulatory 1 wl -i eth7 spect 0 wl -i eth7 chanspec 100/160 wl -i eth7 up

Thanks @omrij ! Had to change eth7 to eth6 for the AX82U. DFS is borked on this model so I'm glad my WiFi will now stay up.

@francoism90
Copy link
Author

@Squall-Leonhart Please dump the unmodified first nvram dump, and compare the values with the provided one. You may need to have different values, my model isn't that new, so I cannot test unfortunately.

@Squall-Leonhart
Copy link

Squall-Leonhart commented Aug 7, 2024

found the reason, unlike ac88u which can retain these values over reboot, the ac68u forcibly copies the cfe values back to nvram, so you have to add them to init-start.

@francoism90
Copy link
Author

@Squall-Leonhart Yes, see updated instructions, because you basically have to add them all of the place lol.

@Euri007
Copy link

Euri007 commented Aug 23, 2024

Hy,
Is there a solution to change country code in asus tuf-ax5400?
Thanks

@Linden1
Copy link

Linden1 commented Aug 23, 2024

Hy, Is there a solution to change country code in asus tuf-ax5400? Thanks

Unfortunately not. Only works with Merlin firmware, for which there are no releases for non-broadcom routers.

@Euri007
Copy link

Euri007 commented Aug 23, 2024

Hy, Is there a solution to change country code in asus tuf-ax5400? Thanks

Unfortunately not. Only works with Merlin firmware, for which there are no releases for non-broadcom routers.

Thans fiend

@argh0815
Copy link

You can install GNUton's firmware which is an official fork of Merlin and supports TUF-AX5400 https://github.com/gnuton/asuswrt-merlin.ng

@Linden1
Copy link

Linden1 commented Aug 23, 2024

Well spotted @argh0815

@heythem500
Copy link

does it have to be for Merlin routers?
I have RT-AX58U V2 without merlin!!

@Hellohi3654
Copy link

does it have to be for Merlin routers? I have RT-AX58U V2 without merlin!!

You can also install GNUton's fork
https://github.com/gnuton/asuswrt-merlin.ng

@omrij
Copy link

omrij commented Aug 25, 2024

does it have to be for Merlin routers? I have RT-AX58U V2 without merlin!!

No
Nvram method works on stock asuswrt
wl works too, but isn't persistent after wifi restarts

@francoism90
Copy link
Author

@heythem500 I only tested this on Merlin, I indeed thought as @omrij that only scripts are supported on Merlin.

@Euri007
Copy link

Euri007 commented Aug 25, 2024

I'have Just installed Merlin gnuton fork. Now can i use script and It works?

@super0r
Copy link

super0r commented Aug 26, 2024

Wondering if you can create youtube video on this? it be helpful!

thnx

@super0r
Copy link

super0r commented Aug 26, 2024

Followed steps on a GT-AX6000 from Germany. Tx power did increase and better signal (signal strength from same spot -58dbm to -44dbm). New channels (149 and up) appeared as well. GUI changes seems to not cause issues and I can swap to other channels in GUI. However, whenever I try to connect to channel 149 from an Intel AX211 card, Windows shows I am using wifi 4 instead of wifi 6. Lower channels (36, 44, 48 etc) are fine. Is this an Intel issue like the previous posts indicated? Thanks for the help and good luck everyone.

i have the same router as you Asus gt-ax6000 wondering what version is your hw ? thanks

@Hellohi3654
Copy link

Hellohi3654 commented Aug 26, 2024

Followed steps on a GT-AX6000 from Germany. Tx power did increase and better signal (signal strength from same spot -58dbm to -44dbm). New channels (149 and up) appeared as well. GUI changes seems to not cause issues and I can swap to other channels in GUI. However, whenever I try to connect to channel 149 from an Intel AX211 card, Windows shows I am using wifi 4 instead of wifi 6. Lower channels (36, 44, 48 etc) are fine. Is this an Intel issue like the previous posts indicated? Thanks for the help and good luck everyone.

i have the same router as you Asus gt-ax6000 wondering what version is your hw ? thanks

I'm using the ax-86u pro and have this same issue using 149 and above causes specifically Intel WiFi cards to use wifi 4 when connected to the 5ghz network
Mediatek WiFi cards work fine so not sure if this is a bug or intentional design from Intel. Would be quite stupid if it's intentional

@Euri007
Copy link

Euri007 commented Aug 26, 2024

Yesterday try to make this change:
nvram set location_code=#a
Now I have to all settings ALL

Tx power for 2.4 is 28,5 db
Tx power for 5 is 27,5 db

I try to revert change coming back to
nvram set location_code=E0 but not work

28,5 db and 27,5 db seem to high for me and I'want return to old eu settings.

How to revert?
Thanks

@Linden1
Copy link

Linden1 commented Aug 26, 2024

Yesterday try to make this change: nvram set location_code=#a Now I have to all settings ALL

Tx power for 2.4 is 28,5 db Tx power for 5 is 27,5 db

I try to revert change coming back to nvram set location_code=E0 but not work

28,5 db and 27,5 db seem to high for me and I'want return to old eu settings.

How to revert? Thanks

If you go into the router's gui you can, in Wireless Professional settings for 2.4GHz, change the slider at the bottom of the page to Power Save. After reboot the radio output power should be back close to default settings - in my case 17.0 17.0 17.0. This leaves you free to change the radio power without having to edit the wl script.

@Euri007
Copy link

Euri007 commented Aug 26, 2024

Perfect, i'll try to change it.
Thanks

Another thing
I have not compiled a script. I have only set change and nvram commit.
Are settings persistent or after a reset all come back to eu?

@pasko-zh
Copy link

Followed steps on a GT-AX6000 from Germany. Tx power did increase and better signal (signal strength from same spot -58dbm to -44dbm). New channels (149 and up) appeared as well. GUI changes seems to not cause issues and I can swap to other channels in GUI. However, whenever I try to connect to channel 149 from an Intel AX211 card, Windows shows I am using wifi 4 instead of wifi 6. Lower channels (36, 44, 48 etc) are fine. Is this an Intel issue like the previous posts indicated? Thanks for the help and good luck everyone.

i have the same router as you Asus gt-ax6000 wondering what version is your hw ? thanks

I'm using the ax-86u pro and have this same issue using 149 and above causes specifically Intel WiFi cards to use wifi 4 when connected to the 5ghz network Mediatek WiFi cards work fine so not sure if this is a bug or intentional design from Intel. Would be quite stupid if it's intentional

It is most likely intentional and it is stupid. This is Intel's LAR (Location-Aware Regulatory)... I always had issues with my Intel cards, so I replaced them with Mediatek. Works much better, both under win and ubuntu 😊

@francoism90
Copy link
Author

@Euri007 If you did nvram commit, they are stored/persists.

It's really recommended to dump your original nvram, before applying any changes.

@pasko-zh
Copy link

I'have Just installed Merlin gnuton fork. Now can i use script and It works?

Try it out, then you will know and you could also share this feedback to the community here 😊

In general, scripts as listed above should work...

May I ask you to check, whether manipulating the driver via wl command works as well? See here and following. 🙏

@Hellohi3654
Copy link

Followed steps on a GT-AX6000 from Germany. Tx power did increase and better signal (signal strength from same spot -58dbm to -44dbm). New channels (149 and up) appeared as well. GUI changes seems to not cause issues and I can swap to other channels in GUI. However, whenever I try to connect to channel 149 from an Intel AX211 card, Windows shows I am using wifi 4 instead of wifi 6. Lower channels (36, 44, 48 etc) are fine. Is this an Intel issue like the previous posts indicated? Thanks for the help and good luck everyone.

i have the same router as you Asus gt-ax6000 wondering what version is your hw ? thanks

I'm using the ax-86u pro and have this same issue using 149 and above causes specifically Intel WiFi cards to use wifi 4 when connected to the 5ghz network Mediatek WiFi cards work fine so not sure if this is a bug or intentional design from Intel. Would be quite stupid if it's intentional

It is most likely intentional and it is stupid. This is Intel's LAR (Location-Aware Regulatory)... I always had issues with my Intel cards, so I replaced them with Mediatek. Works much better, both under win and ubuntu 😊

Yeah thought as much

@Euri007
Copy link

Euri007 commented Aug 26, 2024

@Euri007 If you did nvram commit, they are stored/persists.

It's really recommended to dump your original nvram, before applying any changes.

my mistake I have not dump.
Is there another solution?

So I have anoter router equal. Can I dump this?

@francoism90
Copy link
Author

@Euri007 No worries, you can also reset your router, and you'll have the default values again. It's also recommended to do so after switching firmwares.

I don't know that fork, but you should be able to simply reset using the router interface.

@Euri007
Copy link

Euri007 commented Aug 26, 2024

@Euri007 No worries, you can also reset your router, and you'll have the default values again. It's also recommended to do so after switching firmwares.

I don't know that fork, but you should be able to simply reset using the router interfac
I have merlin gnuton fork.
If I coming back to asus firmware and then I flash again gnuton the values come back to original?

@francoism90
Copy link
Author

@Euri007 You don't have to flash back to stock, just stay on the fork if you want to test channels and such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment