Pepe Manshon
Timish

Configuring OSPF on router (with Packet Tracer)

19 July 2010 46624 views 0 comments 18 recommendations tags:
In a previous post (Subnetting a network) I mentioned how we can subnet given IP address with mask into number of smaller networks. Now that we know how to do it we can actually move further and configure the layer 3 devices, such as routers, to maintain the traffic in this subnetted network.

Say we’ve got this schema to work on:

Schema of cable connections between hosts and routers.
Schema of cable connections between hosts and routers with Packet Tracer. Credits: pepemanshon.com


It is important to remember that we use ethernet crossover cable to connect hosts with routers, and straight-through cable to connect routers with routers. Hosts are connected through their FastEthernet interfaces and routers – with their Serial interfaces.

Here’s a video of how to maintain the connections step by step:



Now that we wired the whole thing first thing we need to do is set up all those annoying routers’ interfaces. The commands for this job are:
Router> en
Router# config t
Router(config)# int Fa0/0
Router(config-if)# ip addr 192.168.158.126 255.255.255.128
Router(config-if)# no sh

And for the serial interfaces:
Router(config)# int S0/0/0
Router(config-if)# ip addr 192.168.158.126 255.255.255.128
Router(config-if)# clock rate 64000
Router(config-if)# no sh

IP addresses and subnet masks for all interfaces are as follows:

Router HQ:

  • fa0/0: 192.168.158.1, 255.255.255.128
  • fa0/1: 192.168.158.129, 255.255.255.192
  • s0/0/0: 192.168.159.97, 255.255.255.252
  • s0/0/1: 192.168.159.101, 255.255.255.252


Router R1:

  • fa0/0: 192.168.159.65, 255.255.255.224
  • fa0/1: 192.168.158.193, 255.255.255.192
  • s0/0/0: 192.168.159.98, 255.255.255.252


Router R2:

  • fa0/0: 192.168.157.1, 255.255.255.0
  • fa0/1: 192.168.159.1, 255.255.255.192
  • s0/0/1: 192.168.159.102, 255.255.255.252


Keep in mind that:

/24 = .0
/25 = .128
/26 = .192
/27 = .224
/28 = .240 and so on


The commands to configure OSPF on the router are:

Router(config)# router ospf 1
Router(config-router)# network 192.168.158.0 0.0.0.127 area 0


where 192.168.158.0 is the network address, and 0.0.0.127 is the wildcard mask. The easiest way to get the wildcard mask of a network is to subtract the subnet mask from 255 – in the fa0/0 example the subnet mask is 255.255.255.128 so the wildcard mask will be 255-128 = 127 (apparently 255-255=0) – 0.0.0.127

We do this with all the routers, and the networks to add in ospf routing map are:

HQ:

  • network 192.168.158.0 0.0.0.127 area 0
  • network 192.168.158.128 0.0.0.63 area 0
  • network 192.168.159.96 0.0.0.3 area 0
  • network 192.168.159.100 0.0.0.3 area 0


R1:

  • network 192.168.159.64 0.0.0.31 area 0
  • network 192.168.158.192 0.0.0.63 area 0
  • network 192.168.159.96 0.0.0.3 area 0


R2:

  • network 192.168.157.0 0.0.0.255 area 0
  • network 192.168.159.0 0.0.0.63 area 0
  • network 192.168.159.100 0.0.0.3 area 0


Here’s a video how to do it step by step:



Once you’re done with this you need to setup the hosts configuration (ip address, subnet mask and gateway) and you’re good to go.

You can setup hosts like this (just remember default gateway is the ip address of the router interface, which is connected to the host, that we configure). I like using eighter first possible or last possible ip address of each subnet, but of course you may choose whichever ip address you like, as logn as it’s in the subnet range:

H1:

  • IP – 192.168.158.126
  • M – 255.255.255.128
  • GW – 192.168.158.1


H2:

  • IP – 192.168.158.190
  • M – 255.255.255.192
  • GW – 192.168.158.129


H3:

  • IP – 192.168.159.94
  • M – 255.255.255.224
  • GW – 192.168.159.65


H4:

  • IP – 192.168.158.254
  • M – 255.255.255.0
  • GW – 192.168.158.193


H5:

  • IP – 192.168.159.62
  • M – 255.255.255.192
  • GW – 192.168.159.1


H6:

  • IP – 192.168.157.126
  • M – 255.255.255.0
  • GW – 192.168.157.1


Once you do this you can start pinging computers from each other and hopefully everything will work like charm.

The whole example is based on Cisco Lab (which happened to by my exam as well). I’d be glad if it helps somebody with this issue :)
Comments