实验10 IP路由基础

实验任务一 查看路由表

  1. 建立物理连接

  2. 在路由器上查看路由表
    [RTA]display ip routing-table

Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0//默认路由

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0//环回地址直连路由
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0//环回地址直连路由
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0

255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

给RTA RTB配置ip地址:
[RTA-GigabitEthernet0/0]ip address 192.168.0.1 255.255.255.0
[RTA-Serial1/0]ip address 192.168.1.1 255.255.255.0
显示RTA ip路由表

[RTA]display ip routing-table

Destinations : 17 Routes : 17

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.0/24 Direct 0 0 192.168.0.1 GE0/0
192.168.0.0/32 Direct 0 0 192.168.0.1 GE0/0
192.168.0.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.0.255/32 Direct 0 0 192.168.0.1 GE0/0
192.168.1.0/24 Direct 0 0 192.168.1.1 Ser1/0
192.168.1.0/32 Direct 0 0 192.168.1.1 Ser1/0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.2/32 Direct 0 0 192.168.1.2 Ser1/0
192.168.1.255/32 Direct 0 0 192.168.1.1 Ser1/0

224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

由上面的两个路由表对比可知:

  1. 直连路由是链路层协议发现的路由,链路层协议up后,路由器会将其加入路由表中,如果我们关闭链路层协议,则相关直连路由也将消失。
  2. 假如是以太网线连接,不会像串口线连接那样,直连路由会多一个目的地址是对端的ip地址。
  3. 直连路由,目的地址为该网段的路由,也会有目的地址为该主机的路由。

Shutdown接口:
[RTA-Serial1/0]shutdown
[RTA-Serial1/0]%Apr 20 16:44:39:556 2018 H3C IFNET/5/LINK_UPDOWN: Line protocol state on the interface Serial1 /0 changed to down.//链路协议关闭
%Apr 20 16:44:39:556 2018 H3C IFNET/3/PHY_UPDOWN: Physical state on the interface Serial1/0 changed to down.//链路端口关闭

实验任务二:静态路由配置

  1. PC配置ip地址,以及网关

  2. 配置静态路由
    [RTA]ip route-static 192.168.2.0 24 192.168.1.2
    [RTB]ip route-static 192.168.0.0 24 192.168.1.1
    PC间互相ping可以互通。

注意:
静态路由,尤其是默认路由
[RTA]ip route-static 0.0.0.0 3 s1/0
[RTB]ip route-static 0.0.0.0 3 s1/0
这种情况会导致环路现象,报文在两个路由器之间循环转发,直到TTL到0被丢弃。

原文地址:https://www.cnblogs.com/akiz/p/11144489.html