Cisco Configuration Commands: A Practical Guide for Beginners
Cisco routers and switches are essential devices in computer networks. Network engineers use Cisco IOS commands to configure devices, manage network traffic, connect VLANs, configure routing, and troubleshoot connectivity issues.
In this guide, you will learn essential Cisco configuration commands with simple explanations and practical examples.
The examples use Cisco IOS CLI. Available commands and syntax may vary depending on the device model and software version.
1. Basic Cisco IOS Commands
Before configuring a Cisco router or switch, you should understand the main command-line modes.
| Command | Purpose |
|---|---|
enable |
Enter privileged EXEC mode |
configure terminal |
Enter global configuration mode |
exit |
Leave the current mode |
end |
Return to privileged EXEC mode |
show version |
Display device and IOS information |
show running-config |
Display the active configuration |
show startup-config |
Display the saved configuration |
show clock |
Display the device clock |
Example: Enter Configuration Mode
Switch> enable
Switch# configure terminal
Switch(config)# hostname SW1
SW1(config)# end
SW1#
The hostname command changes the device name to SW1.
Save the Configuration
SW1# copy running-config startup-config
This saves the current configuration so it can be loaded after a restart.
2. Interface Configuration
Interfaces connect routers and switches to other network devices.
Configure an Interface
SW1# configure terminal
SW1(config)# interface gigabitEthernet 1/0/1
SW1(config-if)# description Connection-to-Router
SW1(config-if)# no shutdown
SW1(config-if)# end
The no shutdown command enables the interface administratively. The link will work only if the physical connection and other required settings are correct.
Display Interface Status
SW1# show ip interface brief
SW1# show interfaces status
These commands help you check interface status and identify possible connectivity problems.
3. VLAN Configuration
A VLAN separates a switched network into logical broadcast domains.
Create a VLAN
SW1# configure terminal
SW1(config)# vlan 10
SW1(config-vlan)# name DATA
SW1(config-vlan)# exit
This creates VLAN 10 and names it DATA.
Assign a Port to a VLAN
SW1(config)# interface gigabitEthernet 1/0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config-if)# no shutdown
The interface is now configured as an access port for VLAN 10.
Verify VLAN Configuration
SW1# show vlan brief
This command displays the VLANs and their associated access ports.
4. Trunk Port Configuration
A trunk port carries traffic for multiple VLANs between compatible network devices.
Configure a Trunk Port
SW1# configure terminal
SW1(config)# interface gigabitEthernet 1/0/24
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20,30
This example allows VLANs 10, 20, and 30 across the trunk.
The exact trunk commands depend on the switch model. Some older Cisco switches require an encapsulation command, while many modern switches support only IEEE 802.1Q.
Verify the Trunk
SW1# show interfaces trunk
Check that the interface is trunking and that the required VLANs are allowed.
5. IP Address Configuration
Routers and Layer 3 switches use IP addresses to communicate between networks.
Configure a Router Interface
Router# configure terminal
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
This assigns the address 192.168.1.1/24 to the interface.
Verify the IP Address
Router# show ip interface brief
Confirm that the interface has the correct IP address and is operational.
6. Static Routing Configuration
Static routes tell a router how to reach a destination network.
Configure a Static Route
Router(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2
This route directs traffic for 192.168.2.0/24 to the next-hop address 192.168.1.2.
The next-hop address must be reachable through an appropriate interface or route.
Configure a Default Route
Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.2
A default route is used when no more specific route matches the destination.
Verify the Routing Table
Router# show ip route
This command displays the routes known to the router.
7. DHCP Configuration
DHCP automatically assigns IP configuration to client devices.
The following example configures a Cisco router to provide DHCP addresses for the 192.168.10.0/24 network.
Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.20
Router(config)# ip dhcp pool DATA
Router(dhcp-config)# network 192.168.10.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.10.1
Router(dhcp-config)# dns-server 8.8.8.8
The excluded range is reserved and will not be assigned by this DHCP pool.
The default gateway address must be configured and reachable on the network.
Verify DHCP
Router# show ip dhcp pool
Router# show ip dhcp binding
These commands display DHCP pool information and addresses assigned to clients.
8. Access Control Lists (ACLs)
Access Control Lists control which traffic is permitted or denied based on configured rules.
Example: Create a Standard ACL
Router(config)# access-list 10 permit 192.168.10.0 0.0.0.255
This rule permits the specified source network. A standard ACL also has an implicit deny at the end, so additional rules may be needed.
Apply the ACL to an Interface
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# ip access-group 10 in
This applies ACL 10 to incoming traffic on the interface.
Important: ACLs can interrupt legitimate network traffic if configured incorrectly. Verify the rule order, interface, and direction before applying them to a production network.
Verify ACLs
Router# show access-lists
Router# show ip interface
9. Port Security Configuration
Port Security can restrict which MAC addresses are allowed on a switch access port.
Example Configuration
SW1(config)# interface gigabitEthernet 1/0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport port-security
SW1(config-if)# switchport port-security maximum 2
SW1(config-if)# switchport port-security mac-address sticky
SW1(config-if)# switchport port-security violation restrict
This configuration allows up to two learned secure MAC addresses. With restrict, violating traffic is dropped and the switch records the violation.
Port Security support and requirements depend on the switch model and interface configuration.
Verify Port Security
SW1# show port-security interface gigabitEthernet 1/0/1
10. Spanning Tree Protocol (STP)
Spanning Tree Protocol helps prevent Layer 2 switching loops when redundant links exist.
Configure Rapid PVST+
SW1(config)# spanning-tree mode rapid-pvst
This selects Rapid Per-VLAN Spanning Tree Plus on supported switches.
Enable PortFast on an Access Port
SW1(config)# interface gigabitEthernet 1/0/1
SW1(config-if)# spanning-tree portfast
Use PortFast on ports connected to end devices, such as computers and printers, rather than ordinary switch-to-switch links.
Verify Spanning Tree
SW1# show spanning-tree
SW1# show spanning-tree vlan 10
11. EtherChannel Configuration
EtherChannel combines multiple physical links into one logical link to provide additional bandwidth and link redundancy.
Example: Configure LACP
Apply compatible settings to both switches. On the first switch:
SW1(config)# interface range gigabitEthernet 1/0/1-2
SW1(config-if-range)# channel-group 1 mode active
SW1(config-if-range)# exit
SW1(config)# interface port-channel 1
SW1(config-if)# switchport mode trunk
Configure the corresponding interfaces on the second switch with compatible LACP and trunk settings.
The member links must have compatible speed, duplex, VLAN, and trunk settings where applicable.
Verify EtherChannel
SW1# show etherchannel summary
SW1# show interfaces port-channel 1
12. Backup and Restore Configuration
Backing up a device configuration helps you recover from accidental changes or device replacement.
Save the Current Configuration
SW1# copy running-config startup-config
Back Up to a TFTP Server
SW1# copy running-config tftp:
Follow the prompts to enter the TFTP server address and destination filename.
Restore from a TFTP Server
SW1# copy tftp: running-config
Follow the prompts to enter the server address and source filename.
Restoring a configuration can change existing device settings. Verify the file, device compatibility, and network impact before proceeding.
13. Essential Cisco Troubleshooting Commands
Use these commands to inspect the device and identify common problems.
| Command | Purpose |
|---|---|
show running-config |
View the active configuration. |
show ip interface brief |
Check interface IP addresses and status. |
show interfaces |
Inspect interface details and errors. |
show vlan brief |
Check VLANs and access ports. |
show interfaces trunk |
Check trunk interfaces. |
show mac address-table |
View learned MAC addresses. |
show ip route |
Inspect the routing table. |
show access-lists |
View ACL rules and counters. |
show spanning-tree |
Inspect STP operation. |
ping 192.168.1.1 |
Test IP connectivity. |
traceroute 192.168.2.1 |
Trace the route to a destination. |
The commands available and their exact output can vary by Cisco platform and IOS version.
Conclusion
Cisco IOS commands are essential for configuring and maintaining network infrastructure.
By learning basic device configuration, interfaces, VLANs, trunking, routing, DHCP, ACLs, Port Security, Spanning Tree, EtherChannel, and configuration backups, you can build a strong foundation in Cisco networking.
Practice these commands in a lab environment before applying them to production devices.
Keep learning with BayteNet, your guide to networking and IT fundamentals.
Frequently Asked Questions
1. How do I enter configuration mode on a Cisco device?
Use enable, followed by configure terminal.
2. How do I save a Cisco configuration?
Use copy running-config startup-config.
3. How do I check VLANs on a Cisco switch?
Use show vlan brief.
4. How do I check routing information?
Use show ip route.
5. Where should I practice Cisco commands?
Use a suitable Cisco lab environment or simulator, such as Cisco Packet Tracer, and confirm command support for your device and software version.

0 تعليقات