CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

When reallocating switch ports for new workloads, moving patch cables, or troubleshooting misconfigured services, network administrators frequently need to wipe existing port parameters. Manually typing no in front of dozens of commands—such as VLAN assignments, trunk encapsulations, spanning-tree port types, and QoS policies—is tedious and prone to human error.

Cisco networking operating systems provide built-in commands to purge non-default configurations instantly. Whether you are managing traditional Cisco IOS/IOS-XE Catalyst switches or data center Nexus platforms running NX-OS, this guide details the exact syntax, operational impacts, multi-port procedures, and automation templates required to reset switch ports to factory defaults safely.


Cisco IOS/IOS-XE Command Reference: default interface

Syntax

default interface <interface-id>
default interface range <interface-range>

Command Mode

Global Configuration mode (config#)

Parameters and Arguments

  • interface-id: The type and physical identity of the interface (e.g., GigabitEthernet 1/0/1, FastEthernet 0/24, TenGigabitEthernet 1/1/1, Port-channel 10).
  • range: A keyword allowing batch execution across multiple sequential or comma-separated interfaces (e.g., GigabitEthernet 1/0/1 - 12).

Supported Platforms and Software Versions

The default interface command is supported across all modern enterprise Cisco operating systems, including:
* Cisco IOS Release 12.1(5)T and later
* Cisco IOS 12.2, 15.0, 15.2 Mainline and SE releases (Catalyst 2960, 3560, 3750, 2960-X series)
* Cisco IOS-XE 16.x and 17.x (Bengaluru, Cupertino, Dublin, etc.) (Catalyst 3650, 3850, Catalyst 9200, 9300, 9400, 9500, 9600 series)

Usage Guidelines

  • The command immediately erases all user-defined configurations applied under the interface sub-configuration hierarchy.
  • The command cannot be negated with no default interface. Once entered, changes take effect immediately in the active running-config.
  • When applied to virtual interfaces (such as an SVI or port-channel), running default interface purges their settings, but it does not delete the logical entity from NVRAM or the active database.

How to Default a Single Switch Port in Cisco IOS/IOS-XE

Follow this step-by-step workflow to safely restore a single physical port to factory settings on Catalyst switches running Cisco IOS or IOS-XE.

Step 1: Connect and Enter Privileged EXEC Mode

Access the switch CLI via console, SSH, or Telnet and escalate privileges:

Switch> enable
Switch#

Step 2: Inspect the Current Interface Configuration

Before removing any configuration, display the active settings to confirm you are targeting the correct physical port:

Switch# show running-config interface GigabitEthernet 1/0/1
Building configuration...

Current configuration : 184 bytes
!
interface GigabitEthernet1/0/1
 description Workstation-Finance
 switchport access vlan 20
 switchport mode access
 switchport voice vlan 120
 spanning-tree portfast
 spanning-tree bpduguard enable
end

Step 3: Enter Global Configuration Mode

The default interface command must be run from global configuration mode, not from within interface sub-configuration mode:

Switch# configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#

Step 4: Execute the default interface Command

Issue the command with the exact interface type and number:

Switch(config)# default interface GigabitEthernet 1/0/1
Interface GigabitEthernet1/0/1 set to default configuration
Switch(config)#

Step 5: Verify the Port Status

Return to privileged EXEC mode (or use the do prefix) and confirm that all custom parameters have been removed:

Switch(config)# do show running-config interface GigabitEthernet 1/0/1
Building configuration...

Current configuration : 38 bytes
!
interface GigabitEthernet1/0/1
end

Step 6: Administratively Secure the Port and Save Configuration

As detailed in the operational impact section below, defaulting an IOS switch port leaves it enabled by default. If the port is not being used immediately, apply a shutdown and write the changes to startup NVRAM:

Switch(config)# interface GigabitEthernet 1/0/1
Switch(config-if)# shutdown
Switch(config-if)# end
Switch# copy running-config startup-config
Destination filename [startup-config]? [Enter]
Building configuration...
[OK]

How to Default a Range of Switch Ports Simultaneously

When provisioning bulk patch panels, repurposing switch line cards, or reprovisioning an entire edge switch, resetting individual ports one by one is inefficient. You can execute default interface range across both contiguous and non-contiguous interfaces in a single command.

Resetting a Contiguous Range of Ports

To reset a sequential block of interfaces, combine the default interface range command with a hyphen.

Syntax Rule: In Cisco IOS/IOS-XE CLI parsing, you must include a space before and after the hyphen (e.g., 1/0/1 - 12). Omitting the space will result in a syntax parsing error (% Invalid input detected at '^' marker).

Switch# configure terminal
Switch(config)# default interface range GigabitEthernet 1/0/1 - 24
Reset GigabitEthernet1/0/1 to default configuration
Reset GigabitEthernet1/0/2 to default configuration
...
Reset GigabitEthernet1/0/24 to default configuration
Switch(config)#

Resetting Non-Contiguous (Disjointed) Ports

To reset multiple interfaces that are not sequential, separate individual interfaces or sub-ranges using commas:

Switch(config)# default interface range GigabitEthernet 1/0/1 - 4, GigabitEthernet 1/0/9, GigabitEthernet 1/0/15 - 18

Execution Verification

You can inspect the entire range at once using the show interface status command to confirm that the names, duplex modes, and VLANs have reverted across all target interfaces:

Switch(config)# do show interface status | include Gi1/0/
Gi1/0/1                      notconnect   1            auto   auto 10/100/1000BaseTX
Gi1/0/2                      notconnect   1            auto   auto 10/100/1000BaseTX
...
Gi1/0/24                     notconnect   1            auto   auto 10/100/1000BaseTX

Understanding What the default interface Command Does (FAQ)

What configuration settings are wiped when an interface is defaulted?

Every user-configured line item under the interface hierarchy is removed. This includes:
* Interface metadata: Port descriptions and tracking tags.
* Switchport parameters: Access VLAN, voice VLAN, trunk native VLAN, allowed VLAN lists, trunking encapsulation, and dynamic trunking protocol (DTP) modes.
* Layer 3 parameters: IP addresses, subnet masks, VRF assignments, helper addresses, routing protocol statements (OSPF/EIGRP/BGP), and MTU overrides.
* Security & Port Control: Port security (MAC limits, sticky MACs), 802.1X/MAB authentication configurations, storm control thresholds, and DHCP snooping trust.
* Spanning Tree Protocol: PortFast, BPDU Guard, BPDU Filter, Root Guard, and link-type tuning.
* QoS and ACLs: Input/output access lists, service policies, and queue bandwidth allocations.

Does defaulting a switch port shut it down?

No, on standard Cisco IOS and IOS-XE Layer 2 Catalyst switches, defaulting an interface does not leave it shut down.

By default, Layer 2 Ethernet switch ports on Catalyst platforms reside in an administratively enabled state (no shutdown). If you run default interface on a port that was previously disabled with shutdown, the command clears the shutdown statement, inadvertently bringing the port up!
* If a host or rogue device is physically plugged in, it will immediately link up in the switch’s default VLAN.
* Conversely, on Layer 3 routed interfaces, Cisco IOS routers, and Cisco Nexus NX-OS switches, the factory default administrative state is shutdown.

What VLAN does a defaulted port belong to?

On Cisco Catalyst switches, all Layer 2 interfaces default to VLAN 1 as untagged access ports (or dynamic desirable/auto, depending on older IOS defaults). Defaulting a port that was previously isolated on a restricted DMZ or guest network will immediately drop that port back into the default management VLAN 1.

Can I undo a default interface command?

No. Cisco IOS does not maintain a native “undo” buffer for defaulted interfaces. Unless you have configured the Cisco IOS archive feature with rollback checkpoints, the previous commands cannot be restored automatically. Always execute a show running-config interface <id> or save your running configuration prior to defaulting ports in a production environment.


Resetting Switch Ports in Cisco Nexus NX-OS

Data center switches running Cisco NX-OS handle interface defaulting differently than Catalyst switches. NX-OS introduces configuration checkpoints, handles range syntax without strict spacing rules, and maintains an administrative default of shutdown.

Syntax Variations in NX-OS

  • Contiguous ranges do not require spaces: You can issue interface ethernet 1/1-10.
  • Built-in Checkpoints: NX-OS allows you to generate a configuration checkpoint simultaneously, providing a safety net if you need to roll back.

Step-by-Step NX-OS Interface Defaulting Guide

Step 1: Default the Port (with Optional Checkpoint)

Enter configuration mode and run the default interface command. You can pass the optional checkpoint keyword followed by an identifier:

Nexus-switch# configure terminal
Nexus-switch(config)# default interface ethernet 1/5 checkpoint port_reset_bak
.......Done
Nexus-switch(config)#

Step 2: Defaulting Ranges on NX-OS

To default a contiguous block of ports on NX-OS:

Nexus-switch(config)# default interface ethernet 1/10-15

For non-contiguous ports, specify each interface type explicitly:

Nexus-switch(config)# default interface ethernet 1/20, ethernet 1/24, ethernet 1/28

Step 3: Re-enable the Port

Unlike IOS Catalyst switches, NX-OS defaults interfaces to an administrative status of shutdown. To place the defaulted port into service, navigate to the interface and execute no shutdown:

Nexus-switch(config)# interface ethernet 1/5
Nexus-switch(config-if)# no shutdown
Nexus-switch(config-if)# end

Step 4: Rollback (If Required)

If you generated a checkpoint during Step 1 and need to restore the port configuration, execute the rollback command:

Nexus-switch# rollback running-config checkpoint port_reset_bak

Automating Switch Port Resets with Python and Ansible

For multi-switch deployments or scheduled network maintenance, automated scripts eliminate manual CLI work. Below are turnkey automation templates using Python (Netmiko) and Ansible.

Python Template (Netmiko)

This script authenticates over SSH to a Cisco IOS/IOS-XE switch, defaults a designated list of individual ports and ranges, enforces an administrative shutdown on them for security, and commits the changes to startup memory.

#!/usr/bin/env python3
"""
Script: cisco_port_default.py
Description: Connects to a Cisco IOS/IOS-XE device and defaults specified switchports.
"""

from netmiko import ConnectHandler
from netmiko.exceptions import NetmikoTimeoutException, NetmikoAuthenticationException

# Device connection parameters
device = {
    "device_type": "cisco_ios",
    "host": "192.168.10.2",
    "username": "netadmin",
    "password": "SecurePassword123!",
    "secret": "EnableSecret123!",
}

# Ports or port-ranges to default
interfaces_to_default = [
    "GigabitEthernet1/0/5",
    "GigabitEthernet1/0/6",
    "range GigabitEthernet1/0/20 - 24",
]

def default_cisco_ports():
    try:
        print(f"Connecting to {device['host']}...")
        with ConnectHandler(**device) as conn:
            conn.enable()

            # Build command list
            commands = []
            for target in interfaces_to_default:
                commands.append(f"default interface {target}")
                # Optional: Force shutdown on defaulted ports for hygiene
                commands.append(f"interface {target}")
                commands.append("shutdown")

            print("Executing default commands...")
            output = conn.send_config_set(commands)
            print(output)

            print("Saving running-config to startup-config...")
            save_output = conn.save_config()
            print(save_output)
            print("Port reset completed successfully.")

    except (NetmikoTimeoutException, NetmikoAuthenticationException) as err:
        print(f"Connection failure to {device['host']}: {err}")
    except Exception as general_err:
        print(f"An unexpected error occurred: {general_err}")

if __name__ == "__main__":
    default_cisco_ports()

Ansible Playbook Template

This playbook utilizes the official cisco.ios collection to push interface reset commands across an inventory group named [switches].

---
- name: Reset Selected Switchports to Factory Default
  hosts: switches
  gather_facts: false
  connection: network_cli

  vars:
    target_interfaces:
      - "GigabitEthernet1/0/10"
      - "GigabitEthernet1/0/11"
      - "range GigabitEthernet1/0/15 - 18"

  tasks:
    - name: Reset interface configurations to default
      cisco.ios.ios_config:
        lines:
          - "default interface {{ item }}"
      loop: "{{ target_interfaces }}"
      register: reset_result

    - name: Ensure defaulted ports are placed in shutdown state
      cisco.ios.ios_config:
        parents: "interface {{ item }}"
        lines:
          - "shutdown"
      loop: "{{ target_interfaces }}"

    - name: Save configuration changes to NVRAM
      cisco.ios.ios_config:
        save_when: modified

Conclusion

The default interface command is one of the most effective tools in Cisco CLI management, allowing network engineers to strip legacy, complex configurations from switch ports in a single command. However, leveraging it safely requires recognizing the platform-specific behaviors: Catalyst IOS switches return defaulted ports to an unassigned, enabled state in VLAN 1, while Cisco Nexus switches default ports into a disabled state and allow checkpoint rollback protections.

For best operational practice, always verify current port assignments prior to running resets, administratively shut down newly defaulted ports until they are actively patched, and utilize automation scripts when handling mass decommissioning across enterprise stacks.

Please follow and like us:
Last modified: October 31, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.