华为S9300上应用基于报文长度的策略路由

组网要求:

       对大小为64~1400字节的报文设置150.1.1.2作为下一跳地址。

       对大小为1401~1500字节的报文设置151.1.1.2作为下一跳地址。

       所有其它长度的报文都按基于目的地址的方法路由。

基于报文长度的策略路由配置思路如下:

      首先指定各接口的IP地址。

      配置动态路由协议,此处使用RIP协议。

      配置策略路由,包括匹配规则和动作。

操作步骤:

配置S9300A

# 配置各接口的IP地址。

<Quidway> system-view
[Quidway] sysname S9300A
[S9300A] vlan batch 10 to 11
[S9300A] interface gigabitethernet 1/0/1
[S9300A-GigabitEthernet1/0/1] port hybrid tagged vlan 10
[S9300A-GigabitEthernet1/0/1] quit
[S9300A] interface vlanif 10
[S9300A-Vlanif10] ip address 150.1.1.1 255.255.255.0
[S9300A-Vlanif10] quit
[S9300A] interface gigabitethernet 1/0/2
[S9300A-GigabitEthernet1/0/2] port hybrid tagged vlan 11
[S9300A-GigabitEthernet1/0/2] quit
[S9300A] interface vlanif 11
[S9300A-Vlanif11] ip address 151.1.1.1 255.255.255.0
[S9300A-Vlanif11] quit

# 配置RIP路由协议。

[S9300A] rip
[S9300A-rip-1] network 150.1.0.0
[S9300A-rip-1] network 151.1.0.0
[S9300A-rip-1] quit

# 配置名称为policy1的策略路由。

[S9300A] policy-based-route policy1 permit node 10
[S9300A-policy-based-route-policy1-10] if-match packet-length 64 1400
[S9300A-policy-based-route-policy1-10] apply ip-address next-hop 150.1.1.2
[S9300A-policy-based-route-policy1-10] quit
[S9300A] policy-based-route policy1 permit node 20
[S9300A-policy-based-route-policy1-20] if-match packet-length 1401 1500
[S9300A-policy-based-route-policy1-20] apply ip-address next-hop 151.1.1.2
[S9300A-policy-based-route-policy1-20] quit

# 使能策略路由。

[S9300A] ip local policy-based-route policy1

配置S9300B

<Quidway> system-view
[Quidway] sysname S9300B
[S9300B] vlan batch 10 11
[S9300B] interface gigabitethernet 1/0/1
[S9300B-GigabitEthernet1/0/1] port hybrid tagged vlan 10
[S9300B-GigabitEthernet1/0/1] quit
[S9300B] interface vlanif 10
[S9300B-Vlanif10] ip address 150.1.1.2 255.255.255.0
[S9300B-Vlanif10] quit
[S9300B] interface gigabitethernet 1/0/2
[S9300B-GigabitEthernet1/0/2] port hybrid tagged vlan 11
[S9300B-GigabitEthernet1/0/2] quit
[S9300B] interface vlanif 11
[S9300B-Vlanif11] ip address 151.1.1.2 255.255.255.0
[S9300B-Vlanif11] quit
[S9300B] rip
[S9300B-rip-1] network 10.0.0.0
[S9300B-rip-1] network 150.1.0.0
[S9300B-rip-1] network 151.1.0.0
[S9300B-rip-1] quit

验证配置结果

# 在S9300A用debugging ip policy-based-route命令监视策略路由。

<S9300A> debugging ip policy-based-route
<S9300A> terminal debugging
<S9300A> terminal monitor

# 从S9300A的GE2/0/0接口直连网段一台主机Ping S9300B的Loopback0接口,并将报文数据字段长度设为80字节。

C:\&gt; ping -l 80 10.1.1.1
Pinging 10.1.1.1 with 80 bytes of data:
Reply from 10.1.1.1: bytes=80 time<6ms TTL=255
Reply from 10.1.1.1: bytes=80 time&lt;1ms TTL=255
Reply from 10.1.1.1: bytes=80 time&lt;10ms TTL=255
Reply from 10.1.1.1: bytes=80 time&lt;18ms TTL=255
Ping statistics for 10.1.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 18ms, Average = 8ms

# S9300A上显示的策略路由信息如下:


*0.3417920 S9300A PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 150.1.1.2
*0.3418310 S9300A PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 150.1.1.2
*0.3418850 S9300A PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 150.1.1.2
*0.3419370 S9300A PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 150.1.1.2

# 以上策略路由信息显示,S9300A在接收到报文后,根据策略路由确定的下一跳为150.1.1.2,也就是说将报文从接口VLANIF10转发出去。

# 从S9300A的GE2/0/0接口直连网段一台主机Ping S9300B的Loopback0接口,并将报文数据字段长度设为1450字节。

C:\> ping -l 1450 10.1.1.1
Pinging 10.1.1.1 with 1450 bytes of data:
Reply from 10.1.1.1: bytes=1450 time&lt;18ms TTL=255
Reply from 10.1.1.1: bytes=1450 time&lt;140ms TTL=255
Reply from 10.1.1.1: bytes=1450 time&lt;5ms TTL=255
Reply from 10.1.1.1: bytes=1450 time&lt;15ms TTL=255
Ping statistics for 10.1.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 5ms, Maximum = 140ms, Average = 44ms

# S9300A上显示的策略路由信息如下:

*0.3785670 S9300 PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 151.1.1.2
*0.3786680 S9300 PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 151.1.1.2
*0.3787200 S9300 PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 151.1.1.2
*0.3787730 S9300 PBR/7/POLICY-ROUTING:IP Policy routing success : next-hop : 151.1.1.2

# 以上策略路由信息显示,S9300A在接收到报文后,根据策略路由确定的下一跳为151.1.1.2,也就是说将报文从接口VLANIF11转发出去

你可能感兴趣的:(职场,路由,休闲,策略路由,华为S9300)