Click here to Skip to main content
15,886,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i would like to develop a Network Topology Diagram using asp.net.
so,please suggest me some method to find out ip address of nearest router in the LAN.


Thanks_
Posted

1 solution

 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 8-Jun-14 5:51am    
I do not think so - DHCP server and router are not the same...
I think there is not way of telling what the IP of the closest router, but OP may get all the IP addresses from his machine to the target. This called trace...
sudheeshkpza 8-Jun-14 10:03am    
Hi OriginalGriff,

Thanks for your reply.

I have choose a approach to discover network nodes and connectivity among them.

(I) Determining the ip address of the nearest router using ICMP protocol.
(II) Further this ip address of the router will be used to find the other connected devices
using SNMP and ICMP protocol.
(III) Continuous monitoring of discovered devices using ICMP.

I am trying to achive the first step.so, i use C# ping class for ICMP echo messages.
Then, i know that, "If ping reply address is not same as the address on which request was sent,
it is the router address."(Router will sent reply when sender could not reach the specified destination)

but, when i check reply address ,it is not a router address.

if (reply.Status == IPStatus.DestinationHostUnreachable)
{
Console.WriteLine("Address: {0}", reply.Address);
}

please guide me as to what exactly i'm going wrong here .

Thanks_

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900