Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get default gateway ip address using vb.net

Posted on 2003-10-30
1
Medium Priority
?
3,195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
CuSo4 earned 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

730 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