Skip to content

Instantly share code, notes, and snippets.

@xiCO2k
Last active September 19, 2023 11:59
Show Gist options
  • Save xiCO2k/09e5c3e16941c05091d16e9292de1d7f to your computer and use it in GitHub Desktop.
Save xiCO2k/09e5c3e16941c05091d16e9292de1d7f to your computer and use it in GitHub Desktop.
Change IP address to 172.16.0.x on D-Link DWR 920
// Copy from the original funcion on the router.
// The router only allows IPs with 192.168. prefix, and subnet mask 255.255.255.0
// Run on console, and then call applicationApi_dhcpsettingsSet();
function applicationApi_dhcpsettingsSet() {
cpApi_get_authId();
var ip_addr = '172.16.0.200';
var start_addr = '172.16.0.201';
var num = 41;
var post_data = {
CfgType :"lan_setup",
ip4_addr: ip_addr,
ip4_subnet_mask: 16,
enable: 1, //DHCP
start_ip: start_addr,
num: num,
authID: auth_id,
changeToNotice: 1
};
var request = $.ajax({
url: "/webpost.cgi",
type: "POST",
data: JSON.stringify(post_data),
dataType: "json"
});
request.done(function (responseData, textStatus, jqXHR) {
clearCookies();
alert(global_lang['alerts_set']['dhcp_settings_success']);
var path = "http://" + ip_addr + "/";
dhcpRedirect(60, path);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment