基於報文地址的策略路由配置樣本

來源:互聯網
上載者:User

【實驗拓撲】

本文實驗採用的交換器是H3C模擬器,下載地址如下: http://forum.h3c.com/forum.php? mod=viewthread&tid=109740&highlight=H3C%E6%A8%A1%E6% 8B%9F%E5%99%A8 有興趣的朋 友可以在論壇上去下載

【組網需求】

普通的報文轉寄是依據報文的目的地址查詢轉寄表來實現的。策略路由支援基於acl包過濾、地址長度等資訊,靈活地指定路由。而acl報文過濾則可以根據報文的源ip、目的ip、協議、連接埠號碼、優先順序、tos、時間段、vpn等各種豐富的資訊將報文分類,然後控制將這些報文按照不同的路由轉寄出去。本實驗難通過源IP來控制報文的下一跳。

策略路由分類

介面策略路由

介面策略路由只對轉寄的報文起作用,對本地產生的報文(比如本地的ping報文)不起作用。而本地策略路由只對本地產生的報文起作用,對轉寄的報文不起作用。

介面策略路由配置在介面視圖下。

本地策略路由

本地產生的報文的策略路由配置在系統檢視表下。

注意:組播策略路由只支援轉寄的報文,不對路由器本機產生的報文進行策略路由。

R5上有兩個網段100.100.100.100,200.200.200.200,用Loop0和loop1代替,去R4的10.1.1.1 在經R1時預設的下一跳有兩個,但是為了示範PBR的用法,現根據不同的源地址來給不同的下一跳。

【配置資訊】

R1:

acl number 2000

rule 0 permit source 100.100.100.100 0

acl number 2001

rule 0 permit source 200.200.200.200 0

#

interface Serial0/6/0

link-protocol ppp

ip address 192.168.12.1 255.255.255.0

#

interface Serial0/6/1

link-protocol ppp

ip address 192.168.13.1 255.255.255.0

#

interface Serial0/6/2

link-protocol ppp

#

interface Serial0/6/3

link-protocol ppp

ip address 172.16.15.1 255.255.255.0

ip policy-based-route 123

#

ospf 1

default-route-advertise always

area 0.0.0.0

network 192.168.12.0 0.0.0.255

network 192.168.13.0 0.0.0.255

network 172.16.15.0 0.0.0.255

#

policy-based-route 123 permit node 10

if-match acl 2000

apply ip-address next-hop 192.168.12.2

policy-based-route 123 permit node 20

if-match acl 2001

apply ip-address next-hop 192.168.13.2

#

ip route-static 100.100.100.100 255.255.255.255 172.16.15.2

ip route-static 200.200.200.200 255.255.255.255 172.16.15.2

R2:

interface Serial0/6/0

link-protocol ppp

ip address 192.168.12.2 255.255.255.0

#

interface Serial0/6/1

link-protocol ppp

ip address 192.168.24.1 255.255.255.0

#

ospf 1

area 0.0.0.0

network 192.168.24.0 0.0.0.255

network 192.168.12.0 0.0.0.255

R3:

interface Serial0/6/0

link-protocol ppp

ip address 192.168.34.1 255.255.255.0

#

interface Serial0/6/1

link-protocol ppp

ip address 192.168.13.2 255.255.255.0

#

ospf 1

area 0.0.0.0

network 192.168.13.0 0.0.0.255

network 192.168.34.0 0.0.0.255

#

R4:

#

interface Serial0/6/0

link-protocol ppp

ip address 192.168.34.2 255.255.255.0

#

interface Serial0/6/1

link-protocol ppp

ip address 192.168.24.2 255.255.255.0

#

interface NULL0

#

interface LoopBack0

ip address 10.1.1.1 255.255.255.255

#

ospf 1

area 0.0.0.0

network 192.168.24.0 0.0.0.255

network 192.168.34.0 0.0.0.255

network 10.1.1.1 0.0.0.0

#

R5:

#

interface Serial0/6/3

link-protocol ppp

ip address 172.16.15.2 255.255.255.0

#

interface NULL0

#

interface LoopBack0

ip address 100.100.100.100 255.255.255.255

#

interface LoopBack1

ip address 200.200.200.200 255.255.255.255

ip route-static 0.0.0.0 0.0.0.0 172.16.15.1

【驗證】

如下,去10.1.1.1有兩個下一跳,路由表中顯示192.168.12.2是預設的下一跳,現用PBR來幹預下一跳的指向

[R1]dis ip ro

Routing Tables: Public

更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/Network/lyjs/

   Destinations : 16       Routes : 17

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.1.1.1/32         OSPF   10   3124         192.168.12.2    S0/6/0

               OSPF   10   3124         192.168.13.2    S0/6/1

1、先在R1開啟調試開關

<R1>t d

% Current terminal debugging is on

<R1>t m

% Current terminal monitor is on

<R1>deb

<R1>debugging ip p

<R1>debugging ip packet

<R1>debugging ip policy-based-route

2、用R5帶源地址Ping

<R5>ping -a  100.100.100.100 10.1.1.1

PING 10.1.1.1: 56  data bytes, press CTRL_C to break

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.