Network troubleshooting and viewing in linux, and network troubleshooting in linux

Source: Internet
Author: User
Tags network troubleshooting nslookup

Network troubleshooting and viewing in linux, and network troubleshooting in linux

Basic troubleshooting errors

Troubleshooting must be simple and complex. Some people repeatedly configure the above files, but they cannot access the network. They always think that the system is faulty and want to reinstall the host. The results showed that the original network cable was not plugged in.

Troubleshooting should be conducted step by step:

(1) first, check whether the network cable is plugged in. If the light is on, it is OK.
(2) We should check whether our NIC Driver is normal, establish an ip address, and ping it to see if it is pinged. It indicates that the NIC is normal.
(3) Use the ifconfig command to check whether the ip address is correct and the route information is correct.
(4) ping the host in the same CIDR block. If not, the gateway settings are incorrect.
(5) Check the dns status (this is often the case. We can ping the LAN, but the Internet cannot be connected, that is, there is a dns problem)
(6) check whether the service is enabled. Generally, we disable the NetworkManager service.


(1) first disable NetworkManager:

Turn it off at startup:

(2) view routes:

(3) view dns settings:

(4) view ifcfg-eth0 and ifcfg-br0:

(5) view the network device identification rules:

Let's see if the rule specifies that eth0 is consistent with our settings.

NOTE: If all the above problems are solved, you can still not access the internet. Check whether the problem is caused by selinux.

View network Command Parsing:

View network configuration: ifconfig

Purpose: Configure or display the network interface parameters of the TCP/IP network.

Example operation: ifconfig

Link encap: the name of the network device in the OSI physical layer.
HWaddr: The hardware address of the NIC, that is, the MAC address. Inet addr: displays the network adapter IP address Bcast: The network broadcast address of this interface Mask: The network subnet Mask of this interface. MTU: The maximum transmission unit Metric of this interface: the default route cost.
RX: received packet statistics.
TX: the number of packets that have been transferred or transmitted in collisions: Number of packet collisions on the NIC interface txqueuelen: the length of the transport queue set by the nic rx bytes: The volume of received packets, in bytes. TX bytes: The volume of transmitted packets. The unit is byte interrupt: The IRQ interrupt value of this Nic interface.

Communication between two hosts: ping

• The ping command is generally used to detect network connectivity and network latency. The larger the value is, the slower the PING (PacketInternetGrope) and the Internet package Explorer are used to test the number of network connections.

• Ping sends an ICMP echo request message to the destination and reports whether the desired ICMP echo response is received. It is a command used to check whether the network is smooth or the network connection speed.

• Principle: All machines on the network have a unique IP address. When we send a packet to the target IP address, the other party will return a packet of the same size, based on the returned data packets, we can determine the existence of the target host and determine the operating system of the target host.

Example operation: ping-c 5 (-c 5 indicates that the ping command is executed five times)

Analysis of nodes between two hosts: traceroute

With traceroute, we can know the path from your computer to the host on the other end of the Internet. Of course, the path for each packet to arrive at the same destination from a certain source may be different, however, most of the time the routes are the same. In linux, traceroute is called tracert in MS Windows. Traceroute sends a small packet to the target device until it returns, to measure how long it takes. Traceroute of each device in a path must be tested three times. The output results contain the time (MS) of each test, the name of the device (if any), and its IP address.

Example operation: traceroute

We found that some of the returned data packets are ***, which indicates that the node may have some protective measures to discard the packets we sent.

View the network connection and backdoor of the Local Machine: netstat

Netstat is used to display statistics related to IP, TCP, UDP, and ICMP protocols. It is generally used to check the network connection of each port on the local machine.
If your computer sometimes receives a datagram that causes an error in data or a fault, you don't have to be surprised. TCP/IP can allow these types of errors and automatically resend the datagram. However, if the cumulative number of errors accounts for a considerable percentage of the received IP data packets, or the number of errors increases rapidly, then you should use Netstat to check the cause.


-A or-all: display valid connections established by socket-n in all connections-o display timer-p-programs Display programs in use-t display connection status of tcp transmission-u show the connections of udp transmission-l show the socket operations of the monitored Server: netstat-

Check the host Name and IP Address: host, nslookup

Both commands are similar and can trace the IP address of the server. However, the latter can also find the host name.

Example operation: host


View network load commands in linux

Netstat-s and df.

We recommend that you use other software, such as WareShark Network Analyzer, to view Network load at any time. Disk I/O is indeed a good use of iostat.

In linux, how does one view the opened ports and various statuses in the current system?

Check the opened network port?

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: 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.