Thursday, August 23, 2012

Advertise default route under OSPF



In this example I will explain where and how to advertise default route under ospf process to send to other ospf routers.
From diagram you can see topology, it's not complex but is good for this purpose.
First I will list configuration of router R1 and R2 and configuration itself from both routers.

R1 is configured for:

- NAT overload
- Serial interface S1/0 as NAT inside with IP address 10.150.20.1/30, and interface on ISP direction with NAT outside with IP received from ISP DHCP server.
- OSPF routing protocol advertising on interface S1/0 or specific IP address 10.150.20.1/30

!
hostname R1
!
ip domain name lab.local
ip name-server 4.2.2.2
ip name-server 192.168.1.1
!
interface FastEthernet0/0
 ip address dhcp
 ip nat outside
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 10.150.20.1 255.255.255.252
 ip nat inside
 clock rate 64000
!        
router ospf 1
 network 10.150.20.1 0.0.0.0 area 0
!
!        
ip nat inside source list NAT_ADDRESSES interface FastEthernet0/0 overload
!
ip access-list standard NAT_ADDRESSES
 permit 192.168.10.0 0.0.0.255
!
end

There is no command for static route because I received that route from my Linksys which I'm using for access the Internet. Addition: I read that if interface which have enabled ip address dhcp router will automatically learn default route, which is case in this example.
S*   0.0.0.0/0 [254/0] via 10.143.88.254 -- Linksys IP address

R2 router is configured for:
- OSPF routing protocol for area 0 and advertising networks 192.168.10.0/24 and 10.150.20.0/30

hostname R2
!
no ip domain lookup
ip domain name lab.local
!
interface FastEthernet0/0
 ip address 192.168.10.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 10.150.20.2 255.255.255.252
!
router ospf 1
 network 10.150.20.0 0.0.0.3 area 0
 network 192.168.10.0 0.0.0.255 area 0
!
end

At this moment R2 or I should say users from LAN 192.168.10.0/24 doesn’t know how to goes beyond R1 to the Internet.
Because R1 doesn’t advertise his default route to other routers under OSPF process.

To advertise default route from R1 issue command under OSPF process, in this case is 1, default-information originate.
What that means is send default information and originate, send it to all OSPF routers under that process, our case ospf process 1.

Here are results from R1 issued with command...

R2#show 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 10.150.20.1 to network 0.0.0.0

C    192.168.10.0/24 is directly connected, FastEthernet0/0
     10.0.0.0/30 is subnetted, 1 subnets
C       10.150.20.0 is directly connected, Serial1/0
O*E2 0.0.0.0/0 [110/1] via 10.150.20.1, 01:31:21, Serial1/0

Now let's see if host from network 192.168.10.0/24 can access the Internet.

C:\Documents and Settings\Administrator>ping 4.2.2.2

Pinging 4.2.2.2 with 32 bytes of data:

Reply from 4.2.2.2: bytes=32 time=88ms TTL=50
Reply from 4.2.2.2: bytes=32 time=79ms TTL=50
Reply from 4.2.2.2: bytes=32 time=85ms TTL=50
Reply from 4.2.2.2: bytes=32 time=86ms TTL=50

Ping statistics for 4.2.2.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 79ms, Maximum = 88ms, Average = 84ms



No comments:

Post a Comment