`

路径控制

 
阅读更多

######################################################
offset-list                                         ##
用于在入站或出站时增加通过rip或eigrp熟悉的路由度量值##
######################################################
offset-list配置

access-list 1 permit 10.1.1.0
router rip
offset-list 1 out 2 serial 0/0            加2hop


#####################################################
PBR策略路由 (根据协议 报文 应用 ip源选择转发路径)##                       ##
路由策略是一种方法PBR是一种应用                    ##
应用route-map                                      ##
分流与过滤以及感兴趣数据流匹配                     ##
#####################################################
场景1:学生老师数据分流

access-list 1 permit 192.168.1.0 0.0.0.255 学生
access-list 2 permit 192.168.2.0 0.0.0.255 老师

route-map test permit 10
match ip address 1
set ip next-hop ip    isp直连路由ip下一跳方式 可以按顺序多个

route-map test permit 20
match ip address 2
set interface fastethernet 0/1  入接口方式

interface fastethenet 0/0
ip policy route-map test    全局下针对本地始发流量ip local policy route-map test 优先级高于静态路由
 
################################################################################################
场景2:借助CDP 有时候有运营商的透明设备无法感知对端口是shutdown

增加
set ip next-hop verify-availability

######################################################################################
场景3:sla协议  CDP必须cisco设备而且不安全还有种种原因不建议使用

ip sla monitor responder 增强
ip sla monitor 1
type echo protocol protocolEcho 10.1.1.2 source-ipaddress 10.1.1.1
frequence 10
ip sla monitor schedule 1 life forever start-time now
track 1 rtr 1 reachability

ip sla monitor responder 增强
ip sla monitor 2
type echo protocol protocolEcho 10.2.2.2 source-ipaddress 10.1.1.1
frequence 10
ip sla monitor schedule 1 life forever start-time now
track 2 rtr 2 reachability

access-list 1 permit any
route-map PBR permit 10
match ip address 1
set ip next-hop verify-availability 10.1.1.2 10 track 1
set ip next-hop verify-availability 10.2.2.2 20 track 2
############################################################################################
场景4:下一跳不是本地直连接口使用递归下一跳

ccess-list 1 permit any
route-map test permit 10
match ip address 1
set ip next-hop ip                    直连下一跳ip  第一 set ip next-hop default ip 比路由表低
set ip next-hop recursive ip          非直连下一跳ip  第二
ip route 10.1.12.0 255.255.255.0 10.1.1.2

ip route 0.0.0.0 0.0.0.0 serial s0/2  默认路由  第三
#######################################################################################
BPR与NAT结合案例(两台pc两个isp)

access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 192.168.2.0 0.0.0.255

route-map test permit 10
match ip address 1
set ip next-hop 11.1.1.2   
exit

route-map test permit 20
match ip address 2
set ip next-hop 22.2.2.2
exit

interface fastethenet 1/0
ip policy route-map test

#####

route-map nat1 1 permit 10
match ip address 1
match interface serial 0/0
route-map nat2 1 permit 10
match ip address 1


route-map nat3 1 permit 10
match ip address 2
match interface serial 0/1
route-map nat4 1 permit 10
match ip address 2


ip nat inside source route-map nat1 interface serial 0/0 overload
ip nat inside source route-map nat2 interface serial 0/1 overload
ip nat inside source route-map nat3 interface serial 0/1 overload
ip nat inside source route-map nat4 interface serial 0/0 overload

int f 1/0
ip nat inside
int s 0/0
ip nat outside
int s 0/1
ip nat outside
exit

ip route 0.0.0.0 0.0.0.0 11.1.1.2 10
ip route 0.0.0.0 0.0.0.0 22.2.2.2 10

###############################################################################


#######################
实验案例 route-policy##
#######################
需求:
1. R1能访问23.0和24.0,同时能访问100.0以及R5的所有loopback接口
2. R1访问R5下属loopback接口时,数据流走向为R1 R2 R3 R5,同时确保往返路径一致
3. 当R2 R3之间链路故障时,R1访问R5下属loopback的流量自动切换为经R2 R4 R5且往返路径一致
4. R1访问R4下属loopback接口,默认走R2 R4,且往返路径一致
   当R2至R4间的链路故障时,则自动切换至R2 R3 R4,且往返路径一致
5. R3 R5均宣告各自的以太网接口进RIP进程,R4在100.0的接口上并不激活任何动态路由协议
6. 除R4 R5外,其他路由器上不允许配置任何静态路由

##################################################################
R1

conf ter
int s 0/0
ip add 192.168.12.1 255.255.255.0
no sh
int lo0
ip add 172.16.1.1 255.255.255.0
no sh
exit

router ei 100
network 172.16.1.0
network 192.168.12.0
no auto-summary


####################################################################
R2

conf ter
int 0/0
ip add 192.168.12.2 255.255.255.0
no sh
int s 0/1
ip add 192.168.23.2 255.255.255.0
no sh
int s 0/2
ip add 192.168.24.2 255.255.255.0
no sh
exit

router ei 100
network 192.168.12.0

router rip
ver 2
network 192.168.23.0
redistribute eigrp 100 mrtric 2
no auto-summary

router ospf 1
network 192.168.24.2 0.0.0.0 a 0
redistribute eigrp 100 subnets


router eigrp 100
redistribute rip netic 1500 100 255 1 1500
redistribute ospf netic 1500 1 100 1 1500
exit
 

 

 

 

 

####################################################################
R3

conf ter
int s 0/0
ip add 192.168.23.3 255.255.255.0
no sh
int f 1/0
ip add 192.168.100.3 255.255.255.0
no sh

router rip
ver 2
network 192.168.23.0
network 192.168.100.0
no auto-summary

router rip
ver 2
passive-interface f 1/0
neighbor 192.168.100.5

#####################################################################
R4

conf ter
int s 0/0
ip add 192.168.24.4 255.255.255.0
no sh
int f 1/0
ip add 192.168.100.4 255.255.255.0
no sh
int lo0
ip add 172.16.4.1 255.255.255.0
no sh

router ospf 1
network 192.168.24.4 0.0.0.0 a 0

ip route 172.24.65.0 255.255.255.0 192.168.100.5
ip route 172.24.66.0 255.255.255.0 192.168.100.5
ip route 172.24.67.0 255.255.255.0 192.168.100.5
router ospf 1
redistribute static subnets

no ip route 172.24.65.0 255.255.255.0 192.168.100.5
no ip route 172.24.66.0 255.255.255.0 192.168.100.5
no ip route 172.24.67.0 255.255.255.0 192.168.100.5
ip route 172.24.64.0 255.255.255.0 192.168.100.5

access-list 1 permit 172.16.4.0
route-map test permit 10
match ip add 1
exit

router ospf 1
redistribute conneted subnets route-map test

ip route 172.16.1.0 255.255.255.0 192.168.100.4 115
ip route 192.168.23.0 255.255.255.0 192.168.100.4 115
ip route 192.168.12.0 255.255.255.0 192.168.100.4 115


#####################################################################
R5

conf ter
int f 0/0
ip add 192.168.100.5 255.255.255.0
no sh

int lo0
ip add 172.16.65.1 255.255.255.0
no sh
int lo1
ip add 172.16.66.1 255.255.255.0
no sh
int lo2
ip add 172.16.67.1 255.255.255.0
no sh

router rip
ver 2
network 192.168.100.0
redistribute connected metric 1
no auto-summary

ip route 172.24.1.0 255.255.255.0 192.168.100.4 130
ip route 192.168.12.0 255.255.255.0 192.168.100.4 130
ip route 192.168.24.0 255.255.255.0 192.168.100.4 130

ip route 172.24.4.0 255.255.255.0 192.168.100.4
router rip
ver 2
redistribute static me 1

router rip
ver 2
passive-interface f 0/0
neighbor 192.168.100.3

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics