Guest

IP Routing

Redistribute Connected Networks into OSPF with Subnet Keyword

Cisco - Redistribute Connected Networks into OSPF with Subnet Keyword

Document ID: 113339

Updated: Nov 29, 2011

   Print

Introduction

This document describes the behavior of the redistribution of connected routes into Open Shortest Path First (OSPF). There are two behaviors that depend on whether the subnet keyword is given or not when you redistribute the connected networks. In general when the redistribute command is used to redistribute routes in to an OSPF domain, the router automatically becomes an autonomous system boundary router (ASBR). By default when routes from protocols are redistributed in to OSPF with the connected keyword, these routes become redistributed as external to the AS and only the routes that are not subnetted are redistributed. On you include the subnets keyword, the OSPF redistributes the routes, which are subnetted. The process uses 20 as the default metric. This happens when no metric is specified by the use of the metric-type keyword.

Prerequisites

Requirements

Ensure that you meet these requirements before you attempt this configuration:

  • Knowledge of general IP routing

  • Knowledge of OSPF routing protocol concepts and terms

Components Used

The configurations in this document is based on the Cisco 3700 series router on Cisco IOS® Software Release software 12.4 (15)T 13.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

Conventions

Refer to Cisco Technical Tips Conventions for more information on document conventions.

Configure

In this section, you are presented with the information to configure the features described in this document.

The routers R1, R2 and R3 are connected through the serial interface to each other and are configured with the IP address. There are some loopback addresses created on both R1 and R3 for generating networks. EIGRP runs on the routers R1 and R2 while R3 communicates to R1 using OSPF. The router R2, which runs both EIGRP and OSPF, uses the redistribute command in order to redistribute EIGRP routes in to OSPF.

Note: Use the Command Lookup Tool (registered customers only) to find more information on the commands used in this document.

Network Diagram

This document uses this network setup:

ospf_connected_net-01.gif

Configurations

This document uses these configurations:

Router R1
version 12.4
!
hostname R1
!
ip cef
!
interface Loopback0
 ip address 10.10.10.10 255.255.255.240
!
interface Loopback1
 ip address 20.20.20.20 255.255.255.240
!
interface Loopback2
 ip address 30.30.30.30 255.255.255.240
!
interface Serial0/0
 ip address 172.16.10.1 255.255.248.0
 clock rate 2000000
!
router eigrp 100
 network 10.10.10.0 0.0.0.15
 network 20.20.20.16 0.0.0.15
 network 30.30.30.16 0.0.0.15
 network 172.16.8.0 0.0.7.255
 no auto-summary

!--- Auto-summary is disabled so that 
!--- the networks are summarized with subnets.

!
end

Router R2
version 12.4
!
hostname R2
!
ip cef
!
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 Loopback2
 ip address 3.3.3.3 255.255.255.255
!
interface Serial0/0
 ip address 172.16.10.2 255.255.248.0
 clock rate 2000000
!
interface Serial0/1
 ip address 172.16.64.1 255.255.255.0
 clock rate 2000000
!
router eigrp 100
 network 1.0.0.0
 network 3.0.0.0
 network 172.16.8.0 0.0.7.255
 auto-summary
!
router ospf 100
 log-adjacency-changes
 redistribute eigrp 100 
 redistribute connected
 network 2.2.2.2 0.0.0.0 area 0
 network 172.16.64.0 0.0.0.255 area 0
!
end

Router R3
version 12.4
!
hostname R3
!
ip cef
!
interface Loopback0
 ip address 11.1.1.1 255.255.255.255
!
interface Loopback1
 ip address 12.1.1.1 255.255.255.255
!
interface Loopback2
 ip address 13.1.1.1 255.255.255.255
!
interface Serial0/0
 ip address 172.16.64.2 255.255.255.0
 clock rate 2000000
!
router ospf 100
 log-adjacency-changes
 network 11.1.1.1 0.0.0.0 area 0
 network 12.1.1.1 0.0.0.0 area 0
 network 13.1.1.1 0.0.0.0 area 0
 network 172.16.64.0 0.0.0.255 area 0
!
end

Verify

Verify Redistribution of Connected Networks into OSPF

Use this section in order to confirm that your configuration works properly.

The Output Interpreter Tool (registered customers only) (OIT) supports certain show commands. Use the OIT to view an analysis of show command output.

Use the show ip route ospf command in order to verify the router R3 receoved the redistributed routes.

show ip route ospf
When connected routes are redistributed with the redistribute connected in router R2: In router R3
R3#show ip route ospf
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.64.1, 06:14:14, Serial0/0

!--- Only the classful routes are shown without actual subnets.

When redistributed with the specification of the subnets keyword in the redistribute connected subnets in router R2: In router R3
R3#show ip route ospf
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.64.1, 06:14:14, Serial0/0
R3#sh ip route ospf
     1.0.0.0/32 is subnetted, 1 subnets
O E2    1.1.1.1 [110/20] via 172.16.64.1, 00:00:02, Serial0/0

!--- When routes are redistributed in to OSPF, 
!--- OSPF uses 20 as the default metric if 
!--- the metric-type keyword is not mentioned
!--- and the routes are redistributed as External Type 2(E2) routes.

     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.64.1, 06:36:58, Serial0/0
     3.0.0.0/32 is subnetted, 1 subnets
O E2    3.3.3.3 [110/20] via 172.16.64.1, 00:00:02, Serial0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O E2    172.16.8.0/21 [110/20] via 172.16.64.1, 00:00:02, Serial0/0

!--- On specifying the keyword subnets, 
!--- the routes are reflected along with the subnets.



!--- Only the classful routes are shown without actual subnets.

Verify Redistribution of EIGRP routes into OSPF

When EIGRP routes are redistributed in to OSPF with the redistribute eigrp < process id > command, the routes are redistributed as E2 routes with the default metric of 20 when no metric-type keyword is specified.

show ip route ospf
When EIGRP is redistributed with the redistribute eigrp 100 command in router R2: In router R3
R3#show ip route ospf
O E2 1.0.0.0/8 [110/20] via 172.16.64.1, 00:00:09, Serial0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.64.1, 07:03:16, Serial0/0
O E2 3.0.0.0/8 [110/20] via 172.16.64.1, 00:00:09, Serial0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O E2    172.16.0.0/16 [110/20] via 172.16.64.1, 00:00:09, Serial0/0

!--- Only classful networks are redistributed by default.

When you specify the subnet keyword in the redistribute eigrp 100 subnets command in router R2: In router R3
R3#sh ip route ospf
O E2 1.0.0.0/8 [110/20] via 172.16.64.1, 00:06:19, Serial0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.64.1, 07:09:26, Serial0/0
O E2 3.0.0.0/8 [110/20] via 172.16.64.1, 00:06:19, Serial0/0
     20.0.0.0/28 is subnetted, 1 subnets
O E2    20.20.20.16 [110/20] via 172.16.64.1, 00:00:06, Serial0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O E2    172.16.0.0/16 [110/20] via 172.16.64.1, 00:06:19, Serial0/0
     10.0.0.0/28 is subnetted, 1 subnets
O E2    10.10.10.0 [110/20] via 172.16.64.1, 00:00:06, Serial0/0
     30.0.0.0/28 is subnetted, 1 subnets
O E2    30.30.30.16 [110/20] via 172.16.64.1, 00:00:06, Serial0/0

!--- On specifying the keyword subnets, 
!--- the subnetted routes are reflected along
!--- with their subnet mask.

Related Information

Updated: Nov 29, 2011
Document ID: 113339