策略路由(pbr)简单配置



r1:
!         
!         
!         
!         
!         
!         
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!         
interface Loopback1
ip address 2.2.2.2 255.255.255.255
!         
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!         
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!         
interface Ethernet1/0
ip address 192.168.1.1 255.255.255.252
half-duplex
!         
interface Ethernet1/1
no ip address
shutdown
half-duplex
!         
interface Ethernet1/2
no ip address
shutdown
half-duplex
!         
interface Ethernet1/3
no ip address
shutdown
half-duplex
!         
router ospf 1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 1
network 2.2.2.0 0.0.0.255 area 1
network 192.168.1.0 0.0.0.255 area 1
!         
no ip http server
no ip http secure-server
!         
!         
!         
!      

r2:  

!         
!         
!         
!         
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!         
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!         
interface Ethernet1/0
ip address 192.168.1.2 255.255.255.252
ip policy route-map r1tor4
half-duplex
!         
interface Ethernet1/1
ip address 192.168.1.5 255.255.255.252
half-duplex
!         
interface Ethernet1/2
ip address 192.168.1.9 255.255.255.252
half-duplex
!         
interface Ethernet1/3
no ip address
shutdown
half-duplex
!         
router ospf 2
log-adjacency-changes
network 192.168.1.0 0.0.0.255 area 1
!         
no ip http server
no ip http secure-server
!         
!         
!         
access-list 1 permit 1.1.1.1
access-list 2 permit 2.2.2.2
!         
route-map r1tor4 permit 10
match ip address 1
set ip next-hop  192.168.1.6
 
route-map r1tor4 permit 20
match ip address 2
set ip next-hop 192.168.1.10

!         
!         
!         
!         
control-plane
!         
!         
!         
!         
!         
!         
!         
!         
!         
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!         
!         
end

!         
!         
!         
control-plane
!         
!         
!         
!         
!         
!         
!         
r3:
!         
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!         
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!         
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!         
interface Ethernet1/0
ip address 192.168.1.6 255.255.255.252
half-duplex
!         
interface Ethernet1/1
ip address 34.34.34.1 255.255.255.0
half-duplex
!         
interface Ethernet1/2
no ip address
shutdown
half-duplex
!         
interface Ethernet1/3
no ip address
shutdown
half-duplex
!         
router ospf 3
router-id 33.33.33.33
log-adjacency-changes
network 34.34.34.0 0.0.0.255 area 1
network 192.168.1.0 0.0.0.255 area 1
!         
no ip http server
no ip http secure-server
!         
!         
!         
!         
!         
!         
!         
control-plane
!         
r4:

!         
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!         
interface Loopback1
no ip address
!         
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!         
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!         
interface Ethernet1/0
ip address 192.168.1.10 255.255.255.252
half-duplex
!         
interface Ethernet1/1
ip address 34.34.34.2 255.255.255.0
half-duplex
!         
interface Ethernet1/2
no ip address
shutdown
half-duplex
!         
interface Ethernet1/3
no ip address
shutdown
half-duplex
!         
router ospf 4
log-adjacency-changes
network 34.34.34.0 0.0.0.255 area 1
network 192.168.1.0 0.0.0.255 area 1
!         
no ip http server
no ip http secure-server
!         
!