Solved

get default gateway ip address using vb.net

Posted on 2003-10-30
1
3,004 Views
Last Modified: 2008-02-07
I am writing a program to provide diagnostic information for laptop users on the road. I wish to find the default gateway assigned by the ISP so I can ping it and check it's responding.

I have written ping code
and I am able to get the machines IP address(es) using this function:
Public Function GetLocalIPAddress() As String
  Dim h As IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
  Dim ip As IPAddress
  Dim strOutput As String
  For Each ip In h.AddressList
    strOutput &= ip.ToString & " "
  next
  GetLocalIPAddress = strOutput.Trim
End Function

I want the default gateway IP as you would be able to get from running IPConfig/all at cmd prompt (but don't want to have to parse the output of a command line program).

Is it possible to do this using vb.net objects.

Thanks, Fiona
0
Comment
Question by:wallacef
1 Comment
 
LVL 2

Accepted Solution

by:
CuSo4 earned 250 total points
ID: 9651551
Maybe this link can help you: http://www.dotnet247.com/247reference/msgs/18/91898.aspx

It's a VB.NET 'which displays the information of ipconfig /all
which includes the default gateway IP of the machine. It makes use of Ip helper api's
GetNetworkParams and GetAdapterInfo() api'
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now