2.6. Routing-阿里云开发者社区

开发者社区> 开发与运维> 正文
登录阅读全文

2.6. Routing

简介:

2.6.1. RIP

rip 1
 version 2
 network 192.168.20.0
 network 192.168.2.0
			

2.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
#
			

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

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

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

2.6.5. Debug

2.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 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章