Operational Mode vs. Configuration Mode
JunOS kennt zwei grundlegende Arbeitsmodi. Der wichtigste Unterschied zu anderen Herstellern: Konfigurationsänderungen werden erst mit commit aktiv — vorher ist nichts kaputt.
- Status anzeigen, troubleshooten
- Ping, traceroute, show
- Logs lesen
- Konfiguration lesen (nicht schreiben)
- Einstieg: direkt nach Login
- Konfiguration ändern
set,delete,edit- Änderungen erst nach
commitaktiv rollbackmacht alles rückgängig- Einstieg:
configureoderedit
# Operational → Configuration > configure > configure exclusive # andere Nutzer gesperrt > configure private # eigene Kandidaten-Config # Configuration → Operational (ohne commit) # exit # run show interfaces # show-Befehle direkt aus Config-Mode # Commit-Optionen # commit # sofort aktiv # commit confirmed 5 # aktiv, rollback nach 5 Min ohne confirm # commit check # Syntax prüfen ohne zu committen # rollback 0 # letzte committed config wiederherstellen # rollback 1 # vorletzte, bis rollback 49
Bei Änderungen die den Zugriff unterbrechen könnten immer commit confirmed 5 verwenden.
Wenn nach 5 Minuten kein commit folgt, macht JunOS automatisch rollback.
Verhindert Aussperren bei Firewall-Policy-Änderungen.
Navigieren, anzeigen, suchen
| Command | Beschreibung | Mode |
|---|---|---|
| show version | JunOS-Version, Hostname, Modell | OP |
| show system uptime | Uptime, letzte commit-Zeit | OP |
| show configuration | Gesamte aktive Konfiguration | OP |
| show configuration | display set | Config als set-Befehle — copy-paste-fähig | OP |
| show configuration | match ospf | Config nach Begriff filtern | OP |
| show | compare | Uncommitted Änderungen anzeigen (diff) | CF |
| edit protocols ospf | In Config-Hierarchie navigieren | CF |
| up / top | Eine Ebene / ganz nach oben | CF |
| show ? | Alle verfügbaren Sub-Commands anzeigen | OP |
| request system reboot | Neustart (mit Bestätigung) | OP |
JunOS kennt mächtige Pipe-Filter: | match TEXT (grep),
| except TEXT (grep -v), | find TEXT (ab erster Übereinstimmung),
| count (Anzahl Zeilen), | display set (als set-Commands).
Kombinierbar: show route | match 10.0 | count.
Interfaces konfigurieren & prüfen
# Einfaches L3-Interface # set interfaces ge-0/0/0 description "Uplink WAN" # set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.1/30 # Loopback (für Router-ID, BGP, OSPF) # set interfaces lo0 unit 0 family inet address 192.0.2.1/32 # VLAN-Subinterface (Trunk) # set interfaces ge-0/0/1 vlan-tagging # set interfaces ge-0/0/1 unit 10 vlan-id 10 # set interfaces ge-0/0/1 unit 10 family inet address 10.10.10.1/24 # Interface deaktivieren # set interfaces ge-0/0/2 disable
| Command | Beschreibung | Mode |
|---|---|---|
| show interfaces terse | Alle Interfaces — Status + IP, kompakt | OP |
| show interfaces ge-0/0/0 | Detail: Fehler, Traffic, Duplex, Speed | OP |
| show interfaces ge-0/0/0 detail | Noch mehr Detail inkl. Queues | OP |
| show interfaces descriptions | Alle Beschreibungen auf einen Blick | OP |
| clear interfaces statistics ge-0/0/0 | Zähler zurücksetzen | OP |
Routing-Tabelle & statische Routen
# Default Route # set routing-options static route 0.0.0.0/0 next-hop 10.0.0.2 # Spezifische Route # set routing-options static route 172.16.0.0/16 next-hop 10.0.1.1 # Route mit Präferenz (niedrig = bevorzugt, default 5) # set routing-options static route 0.0.0.0/0 next-hop 10.0.0.2 preference 10 # Reject-Route (Black Hole) # set routing-options static route 192.0.2.0/24 reject # Router-ID und AS setzen # set routing-options router-id 192.0.2.1 # set routing-options autonomous-system 65001
| Command | Beschreibung | Mode |
|---|---|---|
| show route | Gesamte Routing-Tabelle | OP |
| show route 10.0.0.0/8 | Routen für ein Prefix | OP |
| show route protocol static | Nur statische Routen | OP |
| show route protocol ospf | Nur OSPF-Routen | OP |
| show route detail | Mit Präferenz, Next-Hop, Metrik | OP |
| show route forwarding-table | FIB — was wirklich weitergeleitet wird | OP |
OSPF konfigurieren & verifizieren
# OSPF Area 0 mit Interfaces # set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 # set protocols ospf area 0.0.0.0 interface lo0.0 passive # Stub Area # set protocols ospf area 0.0.0.1 stub default-metric 10 # set protocols ospf area 0.0.0.1 interface ge-0/0/1.0 # Interface-Tuning # set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 hello-interval 5 # set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 dead-interval 20 # set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10 # Redistribute statische Routen in OSPF # set protocols ospf export redistribute-static # # (policy redistribute-static muss existieren) # Authentication # set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 authentication md5 1 key "geheim"
| Command | Beschreibung | Mode |
|---|---|---|
| show ospf neighbor | Nachbarschaften + Status (Full = gut) | OP |
| show ospf neighbor detail | Dead-Timer, DR/BDR, Interface | OP |
| show ospf database | LSDB — alle LSAs | OP |
| show ospf database summary | LSA-Typen kompakt | OP |
| show ospf route | OSPF-Routen in der Routing-Tabelle | OP |
| show ospf interface | Interface-Status, Rolle (DR/BDR/DROther) | OP |
| clear ospf neighbor all | Alle Nachbarschaften zurücksetzen | OP |
Das Loopback-Interface (lo0.0) in OSPF als passive eintragen —
so wird das Prefix angekündigt, aber kein Neighbor-Aufbau versucht.
Die Loopback-IP als Router-ID verwenden sorgt für Stabilität
auch wenn physische Interfaces flappen.
eBGP & iBGP konfigurieren
# Lokale AS-Nummer (einmalig unter routing-options) # set routing-options autonomous-system 65001 # eBGP Peer # set protocols bgp group UPSTREAM type external # set protocols bgp group UPSTREAM peer-as 65002 # set protocols bgp group UPSTREAM neighbor 10.0.0.2 # Export-Policy (was wir ankündigen) # set protocols bgp group UPSTREAM export bgp-export # iBGP Peer (gleiche AS, Loopback als Source) # set protocols bgp group IBGP type internal # set protocols bgp group IBGP local-address 192.0.2.1 # set protocols bgp group IBGP neighbor 192.0.2.2 # Route Reflector (für iBGP Scale) # set protocols bgp group IBGP cluster 192.0.2.1 # Authentication # set protocols bgp group UPSTREAM neighbor 10.0.0.2 authentication-key "geheim"
| Command | Beschreibung | Mode |
|---|---|---|
| show bgp summary | Alle Peers + Status (Established = gut) | OP |
| show bgp neighbor 10.0.0.2 | Detail: Hold-Timer, Capabilities, Errors | OP |
| show route receive-protocol bgp 10.0.0.2 | Empfangene Prefixe von diesem Peer | OP |
| show route advertising-protocol bgp 10.0.0.2 | Was wir an diesen Peer senden | OP |
| show route protocol bgp | Alle BGP-Routen in der Routing-Tabelle | OP |
| clear bgp neighbor 10.0.0.2 | Session zurücksetzen (hard reset) | OP |
| clear bgp neighbor 10.0.0.2 soft | Soft reset — Policies neu anwenden | OP |
JunOS BGP sendet standardmäßig keine Routen — anders als bei Cisco.
Ohne explizite Export-Policy bleibt die Session zwar oben, aber es werden keine
Prefixe angekündigt. Immer export [ policy-name ] am BGP-Group-Level setzen.
IS-IS konfigurieren
# NET-Adresse auf Loopback (System-ID = MAC-ähnlich, Area 49.0001) # set interfaces lo0 unit 0 family iso address 49.0001.1920.0020.0001.00 # IS-IS aktivieren # set protocols isis interface ge-0/0/0.0 # set protocols isis interface lo0.0 passive # Nur Level 2 (empfohlen für einfache Setups) # set protocols isis interface ge-0/0/0.0 level 1 disable # Wide-Metrics aktivieren (für Traffic Engineering) # set protocols isis level 2 wide-metrics-only # IPv6 hinzufügen # set interfaces lo0 unit 0 family inet6 address 2001:db8::1/128 # set protocols isis interface ge-0/0/0.0 family inet6 unicast
| Command | Beschreibung | Mode |
|---|---|---|
| show isis adjacency | Nachbarschaften + Level + Status | OP |
| show isis database | LSP-Datenbank | OP |
| show isis route | IS-IS-Routen | OP |
| show isis interface | Interface-Status, Level, Metrik | OP |
RIPv2 konfigurieren
# RIPv2 aktivieren # set protocols rip group RIP-GROUP neighbor ge-0/0/0.0 # Default Route über RIP senden # set protocols rip group RIP-GROUP export send-default # Routen importieren (was wir akzeptieren) # set protocols rip group RIP-GROUP import rip-import # Authentication # set protocols rip group RIP-GROUP neighbor ge-0/0/0.0 authentication-type md5 # set protocols rip group RIP-GROUP neighbor ge-0/0/0.0 authentication-key "geheim"
| Command | Beschreibung | Mode |
|---|---|---|
| show rip neighbor | RIP-Nachbarn + Status | OP |
| show rip statistics | Gesendete/empfangene Updates | OP |
| show route protocol rip | Über RIP gelernte Routen | OP |
Import / Export Policies
Policies steuern welche Routen importiert oder exportiert werden.
Sie bestehen aus Terms mit from-Bedingungen
und then-Aktionen. Am Ende jeder Policy steht implizit ein reject —
was nicht explizit akzeptiert wird, wird abgelehnt.
# Statische Routen in BGP exportieren # set policy-options policy-statement bgp-export term static from protocol static # set policy-options policy-statement bgp-export term static then accept # Spezifisches Prefix matchen # set policy-options prefix-list MY-PREFIXES 10.0.0.0/8 # set policy-options policy-statement bgp-export term prefixes from prefix-list MY-PREFIXES # set policy-options policy-statement bgp-export term prefixes then accept # Default Term am Ende — alles andere ablehnen # set policy-options policy-statement bgp-export term default then reject # Community setzen # set policy-options community MY-COMMUNITY members 65001:100 # set policy-options policy-statement bgp-export term static then community add MY-COMMUNITY # Policy testen (ohne commit!) > test policy bgp-export 10.0.0.0/8
test policy POLICY-NAME PREFIX zeigt im Operational Mode was eine Policy
mit einem bestimmten Prefix machen würde — ohne dass ein commit nötig ist.
Unverzichtbar bevor eine neue Export-Policy live geht.
Zones, Policies & NAT auf dem SRX
Der SRX ist ein stateful Firewall-Router. Traffic läuft durch Security Zones, Security Policies steuern was erlaubt ist, NAT übersetzt Adressen. Die Reihenfolge ist immer: Zone → Policy → NAT.
# Zonen definieren # set security zones security-zone trust interfaces ge-0/0/1.0 # set security zones security-zone untrust interfaces ge-0/0/0.0 # Host-Zugriff auf Zone erlauben (z.B. SSH von LAN) # set security zones security-zone trust host-inbound-traffic system-services ssh # set security zones security-zone trust host-inbound-traffic system-services ping # Security Policy: trust → untrust erlauben # set security policies from-zone trust to-zone untrust policy ALLOW-OUT \ # match source-address any destination-address any application any # set security policies from-zone trust to-zone untrust policy ALLOW-OUT then permit # Source NAT (Masquerading) für ausgehenden Traffic # set security nat source rule-set SNAT from zone trust # set security nat source rule-set SNAT to zone untrust # set security nat source rule-set SNAT rule RULE1 match source-address 0.0.0.0/0 # set security nat source rule-set SNAT rule RULE1 then source-nat interface # Destination NAT (Port-Forwarding) # set security nat destination rule-set DNAT from zone untrust # set security nat destination rule-set DNAT rule HTTP-IN match destination-port 80 # set security nat destination rule-set DNAT rule HTTP-IN then destination-nat ip 10.0.1.10 port 80
| Command | Beschreibung | Mode |
|---|---|---|
| show security zones | Alle Zonen + zugehörige Interfaces | OP |
| show security policies | Alle Security Policies | OP |
| show security flow session | Aktive Sessions in der Flow-Tabelle | OP |
| show security nat source summary | Source-NAT-Regeln + Treffer | OP |
| show security nat destination summary | Destination-NAT-Regeln + Treffer | OP |
| show security alg status | Application Layer Gateways (FTP, SIP etc.) | OP |
| clear security flow session all | Alle Sessions löschen (Vorsicht!) | OP |
Wenn nichts funktioniert
# Ping mit Source-Interface > ping 10.0.0.2 routing-instance default source 10.0.0.1 count 5 # Traceroute > traceroute 8.8.8.8 # DNS auflösen > request system dns lookup example.com
# BGP Debugging aktivieren # set protocols bgp traceoptions file bgp.log # set protocols bgp traceoptions flag open # set protocols bgp traceoptions flag update # commit # Log live verfolgen > monitor start bgp.log > monitor stop # OSPF Debugging # set protocols ospf traceoptions file ospf.log # set protocols ospf traceoptions flag hello # set protocols ospf traceoptions flag error # Nach dem Debugging immer aufräumen! # delete protocols bgp traceoptions # commit
show bgp neighbor X.X.X.X zeigt den letzten Error-Code.
Häufigste Ursachen: falsche AS-Nummer beim Peer (peer-as),
fehlende Route zum Peer (keine Adjacency möglich),
oder Authentication-Key stimmt nicht überein.
Traceoptions mit flag open zeigt den OPEN-Message-Austausch.
set protocols ospf interface ge-0/0/0.0 ignore-mtu-mismatch
oder MTU auf beiden Seiten angleichen.
test policy POLICYNAME PREFIX zeigt was die Policy tatsächlich macht.
Häufig fehlt ein explizites then accept im letzten Term,
oder die Policy ist am BGP-Group-Level nicht eingetragen (export fehlt).
Nach Policy-Änderung immer clear bgp neighbor X soft um neu zu evaluieren.
clear security flow session destination-prefix X.X.X.X/32
oder clear security flow session all (Vorsicht — unterbricht alle Verbindungen).
commit check zeigt Syntax-Fehler ohne zu committen.
show | compare zeigt was sich geändert hat.
Bei referenzierten Objekten (Policy-Namen, Prefix-Listen) die noch nicht existieren
schlägt commit ab. Alle referenzierten Objekte müssen vor dem commit vorhanden sein.