linux路由表功能解析.doc_第1页
linux路由表功能解析.doc_第2页
linux路由表功能解析.doc_第3页
linux路由表功能解析.doc_第4页
linux路由表功能解析.doc_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、linux路由表功能解析linux路由表功能解析分类:网络 2013-11-16 18:231268 人阅读评论 (0) 收藏举报网络局域网路由器linux路由表功能解析本文 ,简单描述一下路由的作用.简单来说 ,路由器就是一个公交站台,公交站台上面有很多路公交.每条线路公交车又有很多站台(路由器 ),你就会选择最近的一条公交出行方案,当然啦 ,站牌上面的路线是会经常更新,更新的事 ,有当地部门更新 .这就是路由 .一台电脑主机有路由表 , 路由器也有路由表 ,一般来说 ,一台主机电脑如果只有一个网卡的话 ,应该会有最少两条路由信息 ,一条是公网路由 ,一条是局域网路由 (它是不会经过路由器的

2、路由表的 ,因为它走的是链路层 ,所以可以解析我们在局域网内传数据 ,速度是很快的 ).测试环境:主机 (linux):ip:192.168.168.1.119netmask:255.255.0.0另一台主机 (xp):ip:192.168.1.133netmask:255.255.0.0网关ip:192.168.0.3netmask: 255.255.248.0一 , 我们可以:查看一下路由表.(route命令)user:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFlags Metric RefUse Ifa

3、cedefault192.168.0.30.0.0.0UG000 eth0/ 公网路由信息/U Up, G Gateway, H Host192.168.0.0*255.255.0.0U000 eth0/局域网路由信息.user:dvr_linuxFlags可能出现的标志有:U (route is up)路由正常H (target is a host)主机路由G (use gateway)使用网关的间接路由R (reinstate route for dynamic routing)为动态选路恢复路由D (dynamically installed by daemon orredirect)该

4、路由由选路进程或重定向动态创建M (modified from routing daemon orrederict)该路由已由选路进程或重定向修改! (reject route)阻塞路由1.1 测试公网路由 (切换到 rootroute/打印路由表Kernel IP routing tableDestinationGatewayFlags Metric RefUse Iface用户下 ):root:dvr_linuxGenmaskdefault192.168.0.30.0.0.0UG000 eth0192.168.0.0*255.255.0.0U000 eth0root:dvr_linux p

5、ing 8.8.8.8/ 8.8.8.8是 google公司的 dns.PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.64 bytes from 8.8.8.8: icmp_req=2 ttl=48 time=10.4 ms64 bytes from 8.8.8.8: icmp_req=3 ttl=48 time=10.0 ms/正常C- 8.8.8.8 ping statistics -3 packets transmitted, 2 received, 33% packet loss, time 2013msrtt min/avg/max/mdev

6、 = 10.024/10.222/10.421/0.222 msroot:dvr_linux route del default dev eth0/删除默认路由 ,也就公网路由 ,因为有网关 .root:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFlags Metric RefUse Iface192.168.0.0*255.255.0.0U000 eth0root:dvr_linux ping 8.8.8.8connect: Network is unreachable/ping不通 ,没找到路由信息 .数据

7、包出不去 .root:dvr_linux route add default dev eth0/增加默认路由,没加网关 . root:dvr_linux route Kernel IP routing tableDestinationGatewayGenmaskFlags Metric RefUse Ifacedefault*0.0.0.0U000 eth0192.168.0.0*255.255.0.0U000 eth0root:dvr_linux ping 8.8.8.8PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.From 192.168.1.11

8、9 icmp_seq=1 Destination HostUnreachable/ping不通 ,找到路由信息 .但是找不到去 8.8.8.8 胡线路 ,数据包出不去 .From 192.168.1.119 icmp_seq=2 Destination HostUnreachableFrom 192.168.1.119 icmp_seq=3 Destination HostUnreachableC- 8.8.8.8 ping statistics -5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4010

9、mspipe 3root:dvr_linux route del default dev eth0root:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFlags Metric RefUse Iface192.168.0.0*255.255.0.0000 eth0Uroot:dvr_linux route add default gw 192.168.0.3 dev eth0root:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFl

10、ags Metric RefUse Ifacedefault192.168.0.30.0.0.0UG000 eth0192.168.0.0*255.255.0.0U000 eth0root:dvr_linux ping 8.8.8.8PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.64 bytes from 8.8.8.8: icmp_req=1 ttl=48 time=11.0 ms /重新添加带网关的路由信息后 ,又能 ping 通了 . 64 bytes from 8.8.8.8: icmp_req=3 ttl=48 time=10.0 ms 64

11、 bytes from 8.8.8.8: icmp_req=4 ttl=48 time=10.3 ms C- 8.8.8.8 ping statistics -4 packets transmitted, 3 received, 25% packet loss, time 3015msrtt min/avg/max/mdev = 10.037/10.496/11.071/0.445 ms root:dvr_linux 1.2 测试局域网路由 (切换到 root 用户下):root:dvr_linux route Kernel IP routing tableDestinationGateway

12、GenmaskFlags Metric RefUse Ifacedefault192.168.0.30.0.0.0UG000 eth0192.168.0.0*255.255.0.0U000 eth0root:dvr_linux ping 192.168.1.133PING 192.168.1.133 (192.168.1.133) 56(84) bytes of data.64 bytes from 192.168.1.133: icmp_req=1 ttl=64 time=2.13 ms64 bytes from 192.168.1.133: icmp_req=2 ttl=64time=0.

13、450 ms/正常通过 .C- 192.168.1.133 ping statistics -2 packets transmitted, 2 received, 0% packet loss, time 1003msrtt min/avg/max/mdev = 0.450/1.290/2.131/0.841 ms root:dvr_linux route del -net 192.168.0.0/16 dev eth0 /删除局域网路由root:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFlags Metri

14、c RefUse Ifacedefault192.168.0.30.0.0.0UG000 eth0root:dvr_linux ping 192.168.1.133PING 192.168.1.133 (192.168.1.133) 56(84) bytes of data. 64 bytes from 192.168.1.133: icmp_req=1 ttl=64 time=5.06 msFrom 192.168.0.3: icmp_seq=1 Redirect Host(Newnexthop: 192.168.1.133)/数据包通过了默认路由信息发到了路由器,再查路由器的路由表找到了1

15、92.168.1.133的路由 .再由网关发回来给192.168.1.133了 .64 bytes from 192.168.1.133: icmp_req=2 ttl=64time=0.477 ms64 bytes from 192.168.1.133: icmp_req=3 ttl=64 time=0.302 ms64 bytes from 192.168.1.133: icmp_req=4 ttl=64 time=0.285 ms64 bytes from 192.168.1.133: icmp_req=5 ttl=64 time=0.478 ms64 bytes from 192.16

16、8.1.133: icmp_req=6 ttl=64time=0.408 msC- 192.168.1.133 ping statistics -6 packets transmitted, 6 received, 0% packet loss, time 5002msrtt min/avg/max/mdev = 0.285/1.169/5.066/1.744 msroot:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFlags Metric RefUse Ifacedefault192.168.0.30.0.0

17、.0UG000 eth0root:dvr_linux route del defaulteth0/把默认路由都删掉的话,这就完全找不到路由信息了,也就是没网络了 .root:dvr_linux routeKernel IP routing tableDestinationGatewayFlags Metric RefUse IfaceGenmaskroot:dvr_linux ping 192.168.1.133connect: Network is unreachableroot:dvr_linux在这个时候 ,192.168.1.133的 xp 主机去 ping 192.168.1.119

18、的话 .也就 ping不通的 .C:Documents andSettingsAdministrator>ping 192.168.1.119 -tPinging192.168.1.119 with 32 bytes of data:Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.

19、Request timed out.Request timed out.Request timed out.Request timed out.Request timed out.Request timed out. root:dvr_linux service networkingrestart/重启一下网络 .warn Running /etc/init.d/networking restart is deprecatedbecause it may not re-enable some interfaces . (warning). Reconfiguring network inter

20、faces.RTNETLINKanswers: No such processdone.root:dvr_linuxroot:dvr_linux routeKernel IP routing tableDestinationGatewayGenmaskFlags Metric RefUse Ifacedefault192.168.0.30.0.0.0000 eth0UG192.168.0.0*255.255.0.0U000 eth0root:dvr_linux在这个时候 ,192.168.1.133 的 xp 主机去ping 192.168.1.119 的话 .网络恢复了 .C:Documents and SettingsAdministrator>ping 192

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论