R4(config)#int loo0
R4(config-if)#ip add 4.4.0.4 255.255.255.0
R4(config-if)#int loo1
R4(config-if)#ip add 4.4.1.4 255.255.255.0
R4(config-if)#int s2/0
R4(config-if)#ip add 192.168.34.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#net 192.168.34.0 0.0.0.255 a 0
R4(config-router)#exit
R4#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R4#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/61/120 ms
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#router ospf 1
R4(config-router)#red
R4(config-router)#redistribute con
R4(config-router)#redistribute connected ?
metric       Metric for redistributed routes
metric-type OSPF/IS-IS exterior metric type for redistributed routes
route-map    Route map reference
subnets      Consider subnets for redistribution into OSPF
tag          Set tag for routes redistributed into OSPF
R4(config-router)#redistribute connected sub
R4(config-router)#redistribute connected subnets ?
metric       Metric for redistributed routes
metric-type OSPF/IS-IS exterior metric type for redistributed routes
route-map    Route map reference
tag          Set tag for routes redistributed into OSPF
R4(config-router)#redistribute connected subnets
R4(config-router)#do ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 68/152/232 ms
R4(config-router)#
///////////////
前缀列表的使用
R4(config)#ip prefix-list 1 seq 5 permit 4.4.0.0/24
R4(config)#ip prefix-list 2 seq 5 permit 4.4.1.0/24
R4(config)#route-map conn permit 10
R4(config-route-map)#match ip address prefix-list 1
R4(config-route-map)#set metric 50
R4(config-route-map)#set metric-type type-1
R4(config-route-map)#exit
R4(config)#route-map conn permit 20
R4(config-route-map)#match ip address prefix-list 2
R4(config-route-map)#set metric 100
R4(config-route-map)#exit
R4(config)#router ospf 1