Open Vswitch Projekt VM: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(23 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 4: Zeile 4:
 
Es soll eine Debian 13 VM mit dem Namen '''ovs-lab''' in VirtualBox erstellt werden.   
 
Es soll eine Debian 13 VM mit dem Namen '''ovs-lab''' in VirtualBox erstellt werden.   
 
Die VM wird aus dem bestehenden Template '''debian-template''' geklont und anschließend mit 18 VirtIO-Netzwerkkarten ausgestattet.
 
Die VM wird aus dem bestehenden Template '''debian-template''' geklont und anschließend mit 18 VirtIO-Netzwerkkarten ausgestattet.
 
+
* NIC 1: Bridged auf Host-'''br0''' (temporär für die Installation)
* NIC 1–17: interne Netze (eth0–eth16) für den OVS-Switch
+
* NIC 2–17: interne Netze port2–port17 für den OVS-Switch
 
* NIC 18: NAT mit SSH-Portforwarding (Konsolen-Port)
 
* NIC 18: NAT mit SSH-Portforwarding (Konsolen-Port)
  
 
== Template klonen ==
 
== Template klonen ==
 
<pre>
 
<pre>
vboxmanage clonevm debian-template --name ovs-lab --register
+
vboxmanage clonevm debian-template --name ovs --register
 
</pre>
 
</pre>
  
 
== VM anpassen ==
 
== VM anpassen ==
 
<pre>
 
<pre>
vboxmanage modifyvm ovs-lab --cpus 2 --memory 2048 --chipset ich9
+
vboxmanage modifyvm ovs --cpus 2 --memory 2048 --chipset ich9
 
</pre>
 
</pre>
  
Zeile 25: Zeile 25:
 
</pre>
 
</pre>
  
== NICs 2–17 als interne Netze konfigurieren ==
+
== NICs 1–23 als interne Netze konfigurieren ==
 
<pre>
 
<pre>
for k in $(seq 2 17); do
+
for k in $(seq 1 23); do
    l=$(($k-1))
+
     vboxmanage modifyvm ovs --nic$k intnet --nictype$k virtio \
     vboxmanage modifyvm ovs-lab --nic$k intnet --nictype$k virtio \
+
         --intnet$k "port$k" --cableconnected$k on --nicpromisc$k allow-all
         --intnet$k "eth$l" --cableconnected$k on --nicpromisc$k allow-all
 
 
done
 
done
 
</pre>
 
</pre>
  
== NIC 18 als NAT-Konsolen-Port konfigurieren ==
+
== NIC 24 als NAT-Konsolen-Port konfigurieren ==
NIC 18 dient als Konsolen-Port (analog zum Konsolen-Port eines echten Switches):
+
NIC 24 dient als Konsolen-Port (analog zum Konsolen-Port eines echten Switches):
 
<pre>
 
<pre>
vboxmanage modifyvm ovs-lab --nic18 nat --nictype18 virtio --cableconnected18 on
+
vboxmanage modifyvm ovs --nic24 nat --nictype24 virtio --cableconnected18 on
vboxmanage modifyvm ovs-lab --natpf18 "ssh,tcp,,2222,,22"
+
vboxmanage modifyvm ovs --natpf24 "ssh,tcp,,2222,,22"
 
</pre>
 
</pre>
  
Zeile 52: Zeile 51:
 
* RAM: 2 GB
 
* RAM: 2 GB
 
* Chipsatz: ICH9
 
* Chipsatz: ICH9
* NIC 1: intnet '''br0''' (temporär für Installation)
+
* NIC 1–23: interne Netze port1–port23
* NIC 2–17: interne Netze eth1–eth16
+
* NIC 24: NAT, SSH-Portforwarding Host 2222 → Guest 22 (Konsolen-Port)
* NIC 18: NAT, SSH-Portforwarding Host 2222 → Guest 22 (Konsolen-Port)
 
  
 
Die VM ist nun bereit für die Debian-Installation.
 
Die VM ist nun bereit für die Debian-Installation.
== ssh config anlegen ==
 
;Der Pseudo Konsolenport
 
Host ovs-lab
 
  Hostname 127.0.0.1
 
  Port 2222
 
  User kit
 
  
== Netzwerkinterfaces umbenennen (eth1–eth18) ==
+
==Maschine starten==
 +
;In der Maschine letzte Schnittstelle auf DHCP setzen
 +
dhcpcd enp2s15
  
Die Netzwerkinterfaces werden per '''udev'''-Regel dauerhaft und zuverlässig in '''eth1–eth18''' umbenannt.
+
== SSH-Config anlegen ==
 +
;Der Pseudo-Konsolenport
 +
~/.ssh/config
 +
<pre>
 +
Host ovs
 +
    Hostname 127.0.0.1
 +
    Port 2222
 +
    User kit
 +
</pre>
  
=== MAC-Adressen auf dem Host auslesen ===
+
== SSH-Key kopieren ==
Auf dem Host ausführen:
 
 
<pre>
 
<pre>
for k in $(seq 1 18); do
+
ssh-copy-id ovs
    mac=$(vboxmanage showvminfo ovs-lab --machinereadable \
 
        | grep "^macaddress$k=" \
 
        | cut -d= -f2 \
 
        | tr -d '"' \
 
        | sed 's/../&:/g;s/:$//' \
 
        | tr '[:upper:]' '[:lower:]')
 
    echo "SUBSYSTEM==\"net\", ACTION==\"add\", ATTR{address}==\"$mac\", NAME=\"eth$k\""
 
done > 10-ovs-nics.rules
 
 
</pre>
 
</pre>
;Die Datei 10-ovs-nics.rules muss später in die VM
 
  
==Rüberkopieren==
+
== Einloggen ==
 
+
<pre>
 
+
ssh ovs
==Zugriff==
+
</pre>
*ssh kit@localhost -p 2222
 

Aktuelle Version vom 14. Mai 2026, 17:45 Uhr

Open vSwitch Lab VM in VirtualBox anlegen

Ziel

Es soll eine Debian 13 VM mit dem Namen ovs-lab in VirtualBox erstellt werden. Die VM wird aus dem bestehenden Template debian-template geklont und anschließend mit 18 VirtIO-Netzwerkkarten ausgestattet.

  • NIC 1: Bridged auf Host-br0 (temporär für die Installation)
  • NIC 2–17: interne Netze port2–port17 für den OVS-Switch
  • NIC 18: NAT mit SSH-Portforwarding (Konsolen-Port)

Template klonen

vboxmanage clonevm debian-template --name ovs --register

VM anpassen

vboxmanage modifyvm ovs --cpus 2 --memory 2048 --chipset ich9

NIC 1 für die Installation vorbereiten

NIC 1 wird temporär als Bridged-Adapter auf das Host-Interface br0 gesetzt, damit die VM während der Installation erreichbar ist:

vboxmanage modifyvm ovs-lab --nic1 bridged --nictype1 virtio \
    --bridgeadapter1 br0 --cableconnected1 on

NICs 1–23 als interne Netze konfigurieren

for k in $(seq 1 23); do
    vboxmanage modifyvm ovs --nic$k intnet --nictype$k virtio \
        --intnet$k "port$k" --cableconnected$k on --nicpromisc$k allow-all
done

NIC 24 als NAT-Konsolen-Port konfigurieren

NIC 24 dient als Konsolen-Port (analog zum Konsolen-Port eines echten Switches):

vboxmanage modifyvm ovs --nic24 nat --nictype24 virtio --cableconnected18 on
vboxmanage modifyvm ovs --natpf24 "ssh,tcp,,2222,,22"

Kontrolle

vboxmanage showvminfo ovs-lab

Ergebnis

  • VM-Name: ovs-lab
  • OS: Debian 13 (64-Bit)
  • CPU: 2 vCPUs
  • RAM: 2 GB
  • Chipsatz: ICH9
  • NIC 1–23: interne Netze port1–port23
  • NIC 24: NAT, SSH-Portforwarding Host 2222 → Guest 22 (Konsolen-Port)

Die VM ist nun bereit für die Debian-Installation.

Maschine starten

In der Maschine letzte Schnittstelle auf DHCP setzen
dhcpcd enp2s15

SSH-Config anlegen

Der Pseudo-Konsolenport
~/.ssh/config
Host ovs
    Hostname 127.0.0.1
    Port 2222
    User kit

SSH-Key kopieren

ssh-copy-id ovs

Einloggen

ssh ovs