Heim  >  Artikel  >  Datenbank  >  调谐mysql网络性能之调试工具篇

调谐mysql网络性能之调试工具篇

WBOY
WBOYOriginal
2016-06-07 16:19:24881Durchsuche

本文是介绍管理Linux系统网络性能技巧的文章,主要介绍了route、netstat、tcpdump三种网络管理测试工具的使用方法及其可实现的功能。 route 在配置网络时,要为机器指定接收数据包时该包要经过的路径。在Linux系统中,提供一个命令route,这个命令可以为ifco

  本文是介绍管理Linux系统网络性能技巧的文章,主要介绍了route、netstat、tcpdump三种网络管理测试工具的使用方法及其可实现的功能。

  route

  在配置网络时,要为机器指定接收数据包时该包要经过的路径。在Linux系统中,提供一个命令route,这个命令可以为ifconfig命令配置的网卡设置静态路由。这种设置工作通常在/etc/rc.d/rc.inet1中引入,在系统引导时进行。

  我们通过几个例子来说明如何使用route命令:

  route add -net 127.0.0.0

  这个命令将向路由表中添加一个指定地址或者网络的路由。注意此时网络为A类地址,掩码被设置为255.0.0.0,这个新添加的条目被连接到lo设备上。

  route add -net xxx.xxx.xxx.xxx netmask 255.255.255.0 dev eth0

  这个命令为IP地址为xxx.xxx.xxx.xxx的主机增加一个路由,它的网络掩码被设置为255.255.255.0。

  route del -net xxx.xxx.xxx.xxx

  此命令将删除xxx.xxx.xxx.xxx这个网络的路由。

  使用route命令还可以很方便地对整个网络的路由信息进行管理,其输出结果是网络的路由表。如下所示:

  -----------------------------------------------------------------

  [root@lee /root]#route

  Kernel IP routing table

  Destination Gateway Genmask Flags Metric Ref Use Iface

  10.10.8.224 * 255.255.255.255 UH 0 0 0 eth0

  10.10.8.0 * 255.255.255.0 U 0 0 0 eth0

  127.0.0.0 * 255.0.0.0 U 0 0 0 lo

  default dgc8.njupt.edu 0.0.0.0 UG 0 0 0 eth0

  default dgc8.njupt.edu 0.0.0.0 UG 1 0 0 eth0

  [root@lee /root]#

  -----------------------------------------------------------------

  输出结果中各个字段的含义是:

  ·Destination表示路由的目标IP地址。

  ·Gateway表示网关使用的主机名或者是IP地址。上面输出的"*"表示没有网关。

  ·Genmask表示路由的网络掩码。在把它与路由的目标地址进行比较之前,内核通过Genmask和数据包的IP地址进行按位"与"操作来设置路由。

  ·Flags是表示路由的标志。可用的标志及其意义是:U表示路由在启动,H表示target是一台主机,G表示使用网关,R表示对动态路由进行复位设置;D表示动态安装路由,M表示修改路由,!表示拒绝路由。

  ·Metric表示路由的单位开销量。

  ·Ref表示依赖本路由现状的其它路由数目。

  ·Use表示路由表条目被使用的数目。

  ·Iface表示路由所发送的包的目的网络。

  通过查看这些输出信息,我们就可以方便地管理网络的路由表了。

  netstat

  netstat命令是一个监控TCP/IP网络的非常有用的工具,它可以显示路由表、实际的网络连接以及每一个网络接口设备的状态信息。在计算机上执行netstat后,,其输出结果如下所示:

  -----------------------------------------------------------------

  [root@lee /root]#netstat

  Active Internet connections (w/o servers)

  Proto Recv-Q Send-Q Local Address Foreign Address State

  Active UNIX domain sockets (w/o servers)

  Proto RefCnt Flags Types State I-Node Path

  Unix 5 [ ] DGRAM 460 /dev/log

  Unix 0 [ ] STREAM CONNECTED 173 @00000014

  Unix 0 [ ] DGRAM 662

  Unix 0 [ ] DGRAM 631

  Unix 0 [ ] DGRAM 544

  Unix 0 [ ] DGRAM 484

  Unix 0 [ ] DGRAM 470

  [root@lee /root]#

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn