ISPs push configurations via TR-069. If your router keeps resetting to factory defaults or you cannot obtain an IP address, your firmware's ACS (Auto-Configuration Server) module may be out of sync with your provider.
This is the standard manual method if you have the firmware file and administrative access. Hg8245q Firmware Upgrade