In this guide, we will discuss how to use traceroute and mtr to diagnose network issues. These tools and utilities will provide a good overview of what stage of the. Simple Ping Utility with GUIIntroduction. This article demonstrates the usage of Ping class located in the System. Net. Network. Information namespace in different scenarios such as host monitoring, tracing routes and scanning range of IP addresses. In addition to these network tools, the application also tracks statistics about tracked hosts and allows the user to display those statistics as graphs. Ping Class. The most common way to ping another host is to send ICMP . As it was stated at the beginning of the article, you can use Ping class available in . NET Framework that wraps this type of ICMP message to make your life easier and save yourself from implementing the protocol by yourself. Ping class goes together with some other classes and data types such as Ping. Options and Ping. Reply classes and IPStatus enumeration. The heart of the class is the Send method . The method has several overloads, but all of them return an instance of the Ping. Reply class which contains results of echo request . Here are a few examples: Ping pinger = new Ping(). Ping. Reply reply = Ping. Options pinger. Options = new Ping. Options(1. 27, false). Ping. Reply reply = pinger. Send(. Based on this simple method, we need to provide some meaningful and useful statistical information. Simple traceroute java program in description. IonCalc is an expression based calculator, and very easy to use.Host. Pinger Class. Host. Pinger class is built on top of the Ping class and it is in charge of pinging the host and calculating, storing and providing statistics about it. The class has five public constructors: public Host. Pinger(). public Host. Pinger(Xml. Node node). Host. Pinger(string host. Name). public Host. Pinger(IPAddress address). Host. Pinger(string host. Name, IPAddress address); Pinging is controlled with Start and Stop methods or by setting the Is. Running property. Host. Pinger class has four events . Provided logger must implement IPing. Logger interface. And finally, the Save method will write ping options and host information using the provided Xml. Writer object. Host pinger can be configured with following options: Name of XML element in the configuration file that stores option. Name of the property. Type. Required. Default Valuename. Host. Namestring. Yesnone. Host name. If IP address is not specified, pinger uses this name to query DNS server and obtain IP address of the host. It is not a required field. If IP address is not specified, pinger uses this host name to query DNS server and obtain IP address of the host. Additional options are available for data series that represent source for showing hosts' statistics in graphs . Series options should be stored in data node of host's node. Two options are currently available: name which represents name under which the series will appear in graph and depth which defines number of values that series will store. If 0 is specified for series depth, it will be unlimited. Each series must specify its source, by providing id of data source: Source IDSource Name/Description. Received Packets Percent. Lost Packets Percent. Consecutive Lost Packets. Received Packets Recent. Received Packets Recent Percent. Lost Packets Recent. Lost Packets Recent Percent. Current Response Time. Average Response Time. Host Availability Percent. Several macros are available for naming data series: %hostname% . It is a simple process, IP scanner just needs to send ICMP messages to all IP addresses in the range and wait for reply. Those addresses from which replies are returned within given timeframe are alive and all others are assumed to be dead. In order to avoid network overload, ICMP flood should be controlled by specifying how many concurrent pings there can be, when the number is reached scanner won't send more ICMP messages until previous ping requests are completed. IPScanner Class. IPScanner class implements scanning process. In addition to standard ICMP options . Active property indicates whether the scanner is running. Control over process of scanning is exposed through Start, Stop and Wait methods. Wait method blocks thread which called it until the scanning process is completed or aborted. Also the class has events that notify user when state of scanning process is changed: On. Start. Scan, On. Stop. Scan and On. Restart. Scan. Start method accepts IP address range as its parameter. Range is represented by IPScan. Range class. Constructors accept either IP range . Each host is represented by IPScan. Host. State class. The class stores various information and statistics about host which are discovered during the scanning process: Property Name. Description. Address. IP address of the host. Response. Times. Array which contains response times of each ping request issued during the scanning. Pings. Done. Number of ping requests issued to the host. Loss. Count. Number of ping requests to which there was no response within required timeframe. Avg. Response. Time. Average response time. Quality. Value that represents quality of connection to the host in range (0, 1)Quality. Category. Discrete value of connection quality. Address. IP address of the host. Current. State. Current state of the host: Testing, Dead or Alive. Host. Name. Name of the host discovered using reverse DNS lookup. IPScan. Host. State class also provides methods for testing current state: Is. Alive, Is. Dead and Is. Testing. There is On. State. Change event which is raised when the state of the host is changed. Tracerout. The purpose of tracerout is to show network path between source and destination host. It works by controlling TTL field. TTL defines maximal number of hops allowed before the packed should be discarded by the router. When router encounters such a packet, it sends ICMP Time Exceeded response to source which also includes IP address of the router. So at first, TTL is limited to one, and each time Time Exceeded response is received, traceroute print routers address, increases TTL and send another packet. The process is repeated until the destination host is reached. If Time Exceeded is not received after one or more tries, traceroute should skip the hop and go to the next by increasing TTL. IPRoute. Tracer Class. Traceroute is implemented by IPRoute. Tracer class and each hop . Hop class contains IP address of the router, its ordinal number in the path and response times of each ping request. IPRoute. Tracer's constructors accept IP address of the destination host and various parameters: request timeout period, number of pings and number of retries for each hop. In each tracer, try sends specified number of ping request before it starts another try or progresses to the next hop. List of detected hops is exposed by Route property. Start, Stop and Wait method provide control over tracing process. Also several events are available to track progress: On. Hop. Success. Raised after the hop has been successfully traced.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |