2021-07-25

HCIP第七天

2021-07-25
2021-07-25
配置IP
r1

[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip ad	
[R1-GigabitEthernet0/0/0]ip address 172.16.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip ad	
[R1-GigabitEthernet0/0/1]ip address 172.16.4.2 24
[R1-GigabitEthernet0/0/1]int loo 0
[R1-LoopBack0]ip ad	
[R1-LoopBack0]ip address 10.1.1.1 24

r2

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad	
[R2-GigabitEthernet0/0/0]ip address 172.16.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip ad	
[R2-GigabitEthernet0/0/1]ip address 172.16.2.1 24
[R2-GigabitEthernet0/0/1]int loo 0
[R2-LoopBack0]ip ad	
[R2-LoopBack0]ip address 2.2.2.2 24

r3

[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip ad	
[R3-GigabitEthernet0/0/1]ip address 172.16.3.2 24
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad	
[R3-GigabitEthernet0/0/0]ip address 172.16.4.1 24
[R3-GigabitEthernet0/0/0]int loo 0
[R3-LoopBack0]ip ad	
[R3-LoopBack0]ip address 3.3.3.3 24

r4

[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad	
[R4-GigabitEthernet0/0/0]ip address 172.16.2.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip ad	
[R4-GigabitEthernet0/0/1]ip address 172.16.3.1 24
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip ad	
[R4-GigabitEthernet0/0/2]ip address 172.16.5.1 24
[R4-GigabitEthernet0/0/2]int loo 0
[R4-LoopBack0]ip ad	
[R4-LoopBack0]ip address 4.4.4.4 24

r5

[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip ad	
[R5-GigabitEthernet0/0/0]ip address 172.16.5.2 24
[R5-GigabitEthernet0/0/0]int loo 0
[R5-LoopBack0]ip ad	
[R5-LoopBack0]ip address 10.5.5.5 24

RIP宣告
r1

[R1]rip 1
[R1-rip-1]undo su	
[R1-rip-1]undo summary 
[R1-rip-1]vers	
[R1-rip-1]version 2
[R1-rip-1]net	
[R1-rip-1]network 10.0.0.0
[R1-rip-1]net	
[R1-rip-1]network 172.16.0.0

r2

[R2]rip 1
[R2-rip-1]undo sum	
[R2-rip-1]undo summary 
[R2-rip-1]vers	
[R2-rip-1]version 2
[R2-rip-1]net	
[R2-rip-1]network 172.16.0.0	
[R2-rip-1]pre	
[R2-rip-1]preference ro	
[R2-rip-1]preference route-policy p
[R2-rip-1]im	
[R2-rip-1]import-route os	
[R2-rip-1]import-route ospf 1

r3

[R3]rip 1
[R3-rip-1]undo sum	
[R3-rip-1]undo summary 
[R3-rip-1]vers	
[R3-rip-1]version 2
[R3-rip-1]net	
[R3-rip-1]network 172.16.0.0
[R3-rip-1]im	
[R3-rip-1]import-route os	
[R3-rip-1]import-route ospf 1

OSPF宣告
r2

[R2]ospf 1 ro	
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]im	
[R2-ospf-1]import-route rip 1
[R2-ospf-1]area 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0

r3

[R3]ospf 1 r	
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]im	
[R3-ospf-1]import-route rip 1
[R3-ospf-1]area 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.3.2 0.0.0.0

使用 preference 加 route-policy 精确修改优先级,修改完优先级后过滤
r2

[R2]ip ip-prefix p index 10 permit 10.5.5.5 32 //使用前缀列表匹配10.5.5.5/32的流量
[R2]route-policy p permit node 1		//路由策略P允许通过
[R2-route-policy]if-match ip-prefix p	//如果匹配使用前缀列表P
[R2-route-policy]apply preference 160
[R2]route-policy p permit node 20		//允许其他路由通过
[R2-route-policy]rip 1 					//在rip下配置路由策略
[R2-rip-1]preference route-policy p

r3

[R3]ip ip-prefix p index 10 permit 10.5.5.5 32
[R3]route-policy p permit node 1
[R3-route-policy]if-match ip-prefix p
[R3-route-policy]apply preference 160
[R3]route-policy p permit node 20
[R3-route-policy]rip 1
[R3-rip-1]preference route-policy p

使用filter-policy 在RIP侧过滤10.5.5.5的路由
r2

[R2]ip ip-prefix p deny 10.5.5.5 32
[R2]rip 1
[R2-rip-1]filter-policy ip-prefix p import 	//过滤前缀列表P流量进入

r3

[R3]rip 1
[R3-rip-1]filter-policy ip-prefix p import 
[R3]ip ip-prefix p deny 10.5.5.5 32
上一篇:如何查看windows某个目录下所有文件/文件夹的大小?(TreeSize Free)


下一篇:pytest hook使用