Vlan

De Wiki de Nelly & Richard
Sauter à la navigation Sauter à la recherche

Introduction

Je recherchais un switch niveau 2 avec 8 ports et pas trop cher, voilà mon dernier jouet : LYNKSYS SLM2008 :)

  1. Gigabit : 802.3ab, 802.3z
  2. LACP (bonding) : 802.3ad
  3. VLAN : 802.1q
  4. RADIUS authentication : 802.1x
  5. PoE (port 1) : 802.3af
  6. flow control : 803.3x
  7. QoS : 802.3p
  8. STP (Spanning Tree) : 802.3d
  9. port mirroring
  10. ...

Pour en revenir au sujet principal, il est parfois utile de rendre "étanche" 2 ou plusieurs réseaux.
La norme 802.1q permet de faire cela sans avoir plusieurs actifs.

On partira ici de la suite de la configuration de la page sur le NIC bonding

Configuration

debian

installation

root@server:~# apt-get install vlan

configuration manuelle

  • chargement du module responsable
root@server:~# modprobe 8021q
  • ajout du VLAN ID 2
root@server:~# vconfig add bond0 2
root@server:~# ifconfig bond0.2 10.0.0.1 netmask 255.255.255.0
  • ajout du VLAN ID 3
root@server:~# vconfig add bond0 3
root@server:~# ifconfig bond0.3 192.168.0.1 netmask 255.255.255.0
root@server:~# route add default gw 192.168.0.1
  • ajout du VLAN ID 4
root@server:~# vconfig add bond0 4
root@server:~# ifconfig bond0.4 192.168.1.1 netmask 255.255.255.0
root@server:~# route add default gw 192.168.1.1

fichier /etc/network/interfaces

# bonding balance-alb (eth0 + eth1)
auto bond0
allow-hotplug bond0
iface bond0 inet manual
     # interfaces esclaves
     slaves eth0 eth1
     # mode
     bond_mode balance-alb
     # MII monitor
     bond_miimon 100
     bond_downdelay 200
     bond_updelay 200

# vlan id 2 bond0.2
auto bond0.2
allow-hotplug bond0.2
iface bond0.2 inet static
       # définition du parent
       vlan_raw_device bond0
       address 10.0.0.1
       netmask 255.255.255.0
       broadcast 10.0.0.255

# vlan id 3 bond0.3
auto bond0.3
allow-hotplug bond0.3
iface bond0.3 inet static
       # définition du parent
       vlan_raw_device bond0
       address 192.168.0.1
       netmask 255.255.255.0
       network 192.168.0.0
       broadcast 192.168.0.255
       gateway 192.168.0.2

# vlan id 4 bond0.4
auto bond0.4
allow-hotplug bond0.4
iface bond0.4 inet static
       # définition du parent
       vlan_raw_device bond0
       address 192.168.1.1
       netmask 255.255.255.0
       network 192.168.1.0
       broadcast 192.168.1.255
       gateway 192.168.1.2

statut

root@server:~# cat /proc/net/vlan/config
VLAN Dev name	 | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
bond0.2        | 2  | bond0
bond0.3        | 3  | bond0
bond0.4        | 4  | bond0
root@server:~# cat /proc/net/vlan/<DEVICE>

SLM2008

Page VLAN

VLAN Settings

Saisie du/des VLAN appartenant à un port.

VLAN Port Setting

Saisie des propriétés de chaque port (tagged only, filtrage d'entrée, untag force, ...)
Le choix du VLAN ID 1 permet de communiquer avec plusieurs VLAN