Distribute-list apply to OSPF.

From: Chen Kwong Wai William (kwchen@netvigator.com)
Date: Mon Nov 10 2003 - 00:51:02 GMT-3


Dear all,

I've the following setting to test the "distribute-list in" command in OSPF.
I though that this command will only prevent the route from entering the
routing table but still keeping the route in the database, so it is still
advertise to other neighbors:

R1 - (1.1.1.0/24) - R2 - (172.16.1.0/24) - R4

R1 and R2 is in area 1, R2 and R4 is in area 0.
R4 has three loopbacks with Lo0: 2.2.2.2/32 (Area 2), Lo1: 3.3.3.3/32 (Area 0),
and Lo2: 4.4.4.0/24 (Area 4).

The initial setting:

R1:

router ospf 1
 router-id 11.11.11.11
 log-adjacency-changes
 network 1.1.1.0 0.0.0.255 area 1
!

R2:

router ospf 1
 router-id 22.22.22.22
 log-adjacency-changes
 network 1.1.1.0 0.0.0.255 area 1
 network 172.16.1.0 0.0.0.255 area 0
!

R4:

router ospf 1
 router-id 44.44.44.44
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 2
 network 3.3.3.3 0.0.0.0 area 0
 network 4.4.4.4 0.0.0.0 area 4
 network 172.16.1.0 0.0.0.255 area 0
!

R2#sh ip ospf data

            OSPF Router with ID (22.22.22.22) (Process ID 1)

                Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
22.22.22.22 22.22.22.22 167 0x80000006 0x00FCC3 2
44.44.44.44 44.44.44.44 2025 0x80000005 0x008FBB 3

                Summary Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum
1.1.1.0 22.22.22.22 167 0x80000002 0x00D609
2.2.2.2 44.44.44.44 232 0x80000002 0x00087A
4.4.4.4 44.44.44.44 232 0x80000002 0x00ABCE

                Router Link States (Area 1)

Link ID ADV Router Age Seq# Checksum Link count
11.11.11.11 11.11.11.11 142 0x80000005 0x00AB18 1
22.22.22.22 22.22.22.22 167 0x80000006 0x00B4BE 1

                Net Link States (Area 1)
          
Link ID ADV Router Age Seq# Checksum
1.1.1.2 11.11.11.11 142 0x80000002 0x00E1A1

                Summary Net Link States (Area 1)

Link ID ADV Router Age Seq# Checksum
2.2.2.2 22.22.22.22 1076 0x80000001 0x002378
3.3.3.3 22.22.22.22 170 0x80000002 0x00F2A3
4.4.4.4 22.22.22.22 1076 0x80000001 0x00C6CC
172.16.1.0 22.22.22.22 170 0x80000004 0x00DE05

Then I apply a access-list to filter both 2.2.2.2/32 and 4.4.4.4/32 at R2:
router ospf 1
 distribute-list 1 in
!
access-list 1 deny 2.2.2.2
access-list 1 deny 4.4.4.4
access-list 1 permit any

Check the routing table in R1, R2 and database in 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, 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

     1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 172.16.1.2, 00:01:08, Serial0/0.1
     172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Serial0/0.1
R2#sh ip ospf database

            OSPF Router with ID (22.22.22.22) (Process ID 1)

                Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
22.22.22.22 22.22.22.22 336 0x80000006 0x00FCC3 2
44.44.44.44 44.44.44.44 146 0x80000006 0x008DBC 3

                Summary Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum
1.1.1.0 22.22.22.22 336 0x80000002 0x00D609
2.2.2.2 44.44.44.44 401 0x80000002 0x00087A
4.4.4.4 44.44.44.44 401 0x80000002 0x00ABCE

                Router Link States (Area 1)

Link ID ADV Router Age Seq# Checksum Link count
11.11.11.11 11.11.11.11 311 0x80000005 0x00AB18 1
22.22.22.22 22.22.22.22 336 0x80000006 0x00B4BE 1

                Net Link States (Area 1)
          
Link ID ADV Router Age Seq# Checksum
1.1.1.2 11.11.11.11 311 0x80000002 0x00E1A1

                Summary Net Link States (Area 1)

Link ID ADV Router Age Seq# Checksum
3.3.3.3 22.22.22.22 338 0x80000002 0x00F2A3
172.16.1.0 22.22.22.22 338 0x80000004 0x00DE05

R1#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, 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

     1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Ethernet0/1
     3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/75] via 1.1.1.1, 00:37:11, Ethernet0/1
     172.16.0.0/24 is subnetted, 1 subnets
O IA 172.16.1.0 [110/74] via 1.1.1.1, 00:37:17, Ethernet0/1

Next, I apply another access-list to filter the 3.3.3.3/32 route at R2,
router ospf 1
 distribute-list 2 in
!
access-list 2 deny 3.3.3.3
access-list 2 permit any

and check with the routing table of R1 and R2, and database in R2 again.
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, 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

     1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/65] via 172.16.1.2, 00:02:50, Serial0/0.1
     4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/65] via 172.16.1.2, 00:02:50, Serial0/0.1
     172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Serial0/0.1
R2#sh ip ospf data

            OSPF Router with ID (22.22.22.22) (Process ID 1)

                Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
22.22.22.22 22.22.22.22 681 0x80000006 0x00FCC3 2
44.44.44.44 44.44.44.44 491 0x80000006 0x008DBC 3

                Summary Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum
1.1.1.0 22.22.22.22 681 0x80000002 0x00D609
2.2.2.2 44.44.44.44 746 0x80000002 0x00087A
4.4.4.4 44.44.44.44 746 0x80000002 0x00ABCE

                Router Link States (Area 1)

Link ID ADV Router Age Seq# Checksum Link count
11.11.11.11 11.11.11.11 656 0x80000005 0x00AB18 1
22.22.22.22 22.22.22.22 681 0x80000006 0x00B4BE 1

                Net Link States (Area 1)
          
Link ID ADV Router Age Seq# Checksum
1.1.1.2 11.11.11.11 656 0x80000002 0x00E1A1

                Summary Net Link States (Area 1)

Link ID ADV Router Age Seq# Checksum
2.2.2.2 22.22.22.22 180 0x80000001 0x002378
3.3.3.3 22.22.22.22 685 0x80000002 0x00F2A3
4.4.4.4 22.22.22.22 180 0x80000001 0x00C6CC
172.16.1.0 22.22.22.22 685 0x80000004 0x00DE05

R1#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, 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

     1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Ethernet0/1
     2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/75] via 1.1.1.1, 00:03:30, Ethernet0/1
     3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/75] via 1.1.1.1, 00:42:43, Ethernet0/1
     4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/75] via 1.1.1.1, 00:03:30, Ethernet0/1
     172.16.0.0/24 is subnetted, 1 subnets
O IA 172.16.1.0 [110/74] via 1.1.1.1, 00:42:48, Ethernet0/1

I was very confused about the result. Please help to comment on the results.
Thanks a lot.

Best Regards,
William



This archive was generated by hypermail 2.1.4 : Fri Dec 12 2003 - 12:29:09 GMT-3