【H3C模拟器】H3C静态路由配置实验

H3C版本 HCL_V2.1.0_Setup
VirtualBox版本 VirtualBox-4.2.4-81684-Win
(版本需匹配才可以正常使用H3C)

一、实验目的

1.了解静态路由的实验原理
2.掌握静态路由的配置

二、实验原理

  1. 静态路由定义
    要想实现全网通信,也就是网络中的任意两个节点都能通信,这就要求每个路由器的路由表中必须有到所有网段的路由。对于路由器来说,它只知道自己直连的网段,对于没有直连的网段,需要管理员人工添加到这些网段的路由。管理员人工添加到某个网段如何转发,就是静态路由。
  2. 静态路由配置
    要想实现全网络通信,必须添加路由条目。
    AR1路由器直连A、B两个网段,C、D网段没有直连,则需要添加到C、D网段的路由。
    ip route-static 到达的目标网络号 子网掩码 下一跳的路由器接口地址
    ip route-static 172.16.1.0 24 172.16.0.2

三、实验拓扑图

【H3C模拟器】H3C静态路由配置实验_第1张图片

路由器 端口 端口ip
RTA G0/0 192.168.1.1/24
G0/1 192.168.2.1/24
RTB G0/0 192.168.2.2/24
G0/1 192.168.3.1/24
RTC G0/0 192.168.3.2/24
G0/1 192.168.4.1/24
SWA G1/0/1 192.168.4.2/24
G1/0/2 192.168.5.1/24

RTA路由器配置

[H3C]int g0/0
[H3C-GigabitEthernet0/0]ip address 192.168.1.1 24
[H3C-GigabitEthernet0/0]int g0/1
[H3C-GigabitEthernet0/1]ip address 192.168.2.1 24
[H3C-GigabitEthernet0/1]quit
[H3C]ip route-static 192.168.3.0 24 192.168.2.2
[H3C]ip route-static 192.168.4.0 24 192.168.2.2
[H3C]ip route-static 192.168.5.0 24 192.168.2.2

[H3C]display ip routing-table
Destinations : 19       Routes : 19
Destination/Mask   Proto   Pre Cost        NextHop         Interface
……
192.168.1.0/24     Direct  0   0           192.168.1.1     GE0/0
192.168.1.0/32     Direct  0   0           192.168.1.1     GE0/0
192.168.1.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.1.255/32   Direct  0   0           192.168.1.1     GE0/0
192.168.2.0/24     Direct  0   0           192.168.2.1     GE0/1
192.168.2.0/32     Direct  0   0           192.168.2.1     GE0/1
192.168.2.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.255/32   Direct  0   0           192.168.2.1     GE0/1
192.168.3.0/24     Static  60  0           192.168.2.2     GE0/1
192.168.4.0/24     Static  60  0           192.168.2.2     GE0/1
192.168.5.0/24     Static  60  0           192.168.2.2     GE0/1
……

RTB路由器配置

[H3C]int g0/0
[H3C-GigabitEthernet0/0]ip address 192.168.2.2 24
[H3C-GigabitEthernet0/0]int g0/1
[H3C-GigabitEthernet0/1]ip address 192.168.3.1 24
[H3C-GigabitEthernet0/1]quit
[H3C]ip route-static 192.168.4.0 24 192.168.3.2
[H3C]ip route-static 192.168.5.0 24 192.168.3.2
[H3C]ip route-static 192.168.1.0 24 192.168.2.1

[H3C]display ip routing-table

Destinations : 19       Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
……
192.168.1.0/24     Static  60  0           192.168.2.1     GE0/0
192.168.2.0/24     Direct  0   0           192.168.2.2     GE0/0
192.168.2.0/32     Direct  0   0           192.168.2.2     GE0/0
192.168.2.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.255/32   Direct  0   0           192.168.2.2     GE0/0
192.168.3.0/24     Direct  0   0           192.168.3.1     GE0/1
192.168.3.0/32     Direct  0   0           192.168.3.1     GE0/1
192.168.3.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.3.255/32   Direct  0   0           192.168.3.1     GE0/1
192.168.4.0/24     Static  60  0           192.168.3.2     GE0/1
192.168.5.0/24     Static  60  0           192.168.3.2     GE0/1
……

RTC路由器配置

[H3C]int g0/0
[H3C-GigabitEthernet0/0]ip address 192.168.3.2 24
[H3C-GigabitEthernet0/0]int g0/1
[H3C-GigabitEthernet0/1]ip address 192.168.4.1 24
[H3C-GigabitEthernet0/1]quit
[H3C]ip route-static 192.168.1.0 24 192.168.3.1
[H3C]ip route-static 192.168.2.0 24 192.168.3.1
[H3C]ip route-static 192.168.5.0 24 192.168.4.3

[H3C]display ip routing-table

Destinations : 19       Routes : 20

Destination/Mask   Proto   Pre Cost        NextHop         Interface
……
192.168.1.0/24     Static  60  0           192.168.3.1     GE0/0
192.168.2.0/24     Static  60  0           192.168.3.1     GE0/0
192.168.3.0/24     Direct  0   0           192.168.3.2     GE0/0
192.168.3.0/32     Direct  0   0           192.168.3.2     GE0/0
192.168.3.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.3.255/32   Direct  0   0           192.168.3.2     GE0/0
192.168.4.0/24     Direct  0   0           192.168.4.1     GE0/1
192.168.4.0/32     Direct  0   0           192.168.4.1     GE0/1
192.168.4.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.4.255/32   Direct  0   0           192.168.4.1     GE0/1
192.168.5.0/24     Static  60  0           192.168.4.2     GE0/1
……

SWA路由器配置

[H3C]vlan 10
[H3C-vlan10]port g1/0/1
[H3C-vlan10]int vlan 10
[H3C-Vlan-interface10]ip address 192.168.4.2 24
[H3C-Vlan-interface10]vlan 20
[H3C-vlan20]port g1/0/2
[H3C-Vlan-interface20]ip address 192.168.5.1 24
[H3C-Vlan-interface20]quit
[H3C]ip route-static 192.168.1.0 24 192.168.4.1
[H3C]ip route-static 192.168.2.0 24 192.168.4.1
[H3C]ip route-static 192.168.3.0 24 192.168.4.1
[H3C]int g1/0/1
[H3C-GigabitEthernet1/0/1]port link-type access
[H3C-GigabitEthernet1/0/1]port access vlan 10
[H3C-GigabitEthernet1/0/1]int g1/0/2
[H3C-GigabitEthernet1/0/2]port link-type access
[H3C-GigabitEthernet1/0/2]port access vlan 20

[H3C-GigabitEthernet1/0/2]dis cu int g1/0/1
#
interface GigabitEthernet1/0/1
 port link-mode bridge
 port access vlan 10
 combo enable fiber
#
return
[H3C-GigabitEthernet1/0/2]dis cu int  g1/0/2
#
interface GigabitEthernet1/0/2
 port link-mode bridge
 port access vlan 20
 combo enable fiber
#
return
PC ip
PC1 192.168.1.88
PC2 192.168.5.88
<H3C>ping 192.168.5.88
Ping 192.168.5.88 (192.168.5.88): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.5.88: icmp_seq=0 ttl=251 time=12.000 ms
56 bytes from 192.168.5.88: icmp_seq=1 ttl=251 time=8.000 ms
56 bytes from 192.168.5.88: icmp_seq=2 ttl=251 time=7.000 ms
56 bytes from 192.168.5.88: icmp_seq=3 ttl=251 time=6.000 ms
56 bytes from 192.168.5.88: icmp_seq=4 ttl=251 time=7.000 ms
<H3C>ping 192.168.1.88
Ping 192.168.1.88 (192.168.1.88): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.1.88: icmp_seq=0 ttl=251 time=8.000 ms
56 bytes from 192.168.1.88: icmp_seq=1 ttl=251 time=5.000 ms
56 bytes from 192.168.1.88: icmp_seq=2 ttl=251 time=8.000 ms
56 bytes from 192.168.1.88: icmp_seq=3 ttl=251 time=8.000 ms
56 bytes from 192.168.1.88: icmp_seq=4 ttl=251 time=8.000 ms
  1. 路由器只关心到某个网段如何转发数据包,因此在路由器上添加路由,必须是到某个网段(子网)的路由,不能添加到某个特定地址的路由。添加到一个IP地址的路由,主机位会自动归零。
  2. 路由器点到点链路的另一种路条目写法
    ip route-static 到达的目标网络号 子网掩码 下一跳的路由器接口
    ip route-static 172.16.1.0 24 E0/0
  3. H3C路由器相关操作命令
    1)显示全部路由display ip routing-table
    2)只显示静态路由display ip routing-table protocol static
    3)删除静态路由no ip route-static 172.16.1.0 24 172.16.0.2
    undo ip route-static 172.16.1.0 24 172.16.0.2
  4. trunk口用于同vlan不同交换机间通信

你可能感兴趣的:(路由和交换技术)