拓扑:
sw1#
sw1#
sw1#sh run
Building configuration...
Current configuration : 1394 bytes
!
version 12.3
hostname sw1
!
!
!
no ip domain lookup
!
interface FastEthernet0/0
no ip address
!
interface FastEthernet0/1
no ip address
!
interface FastEthernet0/2
no ip address
!
interface Vlan1
no ip address
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end
sw1#
R2:
r2#sh run
Building configuration...
Current configuration : 1367 bytes
!
version 12.3
hostname r2
!
!
no ip domain lookup
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial0/0
ip address 24.0.0.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 23.0.0.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
interface FastEthernet1/0
ip address 192.168.1.3 255.255.255.0
ip policy route-map pc2-liuliang
duplex auto
speed auto
!
router ospf 110
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.0 0.0.0.255 area 0
network 23.0.0.0 0.0.0.255 area 0
network 24.0.0.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
!
ip http server
no ip http secure-server
ip classless
!
!
!
access-list 101 permit ip host 192.168.1.2 7.7.7.0 0.0.0.255
!
route-map pc2-liuliang permit 10
match ip address 101
set ip next-hop 23.0.0.3
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end
r2#
r2#
r2#
r2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 23.0.0.3, 00:03:46, Serial0/1
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 24.0.0.4, 00:03:46, Serial0/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial0/1
37.0.0.0/24 is subnetted, 1 subnets
O 37.0.0.0 [110/128] via 23.0.0.3, 00:03:46, Serial0/1
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/129] via 24.0.0.4, 00:03:46, Serial0/0
[110/129] via 23.0.0.3, 00:03:46, Serial0/1
24.0.0.0/24 is subnetted, 1 subnets
C 24.0.0.0 is directly connected, Serial0/0
C 192.168.1.0/24 is directly connected, FastEthernet1/0
47.0.0.0/24 is subnetted, 1 subnets
O 47.0.0.0 [110/128] via 24.0.0.4, 00:03:48, Serial0/0
r2#
r2#
r2#sh ip poli
r2#sh ip policy
Interface Route map
Fa1/0 pc2-liuliang
r2#sh rout
r2#sh route-map ?
WORD route-map name
all static and dynamic route-map information
dynamic dynamic route-map information
| Output modifiers
<cr>
r2#sh route-map
route-map pc2-liuliang, permit, sequence 10
Match clauses:
ip address (access-lists): 101
Set clauses:
ip next-hop 23.0.0.3
Policy routing matches: 11 packets, 930 bytes
r2#
r2#
r2#
r2#
*Mar 1 00:27:01.571: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
*Mar 1 00:27:01.575: %OSPF-5-ADJCHG: Process 110, Nbr 3.3.3.3 on Serial0/1 from INIT to DOWN, Neighbor Down: Interface down or detached
r2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#route
*Mar 1 00:27:11.555: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r2(config)#route-m
r2(config)#route-map pc2-liuli
r2(config-route-map)#match ip address 101
r2(config-route-map)#set
r2(config-route-map)#set ip ?
address Specify IP address
default Set default information
df Set DF bit
next-hop Next hop address
precedence Set precedence field
qos-group Set QOS Group ID
tos Set type of service field
r2(config-route-map)#set ip def
r2(config-route-map)#set ip default ?
next-hop Next hop along path
r2(config-route-map)#set ip default ne
r2(config-route-map)#set ip default next-hop ?
A.B.C.D Default next hop IP address
verify-availability Verify if default nexthop is a CDP neighbor
<cr>
r2(config-route-map)#set ip default next-hop 23.0.0.3 ?
A.B.C.D Default next hop IP address
<cr>
r2(config-route-map)#set ip default next-hop 23.0.0.3
r2(config-route-map)#
r2(config-route-map)#
r2(config-route-map)#
r2(config-route-map)#^Z
r2#
r2#
r2#
r2#
r2#
r2#
*Mar 1 00:27:53.051: %SYS-5-CONFIG_I: Configured from console by console
r2#
*Mar 1 00:28:58.911: %OSPF-5-ADJCHG: Process 110, Nbr 3.3.3.3 on Serial0/1 from FULL to DOWN, Neighbor Down: Dead timer expired
r2#
*Mar 1 00:29:01.571: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
R3:
r3#sh run
Building configuration...
Current configuration : 1138 bytes
!
hostname r3
!
no ip domain lookup
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Serial0/0
ip address 37.0.0.3 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 23.0.0.3 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router ospf 110
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.0 0.0.0.255 area 0
network 23.0.0.0 0.0.0.255 area 0
network 37.0.0.0 0.0.0.255 area 0
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end
r3#
r3#
r3#
r3#
r3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 23.0.0.2, 00:04:41, Serial0/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/129] via 37.0.0.7, 00:04:41, Serial0/0
[110/129] via 23.0.0.2, 00:04:41, Serial0/1
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial0/1
37.0.0.0/24 is subnetted, 1 subnets
C 37.0.0.0 is directly connected, Serial0/0
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/65] via 37.0.0.7, 00:04:41, Serial0/0
24.0.0.0/24 is subnetted, 1 subnets
O 24.0.0.0 [110/128] via 23.0.0.2, 00:04:42, Serial0/1
O 192.168.1.0/24 [110/65] via 23.0.0.2, 00:04:42, Serial0/1
47.0.0.0/24 is subnetted, 1 subnets
O 47.0.0.0 [110/128] via 37.0.0.7, 00:04:42, Serial0/0
r3#
r3#
r3#
r3#
r3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r3(config)#int s0/1
r3(config-if)#shu
r3(config-if)#
*Mar 1 00:26:46.591: %OSPF-5-ADJCHG: Process 110, Nbr 2.2.2.2 on Serial0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
r3(config-if)#
*Mar 1 00:26:48.575: %LINK-5-CHANGED: Interface Serial0/1, changed state to administratively down
*Mar 1 00:26:49.575: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
r3(config-if)#no shu
r3(config-if)#
*Mar 1 00:27:21.027: %LINK-3-UPDOWN: Interface Serial0/1, changed state to up
*Mar 1 00:27:22.027: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r3(config-if)#
*Mar 1 00:27:41.315: %OSPF-5-ADJCHG: Process 110, Nbr 2.2.2.2 on Serial0/1 from LOADING to FULL, Loading Done
r3(config-if)#
r3(config-if)#
r3(config-if)#shu
r3(config-if)#
*Mar 1 00:28:49.159: %OSPF-5-ADJCHG: Process 110, Nbr 2.2.2.2 on Serial0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
r3(config-if)#
*Mar 1 00:28:51.143: %LINK-5-CHANGED: Interface Serial0/1, changed state to administratively down
*Mar 1 00:28:52.143: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
R4:
r4#
r4#
r4#sh run
Building configuration...
Current configuration : 1138 bytes
!
version 12.3
hostname r4
!
no ip domain lookup
!
!
!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface Serial0/0
ip address 24.0.0.4 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 47.0.0.4 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router ospf 110
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.0 0.0.0.255 area 0
network 24.0.0.0 0.0.0.255 area 0
network 47.0.0.0 0.0.0.255 area 0
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end
r4#
r4#
r4#
r4# sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 24.0.0.2, 00:05:21, Serial0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/129] via 47.0.0.7, 00:05:21, Serial0/1
[110/129] via 24.0.0.2, 00:05:21, Serial0/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
O 23.0.0.0 [110/128] via 24.0.0.2, 00:05:21, Serial0/0
37.0.0.0/24 is subnetted, 1 subnets
O 37.0.0.0 [110/128] via 47.0.0.7, 00:05:21, Serial0/1
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/65] via 47.0.0.7, 00:05:21, Serial0/1
24.0.0.0/24 is subnetted, 1 subnets
C 24.0.0.0 is directly connected, Serial0/0
O 192.168.1.0/24 [110/65] via 24.0.0.2, 00:05:22, Serial0/0
47.0.0.0/24 is subnetted, 1 subnets
C 47.0.0.0 is directly connected, Serial0/1
r4#
r4#
r4#
r4#
R7:
R7#sh run
Building configuration...
Current configuration : 1138 bytes
!
version 12.3
hostname R7
!
!
!
no ip domain lookup
!
interface Loopback0
ip address 7.7.7.7 255.255.255.0
!
interface Serial0/0
ip address 37.0.0.7 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 47.0.0.7 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router ospf 110
router-id 7.7.7.7
log-adjacency-changes
network 7.7.7.0 0.0.0.255 area 0
network 37.0.0.0 0.0.0.255 area 0
network 47.0.0.0 0.0.0.255 area 0
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end
R7#
R7#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/129] via 47.0.0.4, 00:07:14, Serial0/1
[110/129] via 37.0.0.3, 00:07:14, Serial0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 37.0.0.3, 00:07:14, Serial0/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 47.0.0.4, 00:07:14, Serial0/1
23.0.0.0/24 is subnetted, 1 subnets
O 23.0.0.0 [110/128] via 37.0.0.3, 00:07:14, Serial0/0
37.0.0.0/24 is subnetted, 1 subnets
C 37.0.0.0 is directly connected, Serial0/0
7.0.0.0/24 is subnetted, 1 subnets
C 7.7.7.0 is directly connected, Loopback0
24.0.0.0/24 is subnetted, 1 subnets
O 24.0.0.0 [110/128] via 47.0.0.4, 00:07:15, Serial0/1
O 192.168.1.0/24 [110/129] via 47.0.0.4, 00:07:15, Serial0/1
[110/129] via 37.0.0.3, 00:07:15, Serial0/0
47.0.0.0/24 is subnetted, 1 subnets
C 47.0.0.0 is directly connected, Serial0/1
R7#
R7#
R7#sh ip po,l
R7#sh ip p
R7#sh ip poli
R7#sh ip policy
Interface Route map
R7#
R7#
THE END!
联系客服