Vlan
Installation du support Vlan :
# aptitude install vlan
# modprobe 8021q
Configuration statique :
auto eth0
iface eth0 inet static
address 192.168.1.50
netmask 255.255.255.0
# gateway 192.168.1.254
auto eth0.200
iface eth0.200 inet static
address 212.194.96.5
netmask 255.255.252.0
gateway 212.194.99.254
Ajout des interfaces Virtuel
# vconfig add eth0 30
Vérification :
# ifconfig -a
Configuration du vlan 30 dans /etc/network/interfaces :
allow-hotplug eth0.30
iface eth0.30 inet static
address 10.1.30.250
netmask 255.255.255.0
broadcast 10.1.30.255
Pour information:
Prérequis
Le noyau Linux doit supporter la gestion de VLAN IEEE 802.1Q via le module VLAN_8021Q.
# cat /boot/config-$(uname -r) | grep 8021Q
Installation via Aptitude du paquet vlan pour la gestion de VLAN IEEE 802.1Q.
# aptitude install vlan
Déclaration via la ligne de commande
Création d’un VLANs tagué 7 sur l’interface eth0.
# vconfig add eth0 7
Suppression d’un VLANs tagué 7 sur l’interface eth0.
# vconfig rem eth0.7
Déclaration automatique lors du démarrage du système via le programme ifupdown
Ajout dans son fichier de configuration /etc/network/interfaces
#Initialisation d’un VLAN 0 et d’un VLAN 1 sur les interfaces Ethernet eth0 et eth1.
post-up /usr/sbin/vconfig add eth0 0
post-up /usr/sbin/vconfig add eth1 1
pre-down /usr/sbin/vconfig rem eth0.0
pre-down /usr/sbin/vconfig rem eth1.1
post-up /usr/sbin/vconfig add eth0 0 création du VLAN 0 sur l’interface eth0 après initialisation des interfaces réseau.
post-up /usr/sbin/vconfig add eth1 1 création du VLAN 1 sur l’interface eth1 après initialisation des interfaces réseau.
pre-down /usr/sbin/vconfig rem eth0 0 suppression du VLAN 0 sur l’interface eth0 avant désactivation des interfaces réseau.
pre-down /usr/sbin/vconfig rem eth1 1 suppression du VLAN 1 sur l’interface eth1 avant désactivation des interfaces réseau.
#Initialisation d’un VLAN 0 et d’u VLAN 1 sur les interfaces eth0 et eth1 lors de l’initialisation des interfaces.
auto eth0.0
iface eth0.0 inet static
auto eth1.1
iface eth1.1 inet static
auto eth0 0 initialise l’interface eth0 avec le VLAN 0 lors du démarrage du système.
iface eth0.0 inet static définit une configuration réseau statique (figé) sur l’interface eth0.0.
auto eth1 1 initialise l’interface eth1 avec le VLAN 1 lors du démarrage du système.
iface eth1.1 inet static définit une configuration réseau statique (figé) sur l’interface eth1.1.
Redémarrage du service Networking.
# service networking restart
ou
# /etc/init.d/networking restart