====== TP VLAN ======
Considérons la configuration suivante avec deux VLAN 100 & 200 et un lien //trunk// entre les deux switchs.
opeth(VLAN 200) grave(VLAN 200)
\ /
immortal - [s1] -------- [s2]
/ \
syl(VLAN 100) nile(VLAN 100)
==== Première Partie =====
**Configuration de syl (vlan 100)** :
ifconfig eth0 192.168.100.2/24
route add default gw 192.168.100.1
**Configuration de opeth (vlan 200)** :
ifconfig eth0 192.168.200.2/24
route add default gw 192.168.200.1
**Configuration de immortal** :
# vlan 100 & 200
ifconfig eth0 up
vconfig add eth0 100
vconfig add eth0 200
ifconfig eth0.100 192.168.100.1/24
ifconfig eth0.200 192.168.200.1/24
echo 1 > /proc/sys/net/ipv4/ip_forward
Version moderne de vconfig :
ip link add link eth0 name eth0.100 type vlan id 100
**Configuration du switch s1** :
vlan/create 100
vlan/create 200
port/setvlan 1 100 # untagged
port/setvlan 2 200 # untagged
vlan/addport 100 3 # tagged
vlan/addport 200 3 # tagged
**Nota Bene** : Pour tester le bon fonctionnement, on peut utiliser la commande tcpdump avec l'option -e (ethernet).
==== Deuxième Partie : Trunking =====
**Configuration de nile (vlan 100)** :
ifconfig eth0 192.168.100.3/24
route add default gw 192.168.100.1
**Configuration de grave (vlan 200)** :
ifconfig eth0 192.168.200.3/24
route add default gw 192.168.200.1
**Configuration du switch s1** :
# ...
vlan/addport 100 21
vlan/addport 200 21
**Configuration du switch s2** :
vlan/create 100
vlan/create 200
port/setvlan 1 100
port/setvlan 2 200
vlan/addport 100 21
vlan/addport 200 21