Source: Reprinted from SEOUL Author: Cao Yuan its
Since Linux's desktop applications are still a certain gap compared to Windows, it is often a Linux and a Windows operating system to form a heterogeneous network in enterprise applications. SMEs have lack of experienced Linux network administrators, so for Linux network fault analysis and exclusion often is a headache for medical head, foot pain, lack of comprehensive consideration. According to statistics, the Linux network fault has 35% in the physical layer, 25% in the data link layer, 12% in the network layer, 10% in the transport layer, 8% in the conversation layer, 7% in the representation layer, 3% at the application layer . It can be seen that the network fault usually occurs under the lower three layers of the network seven-layer model, namely the physical layer, the link layer, and the network layer. The network cable, connection module, network card, switch, router, and other devices, etc. corresponding to the actual network. These faults may be caused by the quality or performance, wear aging, human error, incorrect settings, management defects, hacking system intrusion. The Linux network service is very powerful, whether it is Mail Server, Web Server, DNS Server, etc. very well. However, some people often complain that there is no way to connect Linux. Let's take a look at the network model of Linux TCP / IP (see Figure 1), master the hierarchy of the OSI model, TCP / IP model, and related services for Linux network failure analysis and exclusion.
Figure 1 List of Linux TCP / IP network models and related services
Solving the problem of solving the problem of the problem should be started from the bottom of the Linux network, then slowly check, the problem solving process can be as follows: ◆ Check if the network card can work properly; ◆ Local network hardware online confirmation Can not ping to the same Other computer IP (local area network) in the domain; ◆ Check if DNS is set correctly; ◆ Check if the host's service is turned off, check inetd.conf /etc/xinetd.d; ◆ Some services are permissions and ports open . For example, in a local area network wiring method, a case where a network problem can be generally divided into a network hardware transfer section and an operating system, a communication protocol, or a related service software setting problem. 1. Network hardware transmission issues (1) The network cable can be found in Figure 2, and the most used network cable is used in the network interface device. Since the network line is often attached to the corners and gates, it is possible to be crushed. Therefore, it is necessary to pay attention to whether the network cable is truncated, the network cable is excessively distorted, and the self-made network connector (such as RJ-45 jumper) has poor signal poor quality; network joints and equipment (such as hub, routers, switches) are poor contact. (2) NIC, hub, router, switch and other network equipment network cards are unstable, the quality is poor, or the compatibility with the overall system is poor; the contact is poor contact, resulting in signal attenuation; network equipment use method, resulting in equipment Functional attenuation, etc. will cause transmission problems. (3) The configuration of each device is ruled by the rules of the device configuration. Too long network line will cause the signal attenuation, causing the network online to get too long or even unable to connect. (4) The UPS power UPS power supply is an easily ignored link. Due to routers, switches, baseband "Cat" and other network devices are very sensitive to voltage and grounding, and therefore, the performance of online UPS should be used as a power supply. It is best to use 2000W power or more, so that all network devices can be used. Both are connected to the same power supply to avoid voltage differences between different devices. In addition, equipment rooms and cabinets have very good grounding measures, and establish a ground wire to all equipment to ensure that the grounding voltage is the same, ensuring that the network equipment is carried out. 2. Software Settings Issues (1) The IP setting error of the NIC, for example, the same IP appears in the same network segment causes IP conflicts, sub-shielding network setting errors, etc. (2) Router problem (router) is in this regard, or the route is not correct, causing the data package without a way to send out. (3) Network load problem (loading) When a hacker is implemented to the network, there is a large amount of information incoming Server or HUB at the same time, it is possible to cause the network's pause or even hang. (4) Other, for example, some ports are blocked by the firewall, causing certain network resources; the application itself bugs; the user's network setting error; and the compatibility issues of different operating systems. The method of solving the problem is taken as described in Figure 2, and the method of solving the problem can be found from the NIC of the own PC, and then the hardware such as network line, HUB. If you are determined that the hardware is no problem, then consider the software settings. Figure 2 Network Topology
1. Check if the NIC Work Status (1) Whether the module using the LSMOD to view the network card has been loaded (see Figure 3)
# lsmod
Figure 3 shows Linux hardware conditions
The second row in Figure 3 shows the network card and has been loaded. If the hardware is not detected, use the hardware detection program Kuduz to detect the NIC, and it is similar to the new hardware to Windows. If the core supports the hardware, and there is the driver to be automatically loaded. (2) Use ifconfig to view the network card operating conditions If the network card has been detected, the network card hardware is no problem, and then check the software settings of the NIC. Use ifconfig, if no network hardware is driven, use the following command to load: # ifconfig eth0 192.168.0.2 Netmask 255.255.255.0 Up
Figure 4 is my network setting, the device name is Eth0, IP is 192.168.0.2.
Figure 4 Network basic information
If you don't detect a network card, you will be troublesome, usually to reinstall the driver of the NIC, the network card driver installation method steps are as follows: ◆ Compile and install the module; ◆ Modify / Etc/conf.module file; ◆ Modify / etc / sysconfig / network File; ◆ Modify the / etc / sysconfig / network-scripts / ifcfg-eth0 file; ◆ After the iFup Eth0 activates the NIC and then view. If there is still a problem, basically determine that the physical failure of the network card needs to be replaced. 2. Local network hardware online confirm that the most important network card settings are confirmed that there is no problem, then confirm the network connection between the local area network. According to the network topology according to Figure 2, the requirements for the local area network have the following points: (1) IP setting hypothesis subnet is 192.168.1.0/24, then all computer IPs in the LAN should be between 192.168.1.1-92.168.1.254 And all computer sub-shielding networks are 255.255.255.0, and IP can not be repeated all on all computers. (2) Gateway assumes that Linux IP is 192.168.1.2, then the Gateway of all other personal computers in the LAN is 192.168.1.2. (3) Communication protocols in the Windows-side Communication Protocol LAN may only require TCP / IP and NetBuei, and if too many communication protocols are installed, it may cause internetly slower. (4) The WINDOWS Working Group and the computer name are if resource sharing is required, then the file sharing must be created in the Windows system, and all computer workgroups must be the same, but the computer name cannot be the same. 3. Check if the DNS settings are correct if domain resolution in the Linux system is probably not specified locally, usually, this situation is common. General modifications and domain name services related files such as / etc / hosts or /etc/resolv.conf, add a valid domain name server to the IP address of these files to solve the problem. 4. Host services turn off the service permission a more common problem is that you cannot log in to the host to perform some features, that is, you can ping a host on the network, but you can't execute some specific features of this host, such as FTP. WWW, etc. So, you must first understand whether the host provides FTP, WWW service. The most commonly seen is the Red Hat 7.x, FTP and Telnet have been default. At this time, you must have to modify the settings of several services to /etc/xinetd.d. The following is a Telnet as an example:
# vi /etc/xinetd.d/telnet
Service telnet {
Disable = yes
Flags = Reuse
Socket_type = stream
Wait = NO
User = root
Server = /usr/sbin/in.telnetd
LOG_ON_FAILURE = UserID
}
Change disable = yes to disable = no to turn on the service. Then, use the /etc/rc.d/init.d/xinetd restart to activate the Telnet service. 5. Determine some of the service's permissions and ports Open If the Client PC To use the Server service, you have to check the permissions of each file or program, for example: /etc/hosts.allow is turned on, whether the mail server sets relay, httpd. Whether to open a PHP or MySQL service in Conf, or the feasibility of other related CGI programs, whether the FTP is open anonymous login, and whether each port has been opened. Use the command:
# netstat -a
You can detect if the port has been opened. Some commonly used port numbers are: FTP: 21; Telnet: 23; SMTP: 25; HTTP: 80; POP-3: 110; NetBIOS-SSN: 139; Squid: 3128; MySQL: 3306. Master OSI models, TCP / IP models, and related services, which are important for Linux network failure analysis and exclusion. When there is a thoroughly understanding of the OSI model, the fault diagnosis is easy. If you can configure some network detection tools, it is also very useful for network failure analysis and exclusion.