VLAN mit Linux und Cisco Nexus: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 27: Zeile 27:
 
auto enp0s10.22
 
auto enp0s10.22
 
iface enp0s10.22 inet static
 
iface enp0s10.22 inet static
   address 172.16.113.1
+
   address 172.16.213.1
 
   netmask 255.255.255.0
 
   netmask 255.255.255.0
 
   vlan-raw-device enp0s10
 
   vlan-raw-device enp0s10
Zeile 33: Zeile 33:
 
auto enp0s10.23
 
auto enp0s10.23
 
iface enp0s10.23 inet static
 
iface enp0s10.23 inet static
   address 172.18.113.1
+
   address 172.18.213.1
 
   netmask 255.255.255.0
 
   netmask 255.255.255.0
 
   vlan-raw-device enp0s10
 
   vlan-raw-device enp0s10

Version vom 2. Juli 2025, 07:13 Uhr

Zielbeschreibung

  • Der Cisco-Port Ethernet1/1 ist als 802.1Q-Trunk konfiguriert.
  • Der Linux-Rechner verwendet das Interface enp0s10.
  • Zwei VLANs werden getaggt übertragen:
    • VLAN 22 → 172.16.213.1/24
    • VLAN 23 → 172.18.213.1/24

Plan


Voraussetzungen auf Debian/Linux

VLAN-Paket installieren
  • apt install vlan
VLAN-Modul laden
  • sudo modprobe 8021q
Modul beim Booten automatisch laden
  • echo 8021q | sudo tee -a /etc/modules

/etc/network/interfaces

auto lo
iface lo inet loopback

auto enp0s10
iface enp0s10 inet manual

auto enp0s10.22
iface enp0s10.22 inet static
  address 172.16.213.1
  netmask 255.255.255.0
  vlan-raw-device enp0s10

auto enp0s10.23
iface enp0s10.23 inet static
  address 172.18.213.1
  netmask 255.255.255.0
  vlan-raw-device enp0s10

VLAN anlegen

vlan 22
name SERVER
vlan 23 
name MGMT


Cisco-Konfiguration für Ethernet1/1

interface Ethernet1/1
  description Trunk zu Linux-Host
  switchport mode trunk
  switchport trunk allowed vlan 22,23
  spanning-tree port type edge trunk

Cisco-Konfiguration für Access-Ports

Ethernet1/2 und Ethernet1/3 → VLAN 22 (SERVER)
interface Ethernet1/2
  description VLAN 22 SERVER
  switchport mode access
  switchport access vlan 22
  spanning-tree port type edge

interface Ethernet1/3
  description VLAN 22 SERVER
  switchport mode access
  switchport access vlan 22
  spanning-tree port type edge
Ethernet1/4 und Ethernet1/5 → VLAN 23 (MGMT)
interface Ethernet1/4
  description VLAN 23 MGMT
  switchport mode access
  switchport access vlan 23
  spanning-tree port type edge

interface Ethernet1/5
  description VLAN 23 MGMT
  switchport mode access
  switchport access vlan 23
  spanning-tree port type edge

Aktivierung der Konfiguration

Nach den obigen Anpassungen auf dem Linux-System die Netzwerkschnittstellen neu starten:

  • sudo systemctl restart networking
  • ip addr show
  • Sicherstellen, dass die IP-Adressen korrekt zugewiesen wurden und die Kommunikation innerhalb der VLANs funktioniert.