Guide |
Because of the more hierarchical structure of the network server, it is more complex to solve when the network fails. Let me give you a detailed description of the Linux system may appear in some network problems, such as network card hardware problems, network configuration problems, driver problems, as well as network layer, transport layer, application layer issues. |
Nic fault can be divided into hardware failure and software failure, the simplest way to determine the hardware failure is to plug the network card into other computers to use, if it is still the same as the bad card, otherwise the network card is normal. In fact, most of the network card failures are software failures, software failures are generally divided into two categories: one for the setup failure, and one for the driver failure.
Diagnosing network card failures
[[Email protected] ~] #dmesg | grep etheth0:registered as Pcnet/pci II 79c970aeth0:link upeth0:no IPv6 routers present[[email protected] ~]#
The above command lists the lines that contain the ETH string in the boot information and, if prompted with a similar "Eth0:link up", indicates that the NIC has been detected by Linux and is in a normal working state. There is also a LSPCI command to list the system detects all PCI devices, if the network card used is a PCI bus, you should be able to see the information of this network card. Finally, you can use Ethtool to see if the Ethernet link connection is working.
[[Email protected] ~] #ethtool eth0settings for eth0: current message level:0x00000007 (7) Link detected:yes[[ Email protected] ~]#
If you see a "Link detected:yes" line, it indicates that the NIC is also the network line connection is normal.
NIC Driver
In Rhel 6, you need to review or set up the/etc/modeprobe.cong file, which contains installation and alias information about the module.
[[Email protected] ~] #more/etc/modeprobe.cong alias Scsi_hostadapter mptbase ... alias eth0 pcnet32 [[email protected] ~] #
In the above display, the last line "alias Eth0 Pcnet32" indicates that an alias eth0 is defined for Pcnet32, that is, the current Ethernet card interface eth0 the corresponding module is Pcnet32, You can use the command to see if there is a Pcnet32 module in the module currently loaded by the system.
[[email protected] 2.6.18-8.E15] #lsmod | grep pcnet32pcnet32 35269 0mii 9409 1 pcnet32 [[Email Protected]host 2.6.18-8.e15]#
It can be found that Pcnet32 has been installed. Therefore, if the network card has been detected by Linux, but the "ipconfig-a" command when the Eth0 interface is not seen, you can follow the above method to find the driver module of the network card, and then see if the module has been installed.
Diagnosing Network layer problems
The network layer problem diagnosis method is very simple, is the direct ping outside the network domain name or the IP, can connect normally, then indicates the network layer does not have the problem.
There are many reasons why pings can be different, such as network lines, network settings, routing, and ARP issues. It is recommended to ping the gateway first to see if it can pass, if the gateway can pass, generally indicates that network lines, their own network settings and ARP are not a problem. The routing table can be displayed by the command "Route-n", and then the address of the gateway is obtained. If the default gateway is not set in the routing table, there is a problem with the routing settings and you need to set the default gateway.
Sometimes, there are ARP attacks in the LAN or other reasons, so that the MAC address of the gateway IP in the native ARP cache is wrong, which can also cause the gateway to ping. At this point, you can use the arp-d < Gateway ip> command to remove the ARP entry for the gateway or to set the static ARP entry through the ARP-A < gateway ip>< Gateway mac> command.
diagnosing Transport layer and application layer issues
One of the most effective ways to diagnose faults in the transport and application layers is to use the grab tool to crawl the packet for analysis. In Linux, the Tcpdump tool is provided by default, which allows you to crawl all of the packets that access the native or from the native, and you can crawl only the packets of interest by using rules.
One possible cause of the operating system failure is the improper configuration of the firewall. In Linux, the Iptables firewall is enabled by default when the system boots, and only a few ports are released. So when a service is configured on this computer, and the service needs to be accessed through a port on TCP or UDP, the firewall is required to open the appropriate port, otherwise the host will not be able to access this service.
This article is reproduced from: http://www.linuxprobe.com/linux-network-troubleshooting/
free to provide the latest Linux technology tutorials Books, for open-source technology enthusiasts to do more and better:http://www.linuxprobe.com/
Network fault diagnosis under Linux