OSPF passive interfaces prevent hello packets from being transmitted on network segments where routing updates are unnecessary, reducing resource consumption and eliminating a significant attack surface.
OSPF Passive Interface
We've been talking a lot about these OSPF packets and how they get sent out on these interfaces. The problem with that is it does eat up some resources, and even more importantly, can present a bit of a security risk. So let's talk about how we can make an interface passive and not have these.
When we set up OSPF on our networks, we use this network statement of 10.0.0.0, and slash eight essentially is what that is. What that does is it specifies both what networks are going to be sent out with its updates, but also which interfaces that's going to be sent out on. That becomes a little problematic.
This layer 3 switch right here, we want these networks that are connected to it, all of these VLANs, we want that to be sent out and broadcasted out to the rest of the network, so the rest of the network knows how to get to these VLANs. The problem is, once again, that presents a little bit of a — well, number one, it uses up some resources, because it's sending out into that network and then all of these devices are listening to that. And the second problem is that it presents a little bit of a security risk.
Let me just show you what I mean here. I'm going to pull up Wireshark here, and I'm going to set up ethernet. So I'm going to click on the ethernet connection right here, and as we go through here we see some spanning tree messages, and here we see an OSPF message right here. Notice it's a multicast address, 224.0.0.5. So what's going to happen is it's getting to this computer, and this computer says, ah, I don't need that, and gets rid of it. So it's eating up resources of this computer. Not a lot, but it is a little bit.
The second problem with this is it's also a piece of information that I can get. I know OSPF is running. I could set up OSPF and start leveraging this for something that I want to do to the network, like gather information and figure out — there's a lot of information in OSPF, so I can start figuring out what the network looks like and start attacking individual pieces of equipment that's out there.
Or another thing I could do is I could just start participating. I can actually say, hey, I want to be a part of this OSPF area, and I then can insert bad information in there, and then traffic's going to start coming to me. Or it's a denial of service attack, so either the traffic's not getting to where it's supposed to go, or it's being routed through me and I've got this man-in-the-middle attack. So I can use this to the advantage.
Since we've got this open, I might as well just open up and take a look at this. Open shortest path first — we see the OSPF header like we were talking about, so that's pretty cool. We see the hello packet in here, and so we can see some different information inside of the hello packet, the things that we had already discussed, such as the router priority, the router dead interval, and the hello interval. So we see those pieces of information in there.
Anyways, we don't want this. We don't want this to be sent out on our network, and it's a pretty simple command to stop this from happening. So what I'm going to do is pull up that switch. This is part of VLAN 10. So I'm going to get into VLAN 10. I'm going to go into the global configuration mode, and then interface VLAN — or, excuse me, I actually am going to do a router ospf and our process ID of 10. Then I'm going to give the command passive-interface VLAN 10, and we're going to hit enter there.
So now what we're going to do is look to see if we're still going to get those OSPF messages. The last message I got is right here, and it should come in every 10 seconds. So all I need to wait is 10 seconds to see if it gets any more. So far we're good. So now this simple command has cleared it up, where I'm not getting those hello messages, those OSPF messages, into the network. We've waited at least a good 10 seconds now, and we don't see that. So wherever you have it, that's how we do it.
If I want to undo this command, I would just go in here and put no at the front of it, and as soon as we do that, we should start seeing the OSPF messages pop up in here again. And there it is.
So that is a command that you'll want to put in on your network, so that way you're not sending out this traffic into your VLANs and into your networks.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →