2 September 2010

IOS: Clearing an Interface Configuration

Interface is full

This occurs most commonly when you are labbing or testing something and an interface ends up with a lot of configuration, possibly something like the following:

Router(config-if)#do sh run int fa0/0
Building configuration…

Current configuration : 320 bytes
!
interface FastEthernet0/0
description Show the Default command
ip dhcp relay information trusted
ip address 198.18.56.1 255.255.255.0
no ip route-cache cef
no ip route-cache
ip ospf authentication-key MYOHMY
ip ospf network point-to-point
ip ospf hello-interval 20
duplex half
standby 1 ip 198.18.54.90
end

Router(config-if)#

You want to clear this configuration and reuse the interface for some other task. Normally you would need to issue a the “no” command for each line.

The ‘default’ command

The default command has many uses, and this is only one of them, but possibly it is the most useful.

Router(config-if)#default interface fa0/0
Building configuration…

Interface FastEthernet0/0 set to default configuration
Router(config)#do sh run int fa0/0
Building configuration…

Current configuration : 61 bytes
!
interface FastEthernet0/0
no ip address
duplex half
end

Router(config)#

That’s it. Simple and elegant.

Please rate this post:

1 Star - It\\\'s Crud2 Stars - It\\\'s Tosh3 Stars - Something\\\'s missing4 Stars - Needs works5 Stars - Good Enough6 Stars - Good7 Stars - Excellent8 Stars - Brilliant9 Stars - Astonishing10 Stars - Awesomely Godlike? (4 votes, average: 9.00 out of 10)
Loading ... Loading ...

About Greg Ferro
Greg is a Network and Security Architect / Designer / Engineer working freelance in the UK and worked for Resellers, DotCom's, Large Corporate's and Service Providers across a variety of products & Vendors. He prefers to work for end users, believes in the life cycle, total cost of ownership and that near enough is often good enough. He likes talking about himself in the first person to feel "royal", even when hosting the Packet Pushers Podcast on Data Networking. More about Greg at http://etherealmind.com/who-am-i/ and you can follow him on Twitter.

Comments

  1. Beware of it on production switches, though! By default, switchports are not shutdown and defaulting will make them come up, possibly in the wrong VLAN. Of course, STP should not make this too dangerous, but it’s a good thing to be aware of. What I usually do is:

    default interface X
    interface X
    shutdown
    ! whatever else I need to do

  2. Aaron says:

    I had to teach that one to some of our new boys this past week.

    You can also use the range directive to reset configs on a whole mess of ports.

    Router(config)#default int range f0/0/0 – 4

    Or something like that.

  3. Oldpaul says:

    I also like using it with the individual interface commands, if I only want to “default” something on an interface:

    conf t > int f0/0 > default speed > default duplex

  4. Oldpaul says:

    Marko, I just tested default interface command on my 6500, and it *does* retain the shutdown/noshutdown state of the interface. Everything else was “defaulted”.

Speak Your Mind

*