networkingdebugging

如何系统地find在Linux中的互联网丢失背后的罪魁祸首?

我知道

即要下载文件/访问网页/使用SSH /等,有几个层次的交stream:应用程序,运输,互联网,链接( 维基百科 )

我不知道

  • 每个这些层(不包括application层)如何映射到Linux中的程序/组件?
  • 如何有效地检查每个组件?如果它们正常工作?
  • 以何种顺序来检查它们

我的目标是

有(合理)简单的系统来追踪问题。 在伪代码,它看起来像

  for(component in A..Z) // from hardwarefailure,missing drivers to configuration in /etc/network/interfaces { if cmd_to_check(component).output == _OK_ then continue // problem is 100% not here, continue with next item else break // problem is 100% with current component } do_adhoc_reseach_on(item) fix(item) 

我想把重点放在我的机器上发生的问题,而不是远程或中间服务器的问题

笔记

如果有差异

  • 在分布之间, debian是首选
  • 线与无线之间,那么电线是首选
  • 在任何其他方面之间,那么大多数标准是优选的

如果可用的免费资源将是首选

预先感谢任何答案和/或参考

testingInternet连接的步骤:

  • testing以太网链路是否启动并具有预期的协商速度和双工: ethtool eth0
  • testing下一跳(邻居路由器)是否可用: ping -c 3 next_hop_ip
  • testing一个众所周知的远程站点是否可用(例如ping Google DNS): ping -c 3 8.8.8.8
  • testingDNS是否工作: host www.google.com
  • testing一个网站是否回答: wget -O - http://www.google.com
  • 如果工作站直接连接,即使configuration了防火墙,也应该能够使用arp来查看它们: sudo arping workstation_ip
  • testing是否可以从服务器访问ping workstation_ipping workstation_ip

当你失败了一步,试着去找下一个之前发生的事情。