c871#sh run
Building configuration...
Current configuration : 815 bytes
!
version 12.4
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname c871
!
boot-start-marker
boot-end-marker
!
enable password cisco
!
no aaa new-model
ip cef
!
!
multilink bundle-name authenticated
!
!
!
interface FastEthernet0
!
interface FastEthernet1
!
interface FastEthernet2
!
interface FastEthernet3
!
interface FastEthernet4
ip address 172.16.2.2 255.255.255.252
duplex auto
speed auto
!
interface Vlan1
ip address 172.16.1.2 255.255.255.252
!
router rip
network 172.16.0.0
!
!
!
no ip http server
no ip http secure-server
!
!
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
logging synchronous
no modem enable
line aux 0
line vty 0 4
password cisco
login
!
scheduler max-task-time 5000
end
c871#
Left#sh run
Building configuration...
Current configuration : 870 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Left
!
boot-start-marker
boot-end-marker
!
enable password cisco
!
no aaa new-model
!
resource policy
!
ip cef
!
!
!
!
no ip domain lookup
!
!
!
!
!
interface FastEthernet0/0
ip address 172.16.1.1 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 10.10.20.1 255.255.255.252
duplex auto
speed auto
!
interface Serial0/0/0
no ip address
shutdown
no fair-queue
clock rate 2000000
!
interface Serial0/1/0
ip address 10.10.10.1 255.255.255.252
!
router rip
network 10.0.0.0
network 172.16.0.0
!
!
!
ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
password cisco
login
!
scheduler allocate 20000 1000
end
Left#
Right#sh run
Building configuration...
Current configuration : 1170 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Right
!
boot-start-marker
boot-end-marker
!
enable password cisco
!
no aaa new-model
!
resource policy
!
ip cef
!
!
!
!
no ip domain lookup
!
!
!
!
!
interface Ethernet1
ip address 192.168.1.1 255.255.255.0
ip policy route-map right //在内网进口配置
!
interface FastEthernet0/0
ip address 10.10.20.2 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
ip policy route-map right //在内网进口配置
duplex auto
speed auto
!
interface Serial0/0/0
ip address 10.10.10.2 255.255.255.252
no fair-queue
clock rate 2000000
!
router rip
network 10.0.0.0
network 192.168.1.0
network 192.168.2.0
!
!
!
ip http server
no ip http secure-server
!
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 192.168.2.0 0.0.0.255
route-map right permit 10
match ip address 2
set interface Serial0/0/0
!
route-map right permit 20
match ip address 1
set interface FastEthernet0/0
!
!
!
!
control-plane
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
password cisco
login
!
scheduler allocate 20000 1000
end
Right#
Right#sh route-map
route-map right, permit, sequence 10
Match clauses:
ip address (access-lists): 2
Set clauses:
interface Serial0/0/0
Policy routing matches: 393 packets, 41386 bytes
route-map right, permit, sequence 20
Match clauses:
ip address (access-lists): 1
Set clauses:
interface FastEthernet0/0
Policy routing matches: 2 packets, 166 bytes
Right#sh ip pol
Right#sh ip policy
Interface Route map
Fa0/1 right
Right#debug ip policy
Policy routing debugging is on
Right#
Right#
Right#
*May 16 15:30:44.251: IP: s=192.168.2.219 (FastEthernet0/1), d=192.168.2.255, len 78, policy match
*May 16 15:30:44.251: IP: route map right, item 10, permit
*May 16 15:30:44.251: IP: s=192.168.2.219 (FastEthernet0/1), d=192.168.2.255 (Serial0/0/0), len 78, policy routed
*May 16 15:30:44.251: IP: FastEthernet0/1 to Serial0/0/0 192.168.2.255
*May 16 15:30:44.999: IP: s=192.168.2.219 (FastEthernet0/1), d=192.168.2.255, len 78, policy match
*May 16 15:30:44.999: IP: route map right, item 10, permit
*May 16 15:30:44.999: IP: s=192.168.2.219 (FastEthernet0/1), d=192.168.2.255 (Serial0/0/0), len 78, policy routed
Right#
*May 16 15:30:44.999: IP: FastEthernet0/1 to Serial0/0/0 192.168.2.255
*May 16 15:30:45.751: IP: s=192.168.2.219 (FastEthernet0/1), d=192.168.2.255, len 78, policy match
*May 16 15:30:45.751: IP: route map right, item 10, permit
*May 16 15:30:45.751: IP: s=192.168.2.219 (FastEthernet0/1), d=192.168.2.255 (Serial0/0/0), len 78, policy routed
*May 16 15:30:45.751: IP: FastEthernet0/1 to Serial0/0/0 192.168.2.255
C:\>tracert 172.16.1.2
Tracing route to 172.16.1.2 over a maximum of 30 hops
1 <1 ms <1 ms <1 ms 192.168.2.1
2 1 ms 1 ms 1 ms 10.10.10.1
3 1 ms 1 ms 1 ms 172.16.1.2
Trace complete.