Solved

get default gateway ip address using vb.net

Posted on 2003-10-30
1
3,060 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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