Schritt 2: Inbetriebnahme
Zugriff auf die CLI
Sie konfigurieren Junos cRPD mithilfe von Junos CLI-Befehlen für Routing-Services. So greifen Sie auf die Junos CLI zu:
- Melden Sie sich beim Junos cRPD-Container an.
root@crpd:~# docker exec -it crpd01 cli
- Überprüfen Sie die Junos OS-Version.
root@crpd01> show version root@crpd01> show version Hostname: crpd01 Model: cRPD Junos: 24.2R1.14 cRPD package version : 24.2R1.14 built by builder on 2024-06-22 01:04:40 UTC
- Wechseln Sie in den Konfigurationsmodus.
root@crpd01> configure Entering configuration mode
- Fügen Sie dem Benutzerkonto für die Root-Administration ein Kennwort hinzu. Geben Sie ein Klartextkennwort ein.
[edit] root@crpd01# set system root-authentication plain-text-password New password: Retype new password:
- Bestätigen Sie die Konfiguration.
[edit] root@crpd01# commit commit complete root@crpd01# exit Exiting configuration mode root@crpd01> exit root@crpd:~#
- Fahren Sie bei Bedarf mit dem Anpassen der Konfiguration fort.
Verbinden von cRPD-Instanzen
Sehen wir uns nun an, wie Sie Punkt-zu-Punkt-Verbindungen zwischen zwei Junos cRPD-Containern erstellen.
In diesem Beispiel verwenden wir zwei Container, crpd01 und crpd02, und verbinden sie über eth1-Schnittstellen, die mit einer OpenVswitch (OVS)-Bridge auf dem Host verbunden sind. Wir verwenden eine OVS-Bridge für Docker-Netzwerke, da sie mehrere Host-Netzwerke unterstützt und eine sichere Kommunikation bietet. Sehen Sie sich die folgende Abbildung an:

- Installieren Sie das OVS-Switch-Dienstprogramm.
root@crpd:~# apt install openvswitch-switch Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libunbound8 openvswitch-common python3-openvswitch python3-sortedcontainers Suggested packages: openvswitch-doc python-sortedcontainers-doc The following NEW packages will be installed: libunbound8 openvswitch-common openvswitch-switch python3-openvswitch python3-sortedcontainers 0 upgraded, 5 newly installed, 0 to remove and 58 not upgraded. Need to get 3,167 kB of archives. After this operation, 14.2 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libunbound8 amd64 1.9.4-2ubuntu1.6 [349 kB] Get:2 http://us.archive.ubuntu.com/ubuntu focal/main amd64 python3-sortedcontainers all 2.1.0-2 [27.3 kB] Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 openvswitch-common amd64 2.13.8-0ubuntu1.4 [1,156 kB] Get:4 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-openvswitch all 2.13.8-0ubuntu1.4 [94.9 kB] Get:5 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 openvswitch-switch amd64 2.13.8-0ubuntu1.4 [1,539 kB] Fetched 3,167 kB in 1s (3,989 kB/s) Selecting previously unselected package libunbound8:amd64. (Reading database ... 72451 files and directories currently installed.) Preparing to unpack .../libunbound8_1.9.4-2ubuntu1.6_amd64.deb ...
- Erstellen Sie einen weiteren Junos cRPD-Container mit dem Namen crpd02.
root@crpd:~# docker volume create crpd02-config crpd02-config root@crpd:~# docker volume create crpd02-varlog crpd02-varlog root@crpd:~# docker run --rm --detach --name crpd02 -h crpd02 --net=none --privileged -v crpd02-config:/config -v crpd02-varlog:/var/log -it crpd:24.2R1.14 c000db8998b708b6ff04581d53404d3164a1137c99c9adbe4c34ce3ea3f74671
Überprüfen Sie die neu erstellten Containerdetails.
root@crpd:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c000db8998b7 crpd:24.2R1.14 "/sbin/runit-init.sh" 20 seconds ago Up 20 seconds crpd02 710b3b6ca824 crpd:24.2R1.14 "/sbin/runit-init.sh" 6 minutes ago Up 6 minutes crpd01
- Melden Sie sich beim Junos cRPD-Container an.
root@crpd:~# docker exec -it crpd02 cli root@crpd02> configure Entering configuration mode
- Fügen Sie dem Benutzerkonto für die Root-Administration ein Kennwort hinzu. Geben Sie ein Klartextkennwort ein.
[edit] root@crpd02# set system root-authentication plain-text-password New password: Retype new password:
- Bestätigen Sie die Konfiguration.
[edit] root@crpd02# commit commit complete root@crpd02# exit Exiting configuration mode root@crpd01> exit root@crpd:~#
- Konfigurieren Sie eine neue Bridge mit dem Namen crpd01-crpd02_1 und fügen Sie den Containern crpd01 und crpd02 die eth1-Schnittstelle hinzu.
root@crpd:~# ovs-vsctl add-br crpd01-crpd02_1 root@crpd:~# ovs-docker add-port crpd01-crpd02_1 eth1 crpd01 root@crpd:~# ovs-docker add-port crpd01-crpd02_1 eth1 crpd02
Melden Sie sich beim Container crpd01 an, und überprüfen Sie die Schnittstellenkonfiguration.
root@crpd:~# docker exec -it crpd01 bash ===> Containerized Routing Protocols Daemon (CRPD) Copyright (C) 2020-2023, Juniper Networks, Inc. All rights reserved. <=== root@crpd01:/# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::300a:aeff:fe25:2eb2 prefixlen 64 scopeid 0x20<link> ether 32:0a:ae:25:2e:b2 txqueuelen 1000 (Ethernet) RX packets 15 bytes 1402 (1.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7 bytes 746 (746.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@crpd01:/# exit exit
- Melden Sie sich beim Container crpd02 an, und überprüfen Sie die Schnittstellenkonfiguration.
root@crpd:~# docker exec -it crpd02 bash ===> Containerized Routing Protocols Daemon (CRPD) Copyright (C) 2020-2023, Juniper Networks, Inc. All rights reserved. <=== root@crpd02:/# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::48d4:b1ff:fe30:9694 prefixlen 64 scopeid 0x20<link> ether 4a:d4:b1:30:96:94 txqueuelen 1000 (Ethernet) RX packets 8 bytes 656 (656.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7 bytes 746 (746.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@crpd02:/# exit exit root@crpd:~#
- Konfigurieren Sie IP-Adressen für die eth1-Schnittstellen.
root@crpd:~# docker exec -d crpd01 ifconfig eth1 10.1.1.1/24 root@crpd:~# docker exec -d crpd02 ifconfig eth1 10.1.1.2/24
Melden Sie sich beim Junos cRPD-Container crpd01 an.
root@crpd:~# docker exec -it crpd01 bash ===> Containerized Routing Protocols Daemon (CRPD) Copyright (C) 2020-2023, Juniper Networks, Inc. All rights reserved. <=== root@crpd01:/# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.1.1.1 netmask 255.255.255.0 broadcast 10.1.1.255 inet6 fe80::300a:aeff:fe25:2eb2 prefixlen 64 scopeid 0x20<link> ether 32:0a:ae:25:2e:b2 txqueuelen 1000 (Ethernet) RX packets 17 bytes 1542 (1.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7 bytes 746 (746.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- Senden Sie einen Ping an den Container crpd02, um die Konnektivität zwischen den beiden Containern zu bestätigen. Verwenden Sie die IP-Adresse von eth1 von crpd02 (10.1.1.2), um den Container anzupingen.
root@crpd01:/# ping 10.1.1.2 -c 2 PING 10.1.1.2 (10.1.1.2) 56(84) bytes of data. 64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.323 ms 64 bytes from 10.1.1.2: icmp_seq=2 ttl=64 time=0.042 ms --- 10.1.1.2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1018ms rtt min/avg/max/mdev = 0.042/0.182/0.323/0.141 ms root@crpd01:/# exit exit
Die Ausgabe bestätigt, dass die beiden Container miteinander kommunizieren können.
Melden Sie sich beim Junos cRPD-Container crpd02 an.
root@crpd:~# docker exec -it crpd02 bash ===> Containerized Routing Protocols Daemon (CRPD) Copyright (C) 2020-2023, Juniper Networks, Inc. All rights reserved. <=== root@crpd02:/# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.1.1.2 netmask 255.255.255.0 broadcast 10.1.1.255 inet6 fe80::48d4:b1ff:fe30:9694 prefixlen 64 scopeid 0x20<link> ether 4a:d4:b1:30:96:94 txqueuelen 1000 (Ethernet) RX packets 16 bytes 1244 (1.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12 bytes 1124 (1.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- Senden Sie einen Ping an den Container crpd01, um die Konnektivität zwischen den beiden Containern zu bestätigen. Verwenden Sie die IP-Adresse von eth1 von crpd01 (10.1.1.1), um den Container anzupingen.
root@crpd02:/# ping 10.1.1.1 PING 10.1.1.1 (10.1.1.1) 56(84) bytes of data. 64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.509 ms 64 bytes from 10.1.1.1: icmp_seq=2 ttl=64 time=0.074 ms 64 bytes from 10.1.1.1: icmp_seq=3 ttl=64 time=0.074 ms ^C --- 10.1.1.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2048ms rtt min/avg/max/mdev = 0.074/0.219/0.509/0.205 ms
Die Ausgabe bestätigt, dass die beiden Container miteinander kommunizieren können.
Konfigurieren von Open Shortest Path First (OSPF)
Jetzt verfügen Sie über zwei Container, crpd01 und crpd02, die miteinander verbunden sind und kommunizieren. Der nächste Schritt besteht darin, benachbarte Nachbarschaften für die beiden Container einzurichten. OSPF-fähige Router müssen Nachbarschaften mit ihrem Nachbarn bilden, bevor sie Informationen mit diesem Nachbarn austauschen können.
- Konfigurieren Sie OSPF für den Container crpd01.
[edit] root@crpd01# show policy-options policy-statement adv { term 1 { from { route-filter 10.10.10.0/24 exact; } then accept; } } [edit] root@crpd01# show protocols ospf { area 0.0.0.0 { interface eth1; interface lo0.0; } export adv; } [edit] root@crpd01# show routing-options router-id 10.255.255.1; static { route 10.10.10.0/24 reject; }
- Bestätigen Sie die Konfiguration.
[edit] root@crpd01# commit commit complete
- Wiederholen Sie die Schritte 1 und 2, um OSPF für den Container crpd02 zu konfigurieren.
root@crpd02# show policy-options policy-statement adv { term 1 { from { route-filter 10.20.20.0/24 exact; } then accept; } } [edit] root@crpd02# show routing-options router-id 10.255.255.2; static { route 10.20.20.0/24 reject; } [edit] root@crpd02# show protocols ospf area 0.0.0.0 { interface eth1; interface lo0.0; } export adv;
- Verwenden Sie show-Befehle, um OSPF-Nachbarn zu überprüfen, die eine unmittelbare Nachbarschaft haben.
root@crpd01> show ospf neighbor Address Interface State ID Pri Dead 10.1.1.2 eth1 Full 10.255.255.2 128 38
root@crpd01> show ospf route Topology default Route Table: Prefix Path Route NH Metric NextHop Nexthop Type Type Type Interface Address/LSP 10.255.255.2 Intra AS BR IP 1 eth1 10.1.1.2 10.1.1.0/24 Intra Network IP 1 eth1 10.20.20.0/24 Ext2 Network IP 0 eth1 10.1.1.2 10.255.255.1/32 Intra Network IP 0 lo0.0 10.255.255.2/32 Intra Network IP 1 eth1 10.1.1.2
Die Ausgabe zeigt die eigene Loopback-Adresse des Containers und die Loopback-Adressen aller Container, an die er unmittelbar angrenzt. Die Ausgabe bestätigt, dass das Junos cRPD eine OSPF-Nachbarbeziehung aufgebaut und deren Adressen und Schnittstellen gelernt hat.
Anzeigen von Junos cRPD-Core-Dateien
Wenn eine Core-Datei generiert wird, finden Sie die Ausgabe im /var/crash
Ordner. Die generierten Core-Dateien werden auf dem System gespeichert, auf dem die Docker-Container gehostet werden.
- Wechseln Sie in das Verzeichnis, in dem Absturzdateien gespeichert werden.
root@linux-host:~# cd /var/crash
- Listen Sie die Absturzdateien auf.
root@linux-host:/var/crash# ls -l total 32 -rw-r----- 1 root root 29304 Jul 14 15:14 _usr_bin_unattended-upgrade.0.crash
- Identifizieren Sie den Speicherort der Core-Dateien.
root@linux-host:/var/crash# sysctl kernel.core_pattern kernel.core_pattern = |/bin/bash -c "$@" -- eval /bin/gzip > /var/crash/%h.%e.core.%t-%p-%u.gz