H3C设备之静态路由实验_路由 

C:\Documents and Settings\xiaofei>ping 10.1.1.2

Pinging 10.1.1.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 10.1.1.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\Documents and Settings\xiaofei>ping 192.168.3.2

Pinging 192.168.3.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.3.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\Documents and Settings\xiaofei>

PCA处于单独一个网段,想要访问PCB,通过路由转发数据跨网段需要做路由,此时可以使用静态路由来实现。

[RTA]ip route-static 192.168.3.0 255.255.255.0 10.1.1.2  指定目标网段以及下一跳出口

[RTB]ip route-static 192.168.2.0 255.255.255.0 10.1.1.1

此时RTA,B上都有对端网段的路由:

[h3c1]disp ip routing-table
Routing Tables: Public
        Destinations : 8        Routes : 8

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.1.1.0/24         Direct 0    0            10.1.1.1        S0/0/0
10.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0
10.1.1.2/32         Direct 0    0            10.1.1.2        S0/0/0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0
192.168.2.0/24      Direct 0    0            192.168.2.1     Eth0/1/0
192.168.2.1/32      Direct 0    0            127.0.0.1       InLoop0
192.168.3.0/24      Static 60   0            10.1.1.2        S0/0/0
 

[h3c2]disp ip routing-table
Routing Tables: Public
        Destinations : 7        Routes : 7

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.1.1.0/24         Direct 0    0            10.1.1.2        S0/0/0
10.1.1.1/32         Direct 0    0            10.1.1.1        S0/0/0
10.1.1.2/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.1/32        Direct 0    0            127.0.0.1       InLoop0
192.168.2.0/24      Static 60   0            10.1.1.1        S0/0/0
192.168.3.2/32      Direct 0    0            127.0.0.1       InLoop0
 

此时PCAPCB可以相互访问;

C:\Documents and Settings\xiaofei>ping 192.168.3.2

Pinging 192.168.3.2 with 32 bytes of data:

Reply from 192.168.3.2: bytes=32 time=1ms TTL=254
Reply from 192.168.3.2: bytes=32 time=1ms TTL=254
Reply from 192.168.3.2: bytes=32 time=3ms TTL=254
Reply from 192.168.3.2: bytes=32 time=1ms TTL=254

Ping statistics for 192.168.3.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 3ms, Average = 1ms
 

RTA试用扩展PING从源地址ping目标成功。
[h3c1]ping -a 192.168.2.1 192.168.3.2
  PING 192.168.3.2: 56  data bytes, press CTRL_C to break
    Reply from 192.168.3.2: bytes=56 Sequence=1 ttl=255 time=5 ms
    Reply from 192.168.3.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.3.2: bytes=56 Sequence=3 ttl=255 time=1 ms
    Reply from 192.168.3.2: bytes=56 Sequence=4 ttl=255 time=1 ms
    Reply from 192.168.3.2: bytes=56 Sequence=5 ttl=255 time=10 ms

  --- 192.168.3.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 1/7/20 ms

用路由追踪发现经过的路由到达目的网络。

C:\Documents and Settings\xiaofei>tracert 192.168.3.2

Tracing route to 192.168.3.2 over a maximum of 30 hops

  1    <1 ms    <1 ms    <1 ms  192.168.2.1
  2     1 ms    <1 ms    <1 ms  192.168.3.2

Trace complete.