Networking – Why is D-Link DIR-825 not accepting a MAC address

routerwireless-networkingwireless-router

I am trying to reserve an IP address for my desktop PC in a DIR-825 and when I type in all the details and press the Save button it tells me that the MAC address is invalid.

My MAC address looks something like 1C:BD:B9:xx:xx:xx.

invalid mac address

I can add and save other MAC addresses from my other networked devices, but not this one. So I tried changing the format to include dashes instead of semi colons but it still said invalid. Then I noticed that most of my other stuff have a MAC address that starts with 00, so I tried changing the 01 into 00 and it was accepted.

Yes, the MAC address was accepted and it was very cute, but of course this is the wrong MAC address. Why will it accept the address if it begins with 00 but not if it begins with 01?

(Interestingly: The first 3 bytes, including the offending part, belongs to D-link)

I flashed the FW twice, from 2.01EU to 2.01EU and then upgrade to 2.06EU, but it didn't solve the problem and the router still remembers the old settings even though they are not presented in the interface.

After flashing the router with arbitrary FW the web interface appears empty, but the router acts like it still had the same configuration, even though the instructions said that a flashing procedure will erase my settings and data.

Even when I reset to factory defaults, it still remembered the settings.

factory defaults

So I ended up doing the "30/30/30 procedure" where you hold the RESET button for 30 seconds while cycling the power off and on again. This brings up the "Firmware Update System". I pick my FW file and send it to the router for flashing.

The flashing completed and the settings were finally all gone, and I was able to start creating new settings one step at a time. Then I came to the IP reservation list and I am stuck again.

  1. Why is this happening, why is it not accepting the MAC address? Is there an explanation to it?

  2. How do I force it to accept the darn address?

Update:

There is supposed to be a hack for this problem where you overwrite a function called check_mac with one of the following codes on the client side.

Code 1:
javascript:alert(check_mac=function (){return true;});

Code 2:
javascript:(function(){ window['check_mac'] = function() { return true; } })();

I tried both of these but it didn't work. How do you execute this code anyway? Is it enough just to type it in and hit Enter from the browser?

Source:

I asked D-Link about this and they sent me some Beta FW version 2.08EU, beta 4 I think. And they haven't even released an official final version of 2.06EU, not to my knowledge. This one is offered through the router itself, but is not available for download from any of the many localized D-Link websites, or from their global corporate website. And yet they are working on 2.08?? Doesn't make sense…

Here is an excerpt of the source code for the MAC reservation function.

function save_reserved(){
    var index = 0;
    var ip = get_by_id("lan_ipaddr").value;
    var mask = get_by_id("lan_netmask").value;
    var reserved_name = get_by_id("reserved_name").value;
    var reserved_ip = get_by_id("reserved_ip").value;
    var reserved_mac = get_by_id("reserved_mac").value;
    var start_ip = get_by_id("dhcpd_start").value;
    var end_ip = get_by_id("dhcpd_end").value;

    var ip_addr_msg = replace_msg(all_ip_addr_msg,_ipaddr);
    var Res_ip_addr_msg = replace_msg(all_ip_addr_msg,"Reservation IP");
    var start_ip_addr_msg = replace_msg(all_ip_addr_msg,"Start IP address");
    var end_ip_addr_msg = replace_msg(all_ip_addr_msg,"End IP address");

    var temp_ip_obj = new addr_obj(ip.split("."), ip_addr_msg, false, false);
    var temp_mask_obj = new addr_obj(mask.split("."), subnet_mask_msg, false, false);
    var temp_res_ip_obj = new addr_obj(reserved_ip.split("."), Res_ip_addr_msg, false, false);
    var start_obj = new addr_obj(start_ip.split("."), start_ip_addr_msg, false, false);
    var end_obj = new addr_obj(end_ip.split("."), end_ip_addr_msg, false, false);

    if(reserved_name == ""){
        alert(GW_INET_ACL_NAME_INVALID);
        return false;
    }else if(!check_LAN_ip(temp_ip_obj.addr, temp_res_ip_obj.addr, TEXT033)){
        return false;
    }else if(!check_address(temp_res_ip_obj, temp_mask_obj, temp_ip_obj)){
        return false;
    }else if (!check_domain(temp_res_ip_obj, temp_mask_obj, temp_ip_obj)){
        alert(TEXT033+" " + reserved_ip + " "+GW_DHCP_SERVER_RESERVED_IP_IN_POOL_INVALID_a);

        return false;
    }else if (!check_mac(reserved_mac)){
        alert(KR3);
        return false;
    }

    if (check_resip_order(temp_res_ip_obj,start_obj, end_obj)){
            alert(TEXT033+" " + reserved_ip + " "+GW_DHCP_SERVER_RESERVED_IP_IN_POOL_INVALID_a);
            return false;
        }
    //check same ip/mac start   
        var index = parseInt(get_by_id("edit").value);
        var edit_tmp = get_by_id("edit").value;
        for(m = 1; m < DataArray.length; m++){
                        if (m==index){
                 continue;
                }else{
                if(get_by_id("reserved_name").value.length > 0){
                    if((get_by_id("reserved_name").value == DataArray[m].Name)){
                        alert(sp_name+" ("+ get_by_id("reserved_name").value +") "+sp_alreadyused); 
                        return false;
                    }
                }
                if(reserved_ip.length > 0){
                    if((reserved_ip == DataArray[m].IP)){
                    alert(TEXT033+" ("+ reserved_ip +") "+sp_alreadyused);  
                        return false;
                    }
                }
                if(reserved_mac.length > 0){
                    if((reserved_mac == DataArray[m].MAC)){
                        alert(GW_DHCP_SERVER_RESERVED_MAC_UNIQUENESS_INVALID_a+" "+ reserved_mac +" "+GW_DHCP_SERVER_RESERVED_MAC_UNIQUENESS_INVALID_b);
                        return false;
                    }
                }

    }
        }
    //check same ip/mac end

    update_DataArray();

    var is_enable = "";
    if(get_by_id("edit").value == "-1"){     //add
        var i = get_by_id("max_row").value;
        var tb1 = get_by_id("table1"); 
        var oTr = tb1.insertRow(-1);
        var oTd1 = oTr.insertCell(-1);
        var oTd2 = oTr.insertCell(-1);
        var oTd3 = oTr.insertCell(-1);
        var oTd4 = oTr.insertCell(-1);
        var oTd5 = oTr.insertCell(-1);
        var oTd6 = oTr.insertCell(-1);

        if(parseInt(DataArray[i].Enable)){
            is_enable = "checked";
        }else{
            is_enable = "";
        }
        oTd1.innerHTML = "<center><input type=checkbox id=r_enable" + i + " name=r_enable" + i + " onClick='set_reserved_enable(" + i + ")' " + is_enable + "></center>"
        oTd2.innerHTML = "<center>" + DataArray[i].Name +"</center>"
        oTd3.innerHTML = "<center>" + DataArray[i].MAC +"</center>"
        oTd4.innerHTML = "<center>" + DataArray[i].IP +"</center>"
        oTd5.innerHTML = '<center><a href=javascript:edit_row('+ i +')\><img src=edit.jpg border=0 alt='+_edit+'></a></center>';
        oTd6.innerHTML = '<center><a href=javascript:del_row('+ i +')\><img src=delete.jpg  border=0 alt='+_delete+'></a></center>';
    }else{                                      //update        
        var i = parseInt(get_by_id("edit").value);
        if(parseInt(DataArray[i].Enable)){
            is_enable = "checked";
        }else{
            is_enable = "";
        }
        get_by_id("table1").rows[i].cells[0].innerHTML = "<center><input type=checkbox id=r_enable" + i + " name=r_enable" + i + " onClick='set_reserved_enable(" + i + ")' " + is_enable + "></center>"
        get_by_id("table1").rows[i].cells[1].innerHTML = "<center>" + DataArray[i].Name +"</center>"
        get_by_id("table1").rows[i].cells[2].innerHTML = "<center>" + DataArray[i].MAC +"</center>"
        get_by_id("table1").rows[i].cells[3].innerHTML = "<center>" + DataArray[i].IP +"</center>"
        get_by_id("table1").rows[i].cells[4].innerHTML = '<center><a href=javascript:edit_row('+ i +')\><img src=edit.jpg border=0 alt='+_edit+'></a></center>';
        get_by_id("table1").rows[i].cells[5].innerHTML = '<center><a href=javascript:del_row('+ i +')\><img src=delete.jpg  border=0 alt='+_delete+'></a></center>';
    }
    clear_reserved();
}

Best Answer

I have another solution: If you don't want to install a beta firmware on your DIR-825, I have a solution for you. I have done this on my DIR-825 rev. B EU model running firmware version: 2.01EU , Fri, 22, May, 2009.

  1. Open Google Chrome
  2. Log in to the DIR-825 as admin.
  3. Go to Network Settings.
  4. Hit Reserve and change the Computer Name if needed.
  5. Hit F12 and a prompt in Chrome will open.
  6. In the Console tab (properly the one opened as default) paste the following and hit the ENTER key on your keyboard:

    check_mac = function check_mac(mac){ var error = true; return error; };

  7. Now hit F12 again.

  8. On the Network Settings site hit the Save button and woila you have reserved your device.

A little background information: Because the validation is done in JavaScript that runs locally in your browser, we have the ability to change the code. In this case we modified a JavaScript function.

Related Question