Strumenti Utente

Strumenti Sito


debian:vlan

VLAN

Utilizzo di vlan con bridge in debian
di seguito la configurazione (che sarebbe da spiegare) di più schede di rete sullo stesso host.

interface
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
source /etc/network/interfaces.d/*
 
# The loopback network interface
auto lo
iface lo inet loopback
 
auto eth0
iface eth0 inet manual
 
auto br1
iface br1 inet static
address 10.57.45.2
netmask 255.255.254.0
gateway 10.57.44.1
dns-nameservers 109.1.8 10.109.1.9 
   bridge_ports eth0.1
   bridge_stp on
   bridge_fd 0.0
   pre-up ifup eth0.1
   post-down ifdown eth0.1
iface br1 inet6 static
   address fe80::2e41:38ff:fe95:43d4
   netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br1/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br1/autoconf
iface eth0.1 inet manual
   vlan_raw_device eth0
 
auto br2
iface br2 inet static
address 192.168.4.81
netmask 255.255.255.0
   bridge_ports eth0.2
   bridge_stp on
   bridge_fd 0.0
   pre-up ifup eth0.2
   post-down ifdown eth0.2
iface br2 inet6 static
   address fe80::2e41:38ff:fe95:43d4
   netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br2/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br2/autoconf
iface eth0.2 inet manual
   vlan_raw_device eth0
 
auto br3
iface br3 inet static
address 10.57.46.181
netmask 255.255.255.192
   bridge_ports eth0.3
   bridge_stp on
   bridge_fd 0.0
   pre-up ifup eth0.3
   post-down ifdown eth0.3
iface br3 inet6 static
address fe80::2e41:38ff:fe95:43d4
netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br3/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br3/autoconf
iface eth0.3 inet manual
   vlan_raw_device eth0
 
 
auto br4
iface br4 inet static
   address 172.16.196.122
   netmask 255.255.0.0
   bridge_ports eth0.5
   bridge_stp on
   bridge_fd 0.0
   pre-up ifup eth0.5
   post-down ifdown eth0.5
iface br4 inet6 static
   address fe80::2e41:38ff:fe95:43d4
   netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br4/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br4/autoconf
 
auto br6
iface br6 inet static
   address 217.141.171.2
   netmask 255.255.255.248
  ## gateway 217.141.171.1 
   bridge_ports eth0.6
   bridge_stp on
   bridge_fd 0.0
   pre-up ifup eth0.6
   post-down ifdown eth0.6
iface br6 inet6 static
   address fe80::2e41:38ff:fe95:43d4
   netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br4/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br4/autoconf
#iface eth0.6 inet manual
#   vlan_raw_device eth0
 
 
iface eth0.5 inet manual
   vlan_raw_device eth0
 
auto br7
iface br7 inet static
   address 192.168.1.181
   netmask 255.255.255.0
   bridge_ports eth0.7
   bridge_stp on
   bridge_fd 0.0
   pre-up ifup eth0.7
   post-down ifdown eth0.7
iface br7 inet6 static
   address fe80::2e41:38ff:fe95:43d4
   netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br7/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br7/autoconf
iface eth0.7 inet manual
   vlan_raw_device eth0
 
auto br11
iface br11 inet static
address 192.168.0.44
netmask 255.255.255.0
#gateway 192.168.0.1
#dns-nameservers 8.8.8.8
   bridge_ports eth1
   bridge_stp on
   bridge_fd 0.0
iface br11 inet6 static
   address fe80::215:17ff:feb2:632c
   netmask 64
   pre-up echo 0 > /proc/sys/net/ipv6/conf/br11/autoconf
   post-down echo 1 > /proc/sys/net/ipv6/conf/br11/autoconf

ROUTE

supponiamo di avere una situazione come route tipo questa:

route -n 

oppure

netstat -rn

il risultato è uguale . ad es.

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         212.xxx.xxx.1   0.0.0.0         UG        0 0          0 vmbr0
10.57.44.0      0.0.0.0         255.255.254.0   U         0 0          0 vmbr11
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 vmbr17
212.xxx.xxx.0   0.0.0.0         255.255.255.248 U         0 0          0 vmbr0

se si usa solo route è uguale ma invece dell'ip fa vedere il nome del gateway

route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         hostx-xxx-stati 0.0.0.0         UG    0      0        0 vmbr0
10.57.44.0      *               255.255.254.0   U     0      0        0 vmbr11
192.168.1.0     *               255.255.255.0   U     0      0        0 vmbr17
212.xxx.xxx.0   *               255.255.255.248 U     0      0        0 vmbr0

Per cambiare il default gateway eliminare prima il vecchio

route del default

poi aggiungere quello nuovo

route add default gw 10.xxx.xxx.1
debian/vlan.txt · Ultima modifica: 2023/04/17 14:25 (modifica esterna)