The solution of network fault in Linux operating system

Ma Nong Online 2021-01-21 13:39:41
solution network fault linux operating


When Linux operating system When a network failure occurs , It should start from the hardware and software of the system 、 Local and overall inspection , The following will be from several aspects for Linux When the operating system produces the network breakdown the solution carries on the elaboration .

<h2>
1、 Check the cable 、 network card </h2>
Go to the computer room to check whether both ends of the network cable are on , The normal server is always green , The switch's green light flashes to indicate that data is being transmitted .



By command ethtool ethX To check whether the link of a network card is physically connected . among ,speed Is the speed of the current network card , This is a Gigabit NIC ;Duplex Shows that the current network supports full duplex ;link detected Indicates the physical connection status of the current network card and network ,yes It's normal .
<blockquote>
<p>
Usually, the network speed and full / Half duplex state is automatically negotiated between host and network protocol provider .</p>
</blockquote>
<h2>
2、 After making sure the cable is connected , Let's look at the physical network card </h2>
ifconfig You can see the network card loaded successfully , use ethtool -i ethX You can see the NIC driver ,lspci You can see all the connections to pci Bus device ,lsmod Show all loaded modules , The successful module will also be loaded in /proc/modules It shows that .



In general , After loading the NIC successfully , use ifconfig You can see . If you can't find the network card , Then you should check whether the physical network card is connected to pci On the bus , If lspci If it cannot be detected, the network card may be broken .



Another case is that the NIC module is not loaded , Go first lspci Find the corresponding manufacturer and model in :Ethernet Controller, Reuse modprobe Try to load the correct module , such as modprobe3c509. If something goes wrong , The module does not exist . It's time to find the right module and recompile .

<h2>
3、 After the physical layer of network card has no problem , Let's look at the network card configuration </h2>
use ifconfig You can look at IP、 Mask and other information , Permanently modify network card information in /etc/sysconfig/network-scripts/ifcfg-ethX( There are some Linux The distribution doesn't have to be the file name , But the path is similar , It's in the upper layer network The file is modified hostname Of ) In file , This file is also put DNS The right place to be , Restart after modification network.

<h2>
4、 Check whether the routing table is correct </h2>
use route-n Look at the kernel routing table , adopt route Command to view kernel routing , After checking whether the specific network card is connected to the route of the target network, you can try PING gateway , Check the connection with the gateway . If you can't ping Through gateway , Maybe the gateway limits ICMP Packet or switch settings .



A very common problem : The two network cards provide intranet and extranet services respectively , If the default gateway is intranet card , So Internet services are inaccessible . At this time, you need to delete and add the default gateway , use route delete/ add default gw command .
<h2>
5、 see DNS</h2>
stay /etc/resolve.conf The specified domain name server can be seen in the file , But you can't modify this file here , It will be automatically generated after modification networkManager file , So I'm going etc/sysconfig/network-scripts/ifcfg-ethX Revision in China .

<h2>
6、 Check whether the route is smooth with the host </h2>
When a remote host cannot be connected , How to track the route .traceroute Command is a tool to track the gateway from the sending host to the target host .



traceroute The common parameter options of the command are as follows :
<ul>
<li>
-i Specify network interface , Useful for multiple network interfaces . such as -i eth1 or -i ppp1 etc. .</li>
<li>
-m Set the maximum lifetime used in the outgoing probe test package to max-ttl Forward , The default value is 30 Time .</li>
<li>
-n Show IP Address , Don't look up the hostname . When DNS This parameter is often used when it doesn't work ; It can also be ruled out during the examination DNS The problem of .</li>
</ul>


Record by serial number from 1 Start , Every record is a jump , Each hop represents a gateway , We see three times per line , The unit is ms, In fact, that is -q Default parameters . After the probe packet sends three packets to each gateway , The return time of the gateway response . asterisk “*” The firewall is blocked ICMP The return information of .
<h2>
7、 Check whether the service port of the remote host is open </h2>
use telnet and nmap To check , If you don't have these two tools, install them yourself yum. For example, we need to see Baidu's 80 Is the port open , state STATE yes open Open for indication , If it is filtered It means it is filtered by firewall .



For example, the second 1 Column is the socket communication protocol , The first 2 Column and the first 3 Column shows the receive and send queues , The first 4 Column is the local address that the host is listening to , Reflects the network that the socket listens to ; The first 6 Column shows the status of the current socket , The last column shows the process that opened the port .

That's all Liangxu tutorial website For all of you Linux Related knowledge .

版权声明
本文为[Ma Nong Online]所创,转载请带上原文链接,感谢
https://javamana.com/2021/01/20210121133802513l.html

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云