Force AVM FritzBox router to reconnect to ISP and get a new IP address

by Matthias Broschk September 15, 2006 14:16

Several websites such as file hosters track users and limit access (for example the amount of request within a certain time period) by logging the user IP. If you have a direct connection to the internet you won’t have any problems reconnecting and getting a new IP (unless you have a static IP).  This can quite easily be done programmatically.

But in some cases you are probably connected to a router (maybe even by WLAN) and don’t have that comfort. In those cases it it necessary to connect to your router. In Germany the AVM FritzBox is quite common and therefore this entry focuses only on that router. Other routers don’t work much different and you will probably be able to find similar solutions.

Basically the router is a small computer, which runs its own operating systems ( BusyBox Linux ). So all you basically have to do is open a telnet connection and execute certain commands. In order to log into your router you first will have to enable telnet access. Here you can find more information on how to enable telnet on your FritzBox.

Dim FritzboxIP as String = "0.0.0.0"
Dim TelnetClient As New ScriptingTelnet(FritzboxIP, 23, 7000)

TelnetClient.Connect()
TelnetClient.WaitFor("Console Ausgaben auf dieses Terminal umgelenkt")
TelnetClient.SendMessage("dsld -s")
TelnetClient.SendMessage("dsld -n")
TelnetClient.WaitFor("voip: ppptarget voip disabled, ignored")
TelnetClient.Disconnect()

This piece of code opens a telnet connection and restarts the DSL daemon which results in reconnecting to your ISP and retrieving a new IP. Since there are no built-in telnet classes in the .NET framework, I used this telnet library.

Tags: ,

Misk

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen | Modified by Mooglegiant

About the author

Matthias Broschk from Hamburg (Germany) wrote his first goto statements in QuickBasic at the age of fifteen, switched to Visual Studio (i.e. Visual Basic / Visual C++) at version 5.0 and has been an addict of .NET since its early beginnings. There have been many other languages and frameworks (Java, PHP, ... ), but none about which he has been as enthusiastic as .NET. These days you can find more information in blogs rather than anywhere else. Therefore he has decided to share his experiences and start yet another .NET blog.