Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

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