21.6. Routing

简介:

21.6.1. RIP

rip 1
 version 2
 network 192.168.20.0
 network 192.168.2.0
			

21.6.2. OSPF

#
ospf 1
 area 0.0.0.1
  network 192.168.40.240 0.0.0.15
  network 192.168.2.0 0.0.0.255
  network 192.168.3.0 0.0.0.255
  network 192.168.4.0 0.0.0.255
  network 192.168.5.0 0.0.0.255
  network 192.168.6.0 0.0.0.255
  network 192.168.7.0 0.0.0.255
  network 192.168.8.0 0.0.0.255
  network 192.168.9.0 0.0.0.255
  network 172.16.0.0 0.0.0.255
  network 192.168.30.0 0.0.0.255
  network 172.16.100.0 0.0.0.255
#
			

21.6.3. Static

#
 ip route-static 0.0.0.0 0.0.0.0 192.168.1.1 preference 10 description TC
 ip route-static 0.0.0.0 0.0.0.0 192.168.20.1 preference 20 description UC
 ip route-static 4.4.4.4 255.255.255.255 192.168.40.254 description google dns
 ip route-static 8.8.8.8 255.255.255.255 192.168.40.254 description google dns
 ip route-static 64.4.61.215 255.255.255.255 192.168.40.254
 ip route-static 74.125.71.94 255.255.255.255 192.168.40.254
 ip route-static 192.168.20.0 255.255.255.0 192.168.20.1 description UC
 ip route-static 192.168.30.112 255.255.255.255 192.168.30.254
 ip route-static 203.208.46.146 255.255.255.255 192.168.40.254
#
			

浮动路由

 ip route-static 0.0.0.0 0.0.0.0 192.168.1.1 preference 10 description TC
 ip route-static 0.0.0.0 0.0.0.0 192.168.20.1 preference 20 description UC
			

21.6.4. 策略路由

案例一

acl number 3000
 rule 0 permit ip source 192.168.2.1 0
acl number 3001
 rule 0 permit ip source 192.168.6.0 0.0.0.255
#
traffic classifier 2 operator or
 if-match acl 3000
traffic classifier 1 operator and
 if-match acl 3001
#
traffic behavior 1
 redirect next-hop 192.168.40.254
#
qos policy 2
 classifier 2 behavior 1
qos policy 1
 classifier 1 behavior 1
#
interface GigabitEthernet1/0/11
 qos apply policy 1 inbound
#
interface GigabitEthernet1/0/12
 qos apply policy 2 inbound
			

取消策略路由

interface GigabitEthernet1/0/11
un qos apply policy inbound
#
interface GigabitEthernet1/0/12
un qos apply policy inbound

quit
un qos policy 1
un traffic behavior 1
un traffic classifier 1

un acl number 3001
			

这个案例是基于源的策略路由

案例二

acl number 3010
 rule 0 permit ip source any destination 192.168.0.0 0.0.255.255

acl number 3020
 rule 0 permit ip source 192.168.6.0 0.0.0.255

traffic classifier classifier1 operator or
 if-match acl 3010
traffic classifier classifier2 operator or
 if-match acl 3020

traffic behavior behavior1
 redirect next-hop 192.168.1.1

traffic behavior behavior2
 redirect next-hop 192.168.40.254

qos policy policy1
 classifier classifier1 behavior behavior1
 classifier classifier2 behavior behavior2

interface GigabitEthernet1/0/11
 qos apply policy policy1 inbound
			

案例二是一个基于目的的测略路由

21.6.5. Debug

21.6.5.1. routing-table

				
[H3C]display ip routing-table
 Routing Table: public net
Destination/Mask   Protocol Pre  Cost        Nexthop         Interface
0.0.0.0/0          STATIC   60   0           192.168.3.1     Vlan-interface1
127.0.0.0/8        DIRECT   0    0           127.0.0.1       InLoopBack0
127.0.0.1/32       DIRECT   0    0           127.0.0.1       InLoopBack0
192.168.3.0/24     DIRECT   0    0           192.168.3.12    Vlan-interface1
192.168.3.12/32    DIRECT   0    0           127.0.0.1       InLoopBack0
192.168.5.0/24     STATIC   60   0           192.168.3.252   Vlan-interface1
192.168.6.0/24     DIRECT   0    0           192.168.6.254   Vlan-interface6
192.168.6.254/32   DIRECT   0    0           127.0.0.1       InLoopBack0
192.168.7.0/24     DIRECT   0    0           192.168.7.254   Vlan-interface7
192.168.7.254/32   DIRECT   0    0           127.0.0.1       InLoopBack0
192.168.8.0/24     DIRECT   0    0           192.168.8.254   Vlan-interface8
192.168.8.254/32   DIRECT   0    0           127.0.0.1       InLoopBack0
192.168.9.0/24     DIRECT   0    0           192.168.9.254   Vlan-interface9
192.168.9.254/32   DIRECT   0    0           127.0.0.1       InLoopBack0
				
				
[H3C-rip-1]display ip routing-table
Routing Tables: Public
	Destinations : 36	Routes : 36

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/0           Static 60   0            192.168.1.1     Vlan1
1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
4.4.4.4/32          Static 60   0            192.168.40.254  Vlan40
8.8.8.8/32          Static 60   0            192.168.40.254  Vlan40
64.4.61.215/32      Static 60   0            192.168.40.254  Vlan40
74.125.71.94/32     Static 60   0            192.168.40.254  Vlan40
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
172.16.0.0/24       OSPF   10   2            192.168.40.254  Vlan40
192.168.1.0/24      Direct 0    0            192.168.1.254   Vlan1
192.168.1.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.2.0/24      Direct 0    0            192.168.2.254   Vlan2
192.168.2.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.3.0/24      Direct 0    0            192.168.3.254   Vlan3
192.168.3.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.4.0/24      Direct 0    0            192.168.4.254   Vlan4
192.168.4.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.5.0/24      Direct 0    0            192.168.5.254   Vlan5
192.168.5.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.6.0/24      Direct 0    0            192.168.6.254   Vlan6
192.168.6.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.7.0/24      Direct 0    0            192.168.7.254   Vlan7
192.168.7.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.8.0/24      Direct 0    0            192.168.8.254   Vlan8
192.168.8.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.9.0/24      Direct 0    0            192.168.9.254   Vlan9
192.168.9.254/32    Direct 0    0            127.0.0.1       InLoop0
192.168.20.0/24     Direct 0    0            192.168.20.254  Vlan20
192.168.20.254/32   Direct 0    0            127.0.0.1       InLoop0
192.168.30.0/24     Direct 0    0            192.168.30.1    Vlan30
192.168.30.1/32     Direct 0    0            127.0.0.1       InLoop0
192.168.30.112/32   Static 60   0            192.168.30.254  Vlan30
192.168.40.240/28   Direct 0    0            192.168.40.253  Vlan40
192.168.40.253/32   Direct 0    0            127.0.0.1       InLoop0
192.168.50.128/25   OSPF   10   2            192.168.40.254  Vlan40
203.208.46.146/32   Static 60   0            192.168.40.254  Vlan40
				





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
网络协议 网络架构
RIP(Routing Information Protocol,路由信息协议)
RIP是由Xerox公司在20世纪七十年代开发的,最初定义的RFC1058中。每个有RIP功能的路由器在默认情况下每隔30秒利用UDP520端口向与它直连的网络邻居广播(RIP v1)或组播(RIP v2)路由更新。因此,路由器不知道网络的全局情况,如果路由更新在网络上传播慢,将会导致网络收敛较慢,造成路由环路。为了避免路由环路,RIP采用水平分割、毒性逆转、定义最大跳数、触发更新和抑制计时器等机制来避免路由环路。
427 0
RIP(Routing Information Protocol,路由信息协议)
|
负载均衡 网络协议 网络架构
策略路由(Policy-Based-Route)
定义及运用场景 PBR: Policy-Based-Route,该技术打破了路由表的传统选路规则,可以根据管理员定义的策略条件来选择性的转发数据包。
612 0
策略路由(Policy-Based-Route)
|
Web App开发 网络协议 网络性能优化