4

I'm just now starting to get into the network side of things and I'm trying to learn how OSPF routing is setup on Cisco. If I configure a static route on a device that is part of an OSPF neighborhood will that route then be advertised to its neighbors? Or do I need to setup the static route on each device to point to the next hop?

I realize this is likely a very basic question and apologize for that in advance!

Thanks for any help you folks can provide.

1
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Jan 5 '21 at 23:22
4

Static routes will not be advertised unless you redistribute them into the OSPF process.

The basic command is

router ospf x
redistribute static subnets metric y

BUT, there are a lot of things to consider about when and how you are redistributing. More details about your network would help with a more complete answer.

3

In the most basic scenario; you just enable OSPF, give it the networks to distribute, and that's it.

For instance;

Router>enable
Router#conf t
Router(config)router ospf 1
Router(config-router) network x.x.x.x y.y.y.y area 0
...

Here, x.x.x.x is the network address and y.y.y.y is the wild card mask. A wild card mask appears just like subnet mask, only bitwise negated. For instance, if your subnet mask is 255.255.255.0, corresponding wildcard is 0.0.0.255. You can think it like this; if you add each byte of the subnet mask and the wildcard individually, you will always get 255.255.255.255.

For local networking, just leave the number after the "area" 0. Also, the number after "router ospf" is related to the workings of the ios.

After that, or before that, order is not important, you can add your static routes without any special effort. But remember that there is an option just to redistribute the default route. You can do this by issueing

Router(config-router)default-information originate

command.

4
  • Important to note that Area 0 is maintained as the "backbone" area. Also, wildcard masks are created using a technique called Supernetting which you may want to read about if you plan to do this type of OSPF routing for different class networks.
    – HAL
    Jun 20 '14 at 18:38
  • This is very helpful, thanks. So say I have 4 devices (v, x, y, and z), and I set an OSPF route on y to send to z as the next hop, will a route be sent automatically to x telling it to forward to y, and a route sent to v telling it to forward to x? I appreciate your help! Jun 20 '14 at 19:05
  • Depends on your topology. Can you provide it? Jun 21 '14 at 10:41
  • Please beware that the "network" command will also enable OSPF on ALL interfaces that are inside this network mask. That is probably not what you want. Use "passive-interface default" in your OSPF configuration and enable the active OSPF interfaces individually to prevent a security problem. Jun 23 '14 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.