06
2024
06
16:32:07

H3C 路由策略和策略路由实例配置

配置如下:

[IP]int s0/2/0

[IP-Serial0/2/0]ip add 202.112.1.10 28

[IP-Serial0/2/0]int s0/2/1

[IP-Serial0/2/1]ip add 61.67.1.10 28

[IP-Serial0/2/1]int lo0

[IP-LoopBack0]ip add 10.10.10.10 32

[IP]ip route-static 0.0.0.0 0 202.112.1.9 指条静态缺省路由到R1

[IP]ip route-static 0.0.0.0 0 61.67.1.9 指条静态缺省路由到R1

[R1-Serial0/2/1]int e0/1/0

[R1-Ethernet0/1/0]ip add 10.1.12.1 24

[R1-Ethernet0/1/0]int e0/1/1

[R1-Ethernet0/1/1]ip add 10.1.21.1 24

[R1-Ethernet0/1/1]int lo0

[R1-LoopBack0]ip add 1.1.1.1 32

[R1]ospf 100 router-id 1.1.1.1

[R1-ospf-100]area 0

[R1-ospf-100-area-0.0.0.0]net 10.1.12.0 0.0.0.255

[R1-ospf-100-area-0.0.0.0]net 10.1.21.0 0.0.0.255

[R1-ospf-100-area-0.0.0.0]net 1.1.1.1 0.0.0.0

[R1]ospf 100

[R1-ospf-100] default-route-advertise always本机没配置默认路由,此参数可产生一个描述缺省路由的LSA发布出去

[R1]ip route-static 10.10.10.10 255.255.255.255 202.112.1.10

[R1]ip route-static 10.10.10.10 255.255.255.255 61.67.1.10

[R1]ospf 100

[R1-ospf-100]import static ospf区域引入静态路由

[R1]acl number 3000

[R1-acl-adv-3000]rule permit icmp sour any destination 10.10.10.10 0 实现ping的要求

[R1]acl number 3001

[R1-acl-adv-3001]ru per tcp source any destination 10.10.10.10 0 destination-port eq 23实现telnet

[R1]policy-based-route any node 10 下边三条是基于策略的路由,简称策略路由

[R1-pbr-any-10]if-match acl 3000

[R1-pbr-any-10]apply ip-address next-hop 61.67.1.10

[R1]policy-based-route any node 20

[R1-pbr-any-20]if-match acl 3001

[R1-pbr-any-20]apply ip-address next-hop 202.112.1.10

[R1]int e0/1/0

[R1-Ethernet0/1/0] ip policy-based-route any 接口下使能策略路由

[R1]int e0/1/1

[R1-Ethernet0/1/1]ip policy-based-route any

[R2]int e0/1/0

[R2-Ethernet0/1/0]ip add 10.1.12.2 24

[R2-Ethernet0/1/0]int e0/1/1

[R2-Ethernet0/1/1]ip add 10.1.21.2 24

[R2-Ethernet0/1/1]int e0/1/2

[R2-Ethernet0/1/2]ip add 10.1.23.2 24

[R2-Ethernet0/1/2]int lo0

[R2-LoopBack0]ip add 2.2.2.2 32

[R2]ospf 100 router-id 2.2.2.2

[R2-ospf-100]area 0

[R2-ospf-100-area-0.0.0.0]net 10.1.12.0 0.0.0.255

[R2-ospf-100-area-0.0.0.0]net 10.1.21.0 0.0.0.255

[R2-ospf-100-area-0.0.0.0]net 2.2.2.2 0.0.0.0

[R2]rip

[R2-rip-1]version 2

[R2-rip-1]undo summary

[R2-rip-1]net 10.1.23.0

[R2]ospf 100

[R2-ospf-100]import-route rip

[R2-ospf-100]import-route direct ospf引入rip后可再引入直连路由

[R2]rip

[R2-rip-1]import-route ospf 100

[R2-rip-1]import-route direct

[R2]acl number 2000

[R2-acl-basic-2000]rule permit source 192.168.10.100 0

[R2]acl number 2001

[R2-acl-basic-2001]rule permit source 3.3.3.3 0

[R2-acl-basic-2001]rule permit source 192.168.20.100 0

[R2]route-policy 1234 permit node 10 路由策略的配置

[R2-route-policy]if-match acl 2000

[R2-route-policy]apply ip-address next-hop 10.1.21.1

[R2-route-policy]apply cost 10

[R2]route-policy 1234 deny node 20

[R2-route-policy]if-match acl 2001

[R2]route-policy 1234 permit node 30

[R2]ospf 100

[R2-ospf-100]import-route rip route-policy 1234

[R2]acl number 2002

[R2-acl-basic-2002]rule permit source 192.168.1.100 0

[R2-acl-basic-2002]rule permit source 192.168.2.100 0

[R2]policy-based-route 2345 permit node 10

[R2-pbr-2345-10]if-match acl 2002

[R2-pbr-2345-10]apply ip-address next-hop 10.1.21.1

[R2]int e0/1/2

[R2-Ethernet0/1/2]ip policy-based-route 2345

[R2]dis route-policy

[R3]int e0/1/0

[R3-Ethernet0/1/0]ip add 10.1.23.3 24

[R3-Ethernet0/1/0]int lo0

[R3-LoopBack0]ip add 3.3.3.3 32

[R3-LoopBack0]int lo1

[R3-LoopBack1]ip add 192.168.10.100 32

[R3-LoopBack1]int lo2

[R3-LoopBack2]ip add 192.168.20.100 32

[R3-LoopBack2]int lo3

[R3-LoopBack3]ip add 192.168.2.100 32

[R3-LoopBack3]int lo4

[R3-LoopBack4]ip add 192.168.1.100 32

[R3]rip

[R3-rip-1]version 2

[R3-rip-1]und summary

[R3-rip-1]net 10.1.23.0

[R3-rip-1]net 3.3.3.3

[R3-rip-1]net 192.168.10.100

[R3-rip-1]net 192.168.20.100

[R3-rip-1]net 192.168.2.100

[R3-rip-1]net 192.168.1.100




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://hqyman.cn/post/6550.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

请先 登录 再评论,若不是会员请先 注册

您的IP地址是: