Redmi AC2100 官方固件允许IPv6外网访问下游设备

Fxxk, XiaoQiang!

  1. 升级/降级 至 官方固件版本: 2.0.23 稳定版。操作入口在路由器常用设置-系统状态-升级检测处。

  2. 开启SSH权限。F12打开浏览器的开发者模式,并切换至终端选项卡,复制以下代码至终端处,并敲回车执行:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    function getSTOK() {
    let match = location.href.match(/;stok=(.*?)\//);
    if (!match) {
    return null;
    }
    return match[1];
    }

    function execute(stok, command) {
    command = encodeURIComponent(command);
    let path = `/cgi-bin/luci/;stok=${stok}/api/misystem/set_config_iotdev?bssid=SteelyWing&user_id=SteelyWing&ssid=-h%0A${command}%0A`;
    console.log(path);
    return fetch(new Request(location.origin + path));
    }

    function enableSSH() {
    stok = getSTOK();
    if (!stok) {
    console.error('stok not found in URL');
    return;
    }
    console.log(`stok = "${stok}"`);

    password = prompt('Input new SSH password');
    if (!password) {
    console.error('You must input password');
    return;
    }

    execute(stok,
    `
    nvram set ssh_en=1
    nvram commit
    sed -i 's/channel=.*/channel=\\"debug\\"/g' /etc/init.d/dropbear
    /etc/init.d/dropbear start
    `
    )
    .then((response) => response.text())
    .then((text) => console.log(text));
    console.log('New SSH password: ' + password);
    execute(stok, `echo -e "${password}\\n${password}" | passwd root`)
    .then((response) => response.text())
    .then((text) => console.log(text));
    }

    enableSSH();

    此时会弹出一个对话框,要求输入密码,请输入并记住这个密码,敲回车提交。

  3. 使用Putty 或 Xshell 软件连接路由器,MIWIFI默认网关地址为 192.168.31.1。

  4. 使用 Vim 修改防火墙配置文件:

    1
    vim /etc/config/firewall
    • 将文件中defaults 闭包下 disable_ipv6 的值改为 0zone 闭包下 forward 的值改为 ACCEPT

    • 在原有的Rule 中添加一个闭包,允许IPv6外网访问路由器下游设备

      修改完毕,保存文件并退出修改。

  5. 终端执行命令,重启路由器防火墙:

    1
    /etc/init.d/firewall restart
  6. 进入路由器后台常用设置——上网设置——最底部IPv6设置,打开上方开关,上网方式修改为Native

  7. 使用路由器进行拨号上网,确保拨号成功。