IOS-Modi verstehen
Cisco IOS kennt vier Haupt-Modi mit jeweils eigenem Prompt. Der Modus bestimmt welche Befehle verfügbar sind. Konfigurationsänderungen gelten sofort — werden aber erst nach write memory dauerhaft gespeichert.
- Nur lesende Befehle
ping,traceroute- Eingeschränktes
show - Kein Zugriff auf Konfiguration
- Alle
show-Befehle debug,clear- Einstieg in Config-Mode
- Zugang:
enable
- Globale Konfiguration
- Hostnamen, Routing, ACLs
- Zugang:
configure terminal - Verlassen:
endoderCtrl+Z
- Interface-spezifische Config
- IP, Trunking, STP, etc.
- Zugang:
interface GigabitEthernet0/0 - Zurück:
exit
Cisco IOS speichert Konfigurationen im RAM (running-config).
Nach einem Reboot ohne write memory (oder kurz: wr)
sind alle Änderungen verloren. Immer am Ende einer Konfigurationssitzung speichern:
copy running-config startup-config oder kürzer: wr
Navigation & Grundbefehle
# User EXEC → Privileged EXEC > enable Password: **** # Privileged EXEC → Global Config # configure terminal # kurz: conf t # Global Config → Interface (config)# interface GigabitEthernet0/0 # kurz: int g0/0 # Zurück / Verlassen (config-if)# exit # eine Ebene zurück (config-if)# end # zurück zu Privileged EXEC Ctrl+Z # wie end # Konfiguration speichern # write memory # kurz: wr # copy running-config startup-config # Konfiguration anzeigen # show running-config # aktive Config (RAM) # show startup-config # gespeicherte Config (Flash) # Befehl negieren (löschen) (config-if)# no shutdown (config)# no ip route 192.168.0.0 255.255.0.0 # Tab-Vervollständigung und ? sh? # alle Befehle die mit "sh" beginnen show ip ? # alle Sub-Befehle von "show ip"
| Command | Beschreibung | Mode |
|---|---|---|
| show version | IOS-Version, Uptime, Hardware, Seriennummer | # |
| show running-config | Aktive Konfiguration (RAM) | # |
| show startup-config | Gespeicherte Konfiguration (NVRAM) | # |
| show running-config | section ospf | Config-Abschnitt filtern | # |
| show processes cpu | CPU-Auslastung | # |
| show processes memory | RAM-Auslastung | # |
| terminal length 0 | Seitenweise Ausgabe deaktivieren (kein --More--) | # |
| reload | Neustart (mit Bestätigung) | # |
Interfaces konfigurieren
# Router-Interface mit IP (config)# interface GigabitEthernet0/0 (config-if)# ip address 192.168.1.1 255.255.255.0 (config-if)# description "LAN Uplink" (config-if)# no shutdown # Interface aktivieren! # Subinterface (für Router-on-a-Stick / VLAN-Routing) (config)# interface GigabitEthernet0/1.10 (config-subif)# encapsulation dot1Q 10 (config-subif)# ip address 192.168.10.1 255.255.255.0 # Loopback (config)# interface Loopback0 (config-if)# ip address 10.0.0.1 255.255.255.255 # Switch-Port als Access-Port (config)# interface FastEthernet0/1 (config-if)# switchport mode access (config-if)# switchport access vlan 10 (config-if)# no shutdown # Switch-Port als Trunk (config)# interface GigabitEthernet0/1 (config-if)# switchport trunk encapsulation dot1q (config-if)# switchport mode trunk (config-if)# switchport trunk allowed vlan 10,20,30
| Command | Beschreibung | Mode |
|---|---|---|
| show interfaces | Alle Interfaces mit Status + Statistiken | # |
| show interfaces GigabitEthernet0/0 | Einzelnes Interface Detail | # |
| show ip interface brief | Kompaktübersicht: Interface, IP, Status | # |
| show interfaces trunk | Trunk-Ports mit erlaubten VLANs | # |
| show interfaces switchport | Switchport-Details (Access/Trunk, VLAN) | # |
VLANs anlegen & STP verwalten
# VLAN anlegen (config)# vlan 10 (config-vlan)# name MANAGEMENT (config-vlan)# exit # Mehrere VLANs auf einmal (config)# vlan 10,20,30,40 # STP Root Bridge setzen (config)# spanning-tree vlan 10 root primary (config)# spanning-tree vlan 20 root secondary # STP-Modus (config)# spanning-tree mode rapid-pvst # empfohlen (config)# spanning-tree mode pvst # PortFast (für Access-Ports zu Endgeräten) (config-if)# spanning-tree portfast (config-if)# spanning-tree bpduguard enable # BPDU Guard global (config)# spanning-tree portfast bpduguard default
| Command | Beschreibung | Mode |
|---|---|---|
| show vlan brief | Alle VLANs mit zugeordneten Ports | # |
| show vlan id 10 | VLAN 10 Detail | # |
| show spanning-tree | STP-Status aller VLANs | # |
| show spanning-tree vlan 10 | STP für VLAN 10 — Root, Ports, Timer | # |
| show spanning-tree summary | STP-Zusammenfassung, Modus, Root | # |
Statisches Routing & Routing-Tabelle
# Default Route (config)# ip route 0.0.0.0 0.0.0.0 192.168.68.1 # Spezifische Route (config)# ip route 10.10.0.0 255.255.0.0 192.168.1.254 # Floating Static Route (höhere AD = Backup) (config)# ip route 0.0.0.0 0.0.0.0 192.168.68.2 10 # Route über Interface statt Next-Hop (config)# ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0 # IP Routing auf Layer-3-Switch aktivieren (config)# ip routing
| Command | Beschreibung | Mode |
|---|---|---|
| show ip route | Gesamte Routing-Tabelle | # |
| show ip route 10.0.0.0 | Route für spezifisches Netz | # |
| show ip route static | Nur statische Routen | # |
| show ip route summary | Routing-Tabelle Zusammenfassung | # |
| show arp | ARP-Tabelle | # |
| clear arp-cache | ARP-Cache leeren | # |
OSPF konfigurieren & verifizieren
# OSPF Prozess starten (config)# router ospf 1 (config-router)# router-id 1.1.1.1 # Netzwerke in OSPF ankündigen (config-router)# network 192.168.1.0 0.0.0.255 area 0 (config-router)# network 10.0.0.0 0.255.255.255 area 0 # Passive Interface (kein Hello senden) (config-router)# passive-interface GigabitEthernet0/2 (config-router)# passive-interface default # alle passiv (config-router)# no passive-interface Gi0/0 # Ausnahme # Default Route in OSPF einstreuen (config-router)# default-information originate always # Kosten auf Interface setzen (config-if)# ip ospf cost 10 # Authentication (config-if)# ip ospf authentication message-digest (config-if)# ip ospf message-digest-key 1 md5 geheim
| Command | Beschreibung | Mode |
|---|---|---|
| show ip ospf neighbor | Nachbarn + Status (FULL = gut) | # |
| show ip ospf neighbor detail | Detail: Dead-Timer, DR/BDR, Interface | # |
| show ip ospf database | LSDB — alle LSAs | # |
| show ip ospf interface brief | OSPF-Interfaces, Kosten, Rolle | # |
| show ip route ospf | Nur OSPF-Routen | # |
| clear ip ospf process | OSPF-Prozess neu starten | # |
BGP — eBGP & iBGP
# BGP-Prozess starten (config)# router bgp 65001 (config-router)# bgp router-id 1.1.1.1 # eBGP-Peer (config-router)# neighbor 10.0.0.2 remote-as 65002 (config-router)# neighbor 10.0.0.2 description "Upstream-Peer" # iBGP-Peer (Loopback als Source) (config-router)# neighbor 10.255.255.2 remote-as 65001 (config-router)# neighbor 10.255.255.2 update-source Loopback0 # Netz ankündigen (config-router)# network 192.168.1.0 mask 255.255.255.0 # Route Reflector (config-router)# neighbor 10.255.255.2 route-reflector-client # Authentication (config-router)# neighbor 10.0.0.2 password geheim # Prefix-Liste für Import/Export (config)# ip prefix-list OUT-FILTER permit 192.168.0.0/16 (config-router)# neighbor 10.0.0.2 prefix-list OUT-FILTER out
| Command | Beschreibung | Mode |
|---|---|---|
| show ip bgp summary | Alle Peers + Status (Established = gut) | # |
| show ip bgp neighbors 10.0.0.2 | Peer-Detail: Hold-Timer, Capabilities | # |
| show ip bgp | BGP-Tabelle mit allen Prefixen | # |
| show ip route bgp | BGP-Routen in Routing-Tabelle | # |
| clear ip bgp 10.0.0.2 soft | Soft reset — Policies neu anwenden | # |
| clear ip bgp * soft | Soft reset alle Peers | # |
Cisco BGP sendet Routen die in der BGP-Tabelle sind automatisch an alle Peers —
kein explizites Export-Statement nötig.
Einschränkungen per route-map oder prefix-list auf dem Neighbor.
EIGRP konfigurieren
# EIGRP Named Mode (ab IOS 15.0 empfohlen) (config)# router eigrp MEIN-EIGRP (config-router)# address-family ipv4 unicast autonomous-system 100 (config-router-af)# network 192.168.1.0 0.0.0.255 (config-router-af)# eigrp router-id 1.1.1.1 (config-router-af)# no auto-summary # Classic Mode (ältere IOS) (config)# router eigrp 100 (config-router)# network 192.168.1.0 0.0.0.255 (config-router)# no auto-summary # Passive Interface (config-router)# passive-interface GigabitEthernet0/2 # Redistribute statische Routen (config-router)# redistribute static metric 1000 1 255 1 1500
| Command | Beschreibung | Mode |
|---|---|---|
| show ip eigrp neighbors | EIGRP-Nachbarn + Uptime | # |
| show ip eigrp topology | EIGRP-Topologie-Tabelle | # |
| show ip eigrp topology all-links | Alle Routen inkl. Successor/Feasible | # |
| show ip route eigrp | EIGRP-Routen in Routing-Tabelle | # |
Access Control Lists
ACLs filtern Traffic auf Interfaces. Standard-ACLs matchen nur auf die Quell-IP. Extended ACLs matchen auf Quelle, Ziel, Protokoll und Port. Reihenfolge ist entscheidend — implizites Deny am Ende.
# Standard ACL (Nummern 1–99, 1300–1999) (config)# access-list 10 permit 192.168.1.0 0.0.0.255 (config)# access-list 10 deny any # Extended ACL (Nummern 100–199, 2000–2699) (config)# access-list 100 permit tcp 192.168.1.0 0.0.0.255 any eq 443 (config)# access-list 100 permit tcp 192.168.1.0 0.0.0.255 any eq 80 (config)# access-list 100 deny ip any any log # Named Extended ACL (empfohlen — editierbar) (config)# ip access-list extended ALLOW-WEB (config-ext-nacl)# 10 permit tcp any any eq 443 (config-ext-nacl)# 20 permit tcp any any eq 80 (config-ext-nacl)# 30 deny ip any any # ACL auf Interface anwenden (config-if)# ip access-group ALLOW-WEB in # eingehend (config-if)# ip access-group ALLOW-WEB out # ausgehend # Eintrag aus Named ACL löschen (config-ext-nacl)# no 20
| Command | Beschreibung | Mode |
|---|---|---|
| show ip access-lists | Alle ACLs mit Hitcounter | # |
| show ip access-lists ALLOW-WEB | Einzelne ACL mit Matches | # |
| show ip interface GigabitEthernet0/0 | Welche ACLs auf Interface aktiv | # |
| clear ip access-list counters | Hit-Counter zurücksetzen | # |
NAT & PAT (Masquerading)
# Interfaces als inside/outside markieren (config-if)# ip nat inside # LAN-Interface (config-if)# ip nat outside # WAN-Interface # PAT / NAT Overload (viele → eine IP) (config)# ip nat inside source list 1 interface GigabitEthernet0/1 overload (config)# access-list 1 permit 192.168.1.0 0.0.0.255 # Statisches NAT (Port-Forwarding) (config)# ip nat inside source static tcp \ 192.168.1.71 443 interface GigabitEthernet0/1 443 # NAT-Pool (mehrere öffentliche IPs) (config)# ip nat pool WAN-POOL 203.0.113.10 203.0.113.20 netmask 255.255.255.0 (config)# ip nat inside source list 1 pool WAN-POOL overload
| Command | Beschreibung | Mode |
|---|---|---|
| show ip nat translations | Aktive NAT-Übersetzungen | # |
| show ip nat statistics | NAT-Statistiken, Hits, Misses | # |
| clear ip nat translation * | NAT-Tabelle leeren | # |
| debug ip nat | NAT-Übersetzungen live debuggen | # |
Diagnose & Debugging
# Ping und Traceroute # ping 8.8.8.8 # ping 8.8.8.8 source GigabitEthernet0/0 # ping 8.8.8.8 repeat 100 size 1500 # traceroute 8.8.8.8 # traceroute 8.8.8.8 source Loopback0 # Debug (IMMER mit undebug all beenden!) # debug ip packet # alle IP-Pakete (Vorsicht: sehr viel Output!) # debug ip packet detail # debug ip ospf events # debug ip bgp # debug ip nat # debug ip routing # Routing-Änderungen # Debug stoppen — IMMER ausführen wenn fertig! # undebug all # kurz: u all # no debug all
| Command | Beschreibung | Mode |
|---|---|---|
| show ip interface brief | Schnellübersicht alle Interfaces | # |
| show ip protocols | Aktive Routing-Protokolle | # |
| show cdp neighbors | Direkt verbundene Cisco-Geräte (CDP) | # |
| show cdp neighbors detail | CDP mit IP, IOS-Version, Interface | # |
| show lldp neighbors | LLDP-Nachbarn (herstellerübergreifend) | # |
| show mac address-table | MAC-Adresstabelle (Switch) | # |
| show log | Syslog-Buffer (letzte Meldungen) | # |
| show users | Aktive Verbindungen / Sessions | # |
debug ip packet loggt jeden IP-Paket — auf einem ausgelasteten Router
kann das die CPU auf 100% bringen und das Gerät zum Absturz bringen.
Immer ACL-Filter setzen bevor debug auf produktiven Geräten:
debug ip packet detail 100 (ACL 100 als Filter).
Danach sofort undebug all.
Was schiefgehen kann
write memory (oder wr) wurde vergessen. Cisco IOS speichert die laufende Konfiguration im RAM (running-config). Erst nach write memory landet sie im NVRAM (startup-config) und überlebt einen Reboot.shutdown. Fix: no shutdown im Interface-Kontext. show ip interface brief zeigt den Unterschied zwischen "administratively down" und "down" (Kabel/Layer-1-Problem).deny ip any any am Ende — was nicht explizit erlaubt ist, wird geblockt. Mit show ip access-lists die Hitcounter prüfen um zu sehen welche Zeile matched. Für Debugging ein temporäres permit ip any any log ans Ende hängen.show ip nat statistics zeigt ob Hits und Misses korrekt sind. debug ip nat zeigt Übersetzungen in Echtzeit.ip ospf mtu-ignore auf dem Interface, oder MTU angleichen. Prüfen: show interfaces auf beiden Seiten vergleichen.auto-summary per Default — das aggregiert Routen an Classful-Grenzen und kann zu Routing-Problemen führen. Immer explizit deaktivieren: no auto-summary im Router-Kontext.