Windows Network diagnostics

Source: Internet
Author: User
Tags network troubleshooting

With the increasing popularity of the Internet, networks have become an important part of people's life. Networks have become the most direct reason for many people to use computers, which makes network functions more prominent in computers. However, for most users, computers and operating systems are quite complex systems, and Windows networks are often unable to access the Internet. For people with certain computer and network foundations, you can use the tools provided by the system for network diagnosis to help solve network problems.

In essence, network problem diagnosis is to diagnose and locate the problem in sequence based on the network protocol stack, including the physical layer, data link layer, network layer, transmission layer, and application layer. Windows provides a series of tools to help you diagnose the network, including:
1. ipconfig: displays the configuration information of the IP protocol.
2. Ping: the network connection between the specified host is detected.
3. NSLookup: Host Name/IP Address Resolution
4. ARP: View IP address and physical address translation information
5. netstat: view the current active network connection information
6. tracert: route table information of the data packet arriving at the target host
With these tools, experienced users can quickly locate the problem. In addition, Windows comes with a network diagnostic tool that automatically scans the current system, collects information about related hardware, software, and network connections, and provides a diagnostic report. Run the tool as follows: control panel --> network connection --> (left) network troubleshooting program --> diagnose network configurations and run an automatic network test --> scan your system.

Network Application Software often integrates a Network diagnosis function, which requires developers to program and automatically detect various network protocols. The following is a simple network detection routine framework for your reference only.
Plugin_api void check_network (void)
{
Plugin_show_rt_info ("netdiag is checking ...");

If (check_network_connectivity ())
{
Plugin_show_rt_info ("network is OK! ");
}
Else
{
// 1 check the physical network connection
If (! Network_is_alive ())
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 2 check whether the NIC is working
If (! Diagnosetcpip ())
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 3 Check Network Configuration
If (! Diagnoselocalip ())
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 4 check whether the gateway is reachable
If (! Diagnosegateway ())
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 5 check the host file
If (! Diagnosehostfile ())
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 6 check whether the DNS server is reachable
If (! Diagnosedns ())
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 7 check whether the domain name can be resolved
Char hostname [] = "Your. Host. Name ";
Char IP [128];
If (! Get_ip_byname (hostname, ip ))
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}

// 8 Check Route accessibility
Printf ("% s-> % s/n", hostname, ip );
If (! Trace_route (IP, 30, true ))
{
Plugin_show_rt_info (getdiagnosiserror ());
Goto _ exit;
}
}
_ Exit:
Return;
}

 

(Aigui Liu/Liu IUI/aigui.liu@gmail.com)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.