Free tech learning for everyone, from basics to pro

Routing & SwitchingNetworking SecurityIntermediate

Cisco router commands: interfaces, routing, ACLs and NAT

In short: A quick reference of the Cisco IOS commands used to configure and secure a router. Commands only.

Commands only. Replace values in angle brackets such as <ip> with your own. Only run commands on systems you own or are authorised to manage.

Interfaces and inter-VLAN routing

interface gigabitEthernet 0/0
 description LINK-TO-ISP
 ip address <public-ip> <mask>
 no shutdown
interface gigabitEthernet 0/1
 no shutdown
interface gigabitEthernet 0/1.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
interface gigabitEthernet 0/1.20
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0

Static and dynamic routing

ip route 0.0.0.0 0.0.0.0 <isp-gateway>
ip route 10.20.0.0 255.255.0.0 <next-hop>
router ospf 1
 router-id 1.1.1.1
 network 192.168.10.0 0.0.0.255 area 0
 network 192.168.20.0 0.0.0.255 area 0
 passive-interface gigabitEthernet 0/1.10

Access control lists

ip access-list standard MGMT-ONLY
 permit 192.168.99.0 0.0.0.255
line vty 0 4
 access-class MGMT-ONLY in
ip access-list extended STAFF-IN
 permit tcp 192.168.10.0 0.0.0.255 any eq 443
 permit udp 192.168.10.0 0.0.0.255 any eq 53
 deny ip any any log
interface gigabitEthernet 0/1.10
 ip access-group STAFF-IN in

NAT and DHCP

interface gigabitEthernet 0/0
 ip nat outside
interface gigabitEthernet 0/1.10
 ip nat inside
access-list 1 permit 192.168.10.0 0.0.0.255
ip nat inside source list 1 interface gigabitEthernet 0/0 overload
ip nat inside source static tcp 192.168.10.5 443 interface gigabitEthernet 0/0 443
ip dhcp excluded-address 192.168.10.1 192.168.10.10
ip dhcp pool STAFF
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.1
 dns-server <dns-ip>

Hardening and management services

no ip http server
no cdp run
no ip source-route
login block-for 120 attempts 3 within 60
security passwords min-length 10
ntp server <ntp-ip>
service timestamps log datetime msec
logging host <syslog-ip>
logging trap warnings
snmp-server group ADMINS v3 priv
snmp-server user snmpadmin ADMINS v3 auth sha <auth-pass> priv aes 128 <priv-pass>

Verification commands

CommandPurpose
show ip interface briefInterfaces, IP addresses and up/down status
show ip routeRouting table
show ip ospf neighborOSPF neighbours and state
show access-listsACLs with hit counters
show ip nat translationsActive NAT translations
show ip dhcp bindingAddresses leased by the DHCP server
show ntp statusNTP synchronisation state
show loggingLogging settings and local buffer
show versionIOS version, uptime and hardware
ping <ip> source <interface>Ping from a chosen interface
traceroute <ip>Trace the path from the router

Real-world example: setting up a new branch office router

Building a branch routerInterfacesaddresses,descriptionsRoutingstatic orOSPFNATinside tooutsideACLsfiltertrafficHardeningSSH, no unusedservicesVerifyshowcommands
Figure 1. A typical order for configuring a branch router with the commands on this page, ending with verification.

A charity opened a second office and needed it connected to the internet and to head office. The network volunteer configured the branch router in a set order. She addressed the LAN interface as 192.168.20.1/24 and the WAN interface with the address from the ISP, then added a default route to the ISP. NAT overload let the office PCs share the single public address, and the router's DHCP pool gave the PCs their settings.

An extended ACL on the WAN side blocked inbound traffic except replies and the site-to-site VPN. She enabled SSH, disabled Telnet and HTTP management, and set a login banner. Before leaving, she verified each step with show ip interface brief, show ip route and show ip nat translations, and saved the configuration. The office was online and documented the same afternoon.

Key takeaways

  • Use subinterfaces with dot1Q for router-on-a-stick inter-VLAN routing.
  • Place extended ACLs near the source and restrict VTY access with access-class.
  • PAT (overload) lets inside hosts share the outside interface address.
  • Disable unused services, rate-limit logins, and send time-stamped logs to syslog.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.