cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
975
Views
0
Helpful
6
Replies

OSPF configuration question

I am studying for my CCNA exam and I'm not sure if this is the right forum but here's my question:

What is the difference between these 2 configurations:

1. router ospf 1

network 192.168.0.1 0.0.0.0 area 0

network 192.168.1.1 0.0.0.0 area 0

2. router ospf 1

network 192.168.0.1 0.0.0.255 area 0

network 192.168.1.1 0.0.0.255 area 0

I know we're applying the wildcard mask after the network but I just need some examples of when you would use one or the other.

6 Replies 6

nhabib
Level 9
Level 9

You would use the first example when advertising a loopback interface

The second one would be for advertising a network.

Probably better off doing the second example in the following manner:

router ospf 1

network 192.168.0.0 0.0.0.255 area 0

network 192.168.1.0 0.0.0.255 area 0

You could actually use any of the two examples to enable OSPF on a given interface.

The first example would enable OSPF on the interface configured with the specific /32 but would advertise whatever subnet mask configured on the interface.

The second example would enable OSPF on any interface with an IP address in the /24 ranges (192.168.0.0/24 and 192.168.1.0/24) and would also advertise the subnets configured on the different interfaces.

Hope this helps,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

Both options will work if 192.168.0.1 & 192.168.1.1 are IP addresses of interfaces on the router. The inverse mask is there to limit (or expand) the interfaces OSPF runs on and what gets advertised. For example if you had the following:

interface 1 192.168.0.1/26

interface 2 192.168.0.65/26

interface 3 192.168.0.129/26

interface 4 192.168.0.193/26

Then you could control individually ospf on each interface with the commands:

router ospf 1

network 192.168.0.1 0.0.0.0 area 0

network 192.168.0.66 0.0.0.0 area 0

network 192.168.0.129 0.0.0.0 area 0

network 192.168.0.193 0.0.0.0 area 0

(You could also make the interfaces be in different areas by changing the 'area')

If you didn't need the flexibility and just wanted all the interfaces to be in area 0 then configuring the following will accomplish this as the inverse mask covers all the interface addresses:

router ospf 1

network 192.168.0.0 0.0.0.255 area 0

I generally try to add interface addresses individually (with 0.0.0.0 inverse masks). On Distribution switches though where you are terminating a lot of access vlans/subnets it is good practise to make these subnets contiguous and use a wildcard in the inverse mask. That way the configuration is kept simpler (smaller).

Whatever the inverse mask of the network command is there is no difference in how OSPF advertises the networks though; i.e. if an interface has a /30 mask the network LSA will be /30 (unless of course you are summarising with network range commands).

HTH

Andy

ekhoo
Level 1
Level 1

OK.. the network statement in OSFP configuration is to tell router which interface to participate in OSPF routing. It has nothing to do with the route advertisement. That is.

The first config with 0.0.0.0 mask tell your router the exact interface to run OSPF.

The second config with 0.0.0.255 mask tell your router any interfaces that match the mask to run OSPF.

Normally, “network 192.168.0.1 0.0.0.255 area 0,” config should look like this “network 192.168.0.0 0.0.0.255 area 0”, after you entered into your router. the router would change the .1 to .0 and any interface within this mask .0 - .255 will run OSPF.

The same rule apply to this statement ”network 0.0.0.0 255.255.255.255 area 0” this rule tells the router that any interface with a ip address would participate in OSPF routing.

Hope this help..

Guys,

2 cents

You can use normal subnet mask as well in the network command. IOS automatically changes it to Wildcard mask.

conf t

int fa0/0

ip add 1.1.1.1 255.255.255.0

router ospf 1

net 1.1.1.0 255.255.255.0 area 0

end

show run | begin router ospf 1

router ospf 1

net 1.1.1.0 0.0.0.255 area 0

Cheers

Hi

The basic difference lies in the wildcard mask concept.In a wildcard mask which ever bits are zero are considered significant(exactly opposite to what u have in a subnet mask !! ).

Here in the first case since all bits of the WC Mask are zero, ospf will add 192.168.0.1 and 192.168.1.1 ONLY to the table(since an exact match had to be made).But in the second case since first 24 bits are zero,only those 24 bits are matched ..which means that the network(192.168.0.0 and 192.168.1.0) will be added as such.....

Regards

Hari

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: