0

If I run the command sh ip int bri | inc down, I can filter to see which ports are down or admin down. Some interfaces may still have configuration on them but I am curious to know if there is a way to see which ports are defaulted without having to do a sh run for each interface?

For example is there a way I can filter which interfaces have this default configuration?

Switch#sh run int GigabitEthernet1/1 
Building configuration...

Current configuration : 61 bytes
!
interface GigabitEthernet1/1
no ip address
shutdown
end
3
  • Are you saying you want to filter on information that is not in the interface? You can only filter on what is there, not what is not there. – Ron Maupin Oct 20 '16 at 14:36
  • just show run and eyeball it. The show ip int br gives you a quick summary of all the int status. I guess that's not what you're looking for but ... i dunno. Each line can be defaulted by saying, e.g., default ip address, default description, as far as I remember. Certainly wr erase gets you back to default the quickest. – Ronnie Royston Oct 22 '16 at 3:44
  • 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 provide and accept your own answer. – Ron Maupin Aug 15 '17 at 4:07
2

For example is there a way I can filter which interfaces have this default configuration?

Found a rather different solution for this, you need to have pcregrep installed on linux server from where you are doing ssh to the router, Run the following command:

 ssh "Username"@"IP of the router" "sh run" | pcregrep -M  'interface.*\n.*no ip address.*\n.*shutdown.*\n.*!'

This would work with default interface configuration provided by you i.e.

Switch#sh run int GigabitEthernet1/1 
Building configuration...

Current configuration : 61 bytes
!
interface GigabitEthernet1/1
no ip address
shutdown
end

Any other configuration(if different from this) of default configuration like variations in IOS-XR, IOS-XE or a Switch can be put in instead of the current lines.

Hope this helps!

9
  • You can have interfaces which were not defaulted that have no IP address on them. There could be a lot of other configurations on the interface. For example, an interface which has subinterfaces for a trunk will have the IP addresses on the subinterfaces, but the physical interface will not. Such an interface has not been defaulted. – Ron Maupin Oct 24 '16 at 4:35
  • Please read the solution, again I have taken that into account from interface name till end of the interface configuration. "an interface which has subinterfaces for a trunk will have the IP addresses on the subinterfaces" -- will not have shutdown on trunk interface. – Anirudh Malhotra Oct 24 '16 at 4:37
  • 1
    I still don't believe you have taken into account everything. For instance, why do you have "end" in there. That is not something that shows up in an interface configuration. There can be other configurations in an interface which has no ip address and shutdown. Those interfaces have not been defaulted. – Ron Maupin Oct 24 '16 at 4:46
  • I just looked at a router that had the IP address removed and the interface shut, but it starts off just like what the OP has, but it has a lot of other configuration after the shutdown. The interface was never defaulted. – Ron Maupin Oct 24 '16 at 4:49
  • edited: removed end and added "!" instead , Any more cases are welcome. Editions are always welcome :). In the end we have to provide a solution and that is important. – Anirudh Malhotra Oct 24 '16 at 4:49

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.