Results 1 to 6 of 6

Thread: Programatically restart modem

  1. #1
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default Programatically restart modem

    I'd like to get some input from users and see what they think of this program. Here is some info about it.

    What is it:
    I created this program with an intention to make it easier for users to be able to reset their network. My parents always called me because they can't connect to the internet intermittently and I would always have to drive over to unplug the modem & router and just powercycle them only to be back on the road to my house. A 30 second fix that took 30 mins out of my way. Anywho, after alot of thought I have come up with this application. Basically when your internet goes down, run the program and it restarts the device\s.

    How does it work:

    1. Gets your network information
    2. Attempts ping requests to a series of sites
    3. If ping is successful then it prompts you it can't find a problem, if it is unsuccessful, it runs several tasks to try and resolve it.
    Assuming ping fails
    A: Attempts to establish a connection with your modem
    A1:If it can establish a connection, it sends an arbitrary command that forces the modem to restart
    B:If it can't establish a connection, it attempts to establish a connection with your router
    B1:If it can establish a connection with the router, it attempts to release and renew your IP
    B2:If it can't establish a connection with the router or your modem, then you get a messagebox that prompts you t make sure all connections are securely plugged in and to try again. If it still fails, then at that point you're probably having ISP issues

    Restrictions\Limitations
    1. This is written in Win32 API so therefore, it's not compatible with mac and *nix
    2. It's assuming your modem configuration page is at 192.168.100.1 (which is default for MOST modems)
    3. The arbitrary command that resets the modem AFAIK works for Motorola Surfboard (cable) modems, but may not necessarily work for other modems.
    4. Probably won't work if you have a hacked or modified firmware

    Note:
    Not sure what requirements there are for cable companies\modems outside of the US. This should work with most docsis motorola modems.

    Please let me know any suggestions you may have and your thoughts on this.
    Attached Files Attached Files

  2. #2
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    My gateway address is different, so I'd suggest to parse it from connection info instead of assuming it's 192.168.100.1 . Gateway info will probably be always available, if not - then you already now there's a problem with cables and connectors.

  3. #3
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    When you run it it should succeed since you're connected to the internet, and it should display your Ethernet settings. Are those settings accurate?

    192.168.100.1 doesn't necessarily have to be your gateway. When I'm connected to my modem directly assuming I have my ip 123.*.*.* and subnet 255.255.255.0, my Gateway is usually something like 123.*.*.1 (even though my modems configuration is STILL 192.168.100.1). I can't recall if the address is referred to the DHCP or TFTP or what.

    Code:
    if(pAdapter->GatewayList.IpAddress.String == NULL)
    {
    check connections;
    }

  4. #4
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    Yes, but as you said, it was/is a limitation, so I thought you could just check for it, like you showed it in this pseudo-code and make it work for different gateway addresses.

  5. #5
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Yeah good idea. I should do that. I'll PM you something

  6. #6
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Bah, it doesn't work with xp either haha. I gotta use GetAdaptersAddresses()

    ifdef(WinVistaPlus)
    endif

    FTW Yay!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •