我想做的就是这样。
如果 R1 的 F0/1 的流量进入除目标 202.100.30.248/29 之外的任何源,则下一跳应为 192.168.1.1
R3 和 R2 都指定了指向 R1 路由器的默认静态路由,因此我可以从路由器 R3 ping 192.168.1.1。
但是当我尝试从 R3 ping 200.100.30.252 时,我没有得到回复,事实上我想知道我的 PBR 是否正常工作并转发数据包。200.100.30.252 不在 R1 路由表中。没有路由协议运行。
这是我在 R1 上配置的
route-map PBR, permit, sequence 10
Match clauses:
ip address (access-lists): 104
Set clauses:
ip default next-hop 192.168.1.1
Extended IP access list 104
10 permit ip any 202.100.30.248 0.0.0.7 log-input
interface FastEthernet0/1
ip address 172.16.1.2 255.255.255.252
ip policy route-map PBR
R1 配置
R1#sh running-config
Building configuration...
Current configuration : 1295 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
ip cef
no ip domain lookup
!
ip tcp synwait-time 5
!
interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.1.2 255.255.255.252
ip policy route-map PBR
duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet1/1
no ip address
shutdown
duplex auto
speed auto
!
ip forward-protocol nd
!
no ip http server
!
!
access-list 104 permit ip any 202.100.30.248 0.0.0.7 log-input
no cdp log mismatch duplex
!
route-map PBR permit 10
match ip address 104
set ip default next-hop 192.168.1.1
!
control-plane
!
gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line vty 0 4
login
!
!
end
我分析了从 R3 到 R1 的数据包,它只显示 ARP 广播询问谁是 202.100.30.252,并且没有回复该 ARP。
可能是我犯了一个大错误,我正在学习这个,请纠正我的错误。如果您需要更多内容,请询问。