• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

04-三层技术配置指导

目录

02-静态路由配置

本章节下载 02-静态路由配置  (144.04 KB)

docurl=/cn/Service/Document_Software/Document_Center/Wlan/WA/WA2600/Configure/Operation_Manual/H3C_WX_CG-(R1508P11)-6W106/04/201803/1072655_30005_0.htm

02-静态路由配置


1 静态路由

1.1  静态路由简介

静态路由是一种特殊的路由,由管理员手工配置。当网络结构比较简单时,只需配置静态路由就可以使网络正常工作。

静态路由不能自动适应网络拓扑结构的变化。当网络发生故障或者拓扑发生变化后,必须由网络管理员手工修改配置。

1.2  配置静态路由

1.2.1  配置准备

在配置静态路由之前,需完成以下任务:

·     配置相关接口的物理参数

·     配置相关接口的链路层属性

·     配置相关接口的IP地址

1.2.2  配置静态路由

表1-1 配置静态路由

操作

命令

说明

进入系统视图

system-view

-

配置静态路由

ip route-static dest-address { mask | mask-length } next-hop-address [ preference preference-value ]

必选

缺省情况下,没有配置静态路由

 

说明

如果静态路由中指定的下一跳地址被配置为本地接口的IP地址,那么静态路由不会生效。

 

1.3  静态路由显示和维护

在完成上述配置后,在任意视图下执行display命令查看静态路由配置的运行情况并检验配置结果。

表1-2 静态路由显示和维护

操作

命令

查看静态路由表信息

display ip routing-table [ verbose ] [ | { begin | exclude | include } regular-expression ]

 

说明

本命令的详细情况请参见“三层技术IP路由命令参考”中的“IP路由基础”。

 

1.4  静态路由典型配置举例

1.4.1  静态路由基本功能配置举例

1. 组网需求

Switch A、Switch B和AP各接口及主机的IP地址和掩码如图1-1所示。要求Switch A、Switch B和AP之间配置IPv4静态路由后,Host 和Client之间能够互通。

2. 组网图

图1-1 静态路由配置组网图

 

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置静态路由

# 在Switch A上配置缺省路由。

<SwitchA> system-view

[SwitchA] ip route-static 0.0.0.0 0.0.0.0 1.1.4.2

# 在Switch B上配置静态路由。

<SwitchB> system-view

[SwitchB] ip route-static 1.1.2.0 255.255.255.0 1.1.4.1

# 在AP上配置缺省路由。

<AP> system-view

[AP] ip route-static 0.0.0.0 0.0.0.0 1.1.3.3

(3)     配置主机

配置Host 的缺省网关为1.1.2.3,Client的缺省网关为1.1.3.1,具体配置过程略。

(4)     检查配置结果

# 显示Switch A的IP路由表。

[SwitchA] display ip routing-table

Routing Tables: Public                                                         

         Destinations : 7        Routes : 7                                    

                                                                                

Destination/Mask    Proto  Pre  Cost         NextHop         Interface         

                                                                               

0.0.0.0/0           Static 60   0            1.1.4.2         Vlan2              

1.1.2.0/24          Direct 0    0            1.1.2.3         Vlan3             

1.1.2.3/32          Direct 0    0            127.0.0.1       InLoop0           

1.1.4.0/30          Direct 0    0            1.1.4.1         Vlan2             

1.1.4.1/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           

# 显示Switch B的IP路由表。

[SwitchB] display ip routing-table

Routing Tables: Public                                                         

         Destinations : 7        Routes : 7                                    

                                                                                

Destination/Mask    Proto  Pre  Cost         NextHop         Interface         

                                                                               

1.1.2.0/24          Static 60   0            1.1.4.1         Vlan2             

1.1.3.0/24          Direct 0    0            1.1.3.3         Vlan1             

1.1.3.3/32          Direct 0    0            127.0.0.1       InLoop0           

1.1.4.0/30          Direct 0    0            1.1.4.2         Vlan2              

1.1.4.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           

# 显示AP的IP路由表。

[AP] display ip routing-table

Routing Table :                                                                

         Destinations : 5        Routes : 5                                    

                                                                               

Destination/Mask    Proto  Pre  Cost         NextHop         Interface         

                                                                               

0.0.0.0/0           Static 60   0            1.1.3.3         Vlan1             

1.1.3.0/24          Direct 0    0            1.1.3.1         Vlan1             

1.1.3.1/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           

# 在Host 上使用ping命令验证Client是否可达(假定主机安装的操作系统为Windows XP)。

C:\Documents and Settings\Administrator>ping 1.1.3.2

 

Pinging 1.1.3.2 with 32 bytes of data:

 

Reply from 1.1.3.2: bytes=32 time=1ms TTL=125

Reply from 1.1.3.2: bytes=32 time=1ms TTL=125

Reply from 1.1.3.2: bytes=32 time=1ms TTL=125

Reply from 1.1.3.2: bytes=32 time=1ms TTL=125

 

Ping statistics for 1.1.3.2:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 1ms, Maximum = 1ms, Average = 1ms

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们