Courseiva
InterfacesGlobal Config

interface [type] [number]

Enters interface configuration mode for a specific interface (e.g., GigabitEthernet0/1) to configure Layer 2 or Layer 3 parameters.

Definition: interface [type] [number] is a Cisco IOS global config command. Enters interface configuration mode for a specific interface (e.g., GigabitEthernet0/1) to configure Layer 2 or Layer 3 parameters.

Overview

The 'interface' command is a fundamental Cisco IOS command used to enter interface configuration mode for a specific interface, such as GigabitEthernet0/1. This mode allows the network engineer to configure Layer 2 parameters (like VLAN membership, switchport mode, spanning-tree settings) or Layer 3 parameters (like IP address, subnet mask, routing protocol assignments). Understanding this command is critical because it is the gateway to all interface-level configurations, which form the backbone of network connectivity.

The command is used when you need to modify the behavior of a physical or logical interface, such as enabling it, assigning an IP address, or tuning performance parameters. Alternatives include using the 'interface range' command for bulk configuration or 'interface vlan' for SVI configuration. In the broader workflow, you typically start in global configuration mode, then use 'interface' to drill down to a specific interface, configure parameters, and exit back to global config.

Important IOS behavior: entering interface mode does not immediately apply changes; they are staged until you exit interface configuration mode or issue 'end'. The command requires privilege level 15 (enable mode). Changes affect the running configuration immediately upon exit, but are not saved to startup-config until you issue 'copy running-config startup-config'.

The command is available in all IOS versions and platforms, including IOS-XE, NX-OS, and IOS-XR, though syntax may vary slightly. For example, on NX-OS, you use 'interface ethernet1/1' instead of 'interface GigabitEthernet0/1'. The command is essential for both CCNA and CCNP candidates as it is used in almost every lab scenario, from basic connectivity to advanced routing and switching configurations.

Syntax·Global Config
interface [type] [number]

When to Use This Command

  • Assigning an IP address to a router interface for routing between VLANs.
  • Configuring switchport mode access or trunk on a switch interface.
  • Setting duplex and speed on a router or switch interface.
  • Enabling or disabling an interface with the 'no shutdown' or 'shutdown' command.

Parameters

ParameterSyntaxDescription
typeGigabitEthernet | FastEthernet | TenGigabitEthernet | Serial | Loopback | Tunnel | Vlan | Port-channel | etc.Specifies the interface type. Common types include GigabitEthernet (Gi), FastEthernet (Fa), TenGigabitEthernet (Te), Serial (Se), Loopback (Lo), Tunnel (Tu), Vlan (Vlan), and Port-channel (Po). The exact list depends on the platform and IOS version. A common mistake is using an incorrect abbreviation or type that does not exist on the device.
number<0-9>/<0-9> or <0-9> or <0-9>/<0-9>/<0-9>Specifies the interface number, which can be a single number (e.g., 0/1) or a modular format (e.g., 0/0/1 for a line card/slot/port). Valid values depend on the hardware. Common mistakes include using a slot/port that does not exist or forgetting the slash between numbers.

Command Examples

Configuring an IP address on a router interface

interface GigabitEthernet0/1
Router(config-if)#

The prompt changes to config-if mode, indicating you are now configuring interface GigabitEthernet0/1. From here, you can issue commands like 'ip address 192.168.1.1 255.255.255.0' and 'no shutdown'.

Configuring a switch interface as a trunk

interface GigabitEthernet0/1
Switch(config-if)#

After entering interface configuration mode, you can set the switchport mode to trunk with 'switchport mode trunk' and specify allowed VLANs.

Understanding the Output

The command itself does not produce output; it changes the CLI prompt to indicate you are in interface configuration mode. The prompt changes from 'Router(config)#' to 'Router(config-if)#' (or 'Switch(config-if)#' for switches). This confirms you are now configuring the specified interface.

Any subsequent commands will apply to that interface until you exit with 'exit' or 'end'.

Configuration Scenarios

Configure IP address on a GigabitEthernet interface

A network engineer needs to assign an IP address to a router's GigabitEthernet0/0 interface to enable Layer 3 connectivity to a directly connected subnet.

Topology

R1(Gi0/0)---192.168.1.0/30---(Gi0/0)R2

Steps

  1. 1.Step 1: Enter privileged EXEC mode: Router> enable
  2. 2.Step 2: Enter global configuration mode: Router# configure terminal
  3. 3.Step 3: Enter interface configuration mode for GigabitEthernet0/0: Router(config)# interface GigabitEthernet0/0
  4. 4.Step 4: Assign an IP address and subnet mask: Router(config-if)# ip address 192.168.1.1 255.255.255.252
  5. 5.Step 5: Enable the interface (if not already up): Router(config-if)# no shutdown
  6. 6.Step 6: Exit interface configuration mode: Router(config-if)# end
  7. 7.Step 7: Save the configuration: Router# copy running-config startup-config
Configuration
! Full IOS config block
Router> enable
Router# configure terminal
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.252
Router(config-if)# no shutdown
Router(config-if)# end
Router# copy running-config startup-config

Verify: Use 'show ip interface brief' to verify the interface status and IP address. Expected output: GigabitEthernet0/0 is up, line protocol is up, IP address 192.168.1.1/30.

Watch out: Forgetting to issue 'no shutdown' will leave the interface administratively down, causing no connectivity even with correct IP configuration.

Configure a switchport as a trunk on a Cisco switch

A network administrator needs to configure a switch port as a trunk to carry multiple VLANs between two switches.

Topology

SW1(Gi0/1)---trunk---(Gi0/1)SW2

Steps

  1. 1.Step 1: Enter privileged EXEC mode: Switch> enable
  2. 2.Step 2: Enter global configuration mode: Switch# configure terminal
  3. 3.Step 3: Enter interface configuration mode for GigabitEthernet0/1: Switch(config)# interface GigabitEthernet0/1
  4. 4.Step 4: Set the interface to trunk mode: Switch(config-if)# switchport mode trunk
  5. 5.Step 5: (Optional) Specify allowed VLANs: Switch(config-if)# switchport trunk allowed vlan 10,20,30
  6. 6.Step 6: Exit interface configuration mode: Switch(config-if)# end
  7. 7.Step 7: Save the configuration: Switch# copy running-config startup-config
Configuration
! Full IOS config block
Switch> enable
Switch# configure terminal
Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20,30
Switch(config-if)# end
Switch# copy running-config startup-config

Verify: Use 'show interfaces trunk' to verify the trunk is operational. Expected output: Port Gi0/1 is in trunk mode, allowed VLANs 10,20,30.

Watch out: If the interface is already in access mode, you must first issue 'switchport mode trunk' before configuring allowed VLANs; otherwise, the allowed VLAN command may be rejected.

Troubleshooting with This Command

When troubleshooting interface issues, the 'interface' command itself is not used for diagnostics, but entering interface configuration mode allows you to inspect and modify parameters that affect connectivity. Healthy output from 'show running-config interface [type] [number]' should show the expected IP address, no shutdown, and correct duplex/speed settings. Problem indicators include 'shutdown' (administratively down), incorrect IP address, or mismatched duplex/speed.

Common symptoms this command helps diagnose include: no connectivity (check if interface is up/up), incorrect VLAN assignment (for switchports), or routing issues (check IP address). A step-by-step diagnostic flow: 1) Use 'show ip interface brief' to see interface status. 2) If down/down, check physical cabling. 3) If administratively down, enter interface config and issue 'no shutdown'. 4) If up/down, check Layer 1 issues or encapsulation mismatch. 5) Use 'show interfaces [type] [number]' to check for errors, duplex mismatches. 6) Use 'debug interface' cautiously to see real-time events. Correlate with 'show running-config' to verify configuration.

For example, if a router cannot ping a neighbor, check that the interface has the correct IP address and is not shutdown. The 'interface' command is the entry point to fix these issues.

CCNA Exam Tips

1.

CCNA exam tip: Remember that 'interface' is a global config command; you must be in global config mode first.

2.

CCNA exam tip: The interface type and number must match exactly (e.g., GigabitEthernet0/1, not G0/1 unless shorthand is supported).

3.

CCNA exam tip: On switches, 'interface range' can configure multiple interfaces at once, but 'interface' alone targets a single interface.

4.

CCNA exam tip: After entering interface config, you must use 'no shutdown' to enable the interface (default is shutdown on routers, but not on switches).

Common Mistakes

Mistake 1: Forgetting to use 'no shutdown' after configuring an interface, leaving it administratively down.

Mistake 2: Typing the wrong interface number (e.g., GigabitEthernet0/0 instead of 0/1), causing configuration on the wrong interface.

Mistake 3: Trying to enter interface configuration mode from user exec mode instead of global config mode.

interface [type] [number] vs interface range

Both commands are used to enter interface configuration mode, but they differ in scope: 'interface [type] [number]' targets a single interface, while 'interface range' targets multiple ports simultaneously. This distinction is commonly confused when engineers need to apply the same settings to several interfaces.

Aspectinterface [type] [number]interface range
ScopeSingle interfaceMultiple interfaces (range or list)
Configuration modeInterface configuration modeInterface range configuration mode
PersistenceChanges apply only to that interfaceSame command applied to all interfaces in range
PrecedenceOverridden by more specific interface commandsCommands applied per interface; later individual configs override
Typical useConfiguring a specific portBulk configuration of multiple ports

Use interface [type] [number] when you need to configure a specific interface with unique settings.

Use interface range when you want to apply identical configuration to a group of interfaces.

Platform Notes

In IOS-XE, the command syntax is identical to classic IOS, but output formats may differ slightly (e.g., 'show running-config interface' may include additional parameters like 'negotiation auto'). On NX-OS, the equivalent command is 'interface ethernet1/1' (using 'ethernet' instead of 'GigabitEthernet') and you must be in configuration terminal mode. NX-OS also uses 'no shutdown' similarly.

For ASA firewalls, the command is 'interface gigabitethernet0/0' but the configuration context is different (e.g., 'nameif', 'security-level'). In IOS-XR, the command is 'interface GigabitEthernet0/0/0/0' (four-level numbering) and requires 'commit' after changes. Differences between IOS versions: In IOS 12.x, interface numbering often used a single number (e.g., Ethernet0), while 15.x and later use modular numbering (e.g., GigabitEthernet0/0).

The command exists in all platforms, but the exact interface types and numbers vary. Always check the specific platform documentation for valid interface types.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions