-broadcast: grup de màquines (nodes). s'envia els paquets a totes les màquines MAC. En lloc de punt a punt. -switch pla= no configurat (tonto).tots els elements estan conectats directament al mateix switch. Capa2 (el switch no conta com a màquina). -El cas de la classe és tracta d'un conmmutador.
-En el cas de la vlan podriem tenir crear dos rets a la classe de xarxa. Un exemple sería la telefonia IP.perque qüestio de prioritats necessiten ample de banda continu. -per xarxes més flexibles i estendre-les.Concepte de troncal:2 maneres de treballar= 1)fisicament (anar connectant switchos perts un connector a anar connectant switchos però guanyes els ports del nou switch) i 2)virtual=si el switch que s'ha de tirar fisicament.Estalbien tirar cables.No fan falta tants de cables.
Es coneixen els següents tipus de Virtual LANs:
Recursos:
[email protected]:~$ sudo apt-get install vlan [email protected]:~$ dpkg -L vlan | more (per veure els paquets instal·lats)
[email protected]:~$ vconfig Expecting argc to be 3-5, inclusive. Was: 1 Usage: add [interface-name] [vlan_id] rem [vlan-name] set_flag [interface-name] [flag-num] [0 | 1] set_egress_map [vlan-name] [skb_priority] [vlan_qos] set_ingress_map [vlan-name] [skb_priority] [vlan_qos] set_name_type [name-type] * The [interface-name] is the name of the ethernet card that hosts the VLAN you are talking about. * The vlan_id is the identifier (0-4095) of the VLAN you are operating on. * skb_priority is the priority in the socket buffer (sk_buff). * vlan_qos is the 3 bit priority in the VLAN header * name-type: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5) * FLAGS: 1 REORDER_HDR When this is set, the VLAN device will move the ethernet header around to make it look exactly like a real ethernet device. This may help programs such as DHCPd which read the raw ethernet packet and make assumptions about the location of bytes. If you don't need it, don't turn it on, because there will be at least a small performance degradation. Default is OFF. [email protected]:~$ ifconfig eth2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 inet addr:192.168.204.118 Bcast:192.168.204.255 Mask:255.255.255.0 inet6 addr: fe80::230:5ff:feeb:3b44/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11942 errors:0 dropped:0 overruns:0 frame:0 TX packets:9948 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:6811428 (6.8 MB) TX bytes:1949584 (1.9 MB) Interrupt:23 Base address:0x8000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:312 errors:0 dropped:0 overruns:0 frame:0 TX packets:312 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:24536 (24.5 KB) TX bytes:24536 (24.5 KB) [email protected]:~$ sudo vconfig add eth2 2 WARNING: Could not open /proc/net/vlan/config. Maybe you need to load the 8021q module, or maybe you are not using PROCFS?? Added VLAN with VID == 2 to IF -:eth2:- [email protected]:~$ sudo modprobe 8021q
[email protected]:~$ sudo vconfig add eth2 2 WARNING: Could not open /proc/net/vlan/config. Maybe you need to load the 8021q module, or maybe you are not using PROCFS?? Added VLAN with VID == 2 to IF -:eth2:- [email protected]:~$ sudo modprobe 8021q [email protected]:~$ sudo vconfig add eth2 2 ERROR: trying to add VLAN #2 to IF -:eth2:- error: File exists [email protected]:~$ sudo lsmod |grep 802 8021q 23324 0 garp 14197 1 8021q mac80211 436455 2 rt2x00pci,rt2x00lib cfg80211 178679 2 rt2x00lib,mac80211 [email protected]:~$ ifconfig -a eth2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 inet addr:192.168.204.118 Bcast:192.168.204.255 Mask:255.255.255.0 inet6 addr: fe80::230:5ff:feeb:3b44/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12137 errors:0 dropped:0 overruns:0 frame:0 TX packets:9984 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:6836078 (6.8 MB) TX bytes:1954339 (1.9 MB) Interrupt:23 Base address:0x8000
eth2.2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 <-l'important és el punt.pots tenir tantes wlans com vulguis. BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:312 errors:0 dropped:0 overruns:0 frame:0 TX packets:312 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:24536 (24.5 KB) TX bytes:24536 (24.5 KB) wlan1 Link encap:Ethernet HWaddr 00:19:5b:cc:09:0f BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Fitxer:RafelmelichFitxertcpdump
Entrada:dpenent del switch el deixarem passar i reconfigurar a una altra vlan o fer que es perdi. (filtratge). una vegada arrivat al switch etiquetat per enviarlo el deseticarà una vegada seleccionat el porty per on ha de sortir el paquet.
Dispositius per LES PRÀCTIQUES:
La sintaxi és així:
$ sudo ip link add link INTERFACE name INTERFACE.VID type vlan id VID
On:
Es pot utilitzar l'ordre ip link per configurar les VLAN. Per exemple:
$ sudo ip link add link eth0 name eth0.2 type vlan id 2
On configurem una interfície virtual de tipus VLAN amb VLAN_ID=2 a la interfície física eth0. Amb l'ordre anterior substituiriem l'obsoleta ordre vconfig:
sudo vconfig add eth0 2
Per consultar la interfície de xarxa cal utilitzar l'opció -a de l'ordre "obsoleta" ifconfig:
$ ifconfig -a
O utilitzar:
$ ip link
Per fer la configuració lògica a nivell IP podeu utilitzazr també ifconfig o ip, com si fos una interfície de xarxa qualsevol. La sintaxi de la comanda IP és:
$ ip addr add IP/NETMASK brd BROADCAST-ADDR dev INTERFACE.VID $ ip link set dev INTERFACE.VID up
Un exemple:
$ sudo ip addr add 192.168.100.1/24 brd 192.168.100.255 dev eth0.100 $ sudo ip link set dev eth0.100 up
Per desconfigurar-la:
$ sudo ip link set dev eth0.100 down
A més de suportar la nomenclatura típica de les vlan (interfície_real.VLAN_ID) també es pot utilitzar altres noms com:
$ sudo ip link add link eth0 name myvlan type vlan id 2 loose_binding on
Per esborrar una interfície de xarxa:
$ sudo ip link delete myvlan type vlan
Podeu consultar l'ajuda amb:
$ ip link add foo type vlan help Usage: ... vlan id VLANID [ FLAG-LIST ] [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ] VLANID := 0-4095 FLAG-LIST := [ FLAG-LIST ] FLAG FLAG := [ reorder_hdr { on | off } ] [ gvrp { on | off } ] [ loose_binding { on | off } ] QOS-MAP := [ QOS-MAP ] QOS-MAPPING QOS-MAPPING := FROM:TO
[email protected]:~$ sudo ip link add link eth2 name eth2.2 type vlan id 2 [email protected]:~$ sudo vconfig add eth2 2 ERROR: trying to add VLAN #2 to IF -:eth2:- error: File exists [email protected]:~$ ifconfig -a eth2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 inet addr:192.168.204.118 Bcast:192.168.204.255 Mask:255.255.255.0 inet6 addr: fe80::230:5ff:feeb:3b44/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:43174 errors:0 dropped:0 overruns:0 frame:0 TX packets:8316 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:58612415 (58.6 MB) TX bytes:1197521 (1.1 MB) Interrupt:23 Base address:0x8000 eth2.2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:221 errors:0 dropped:0 overruns:0 frame:0 TX packets:221 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:19056 (19.0 KB) TX bytes:19056 (19.0 KB) wlan1 Link encap:Ethernet HWaddr 00:19:5b:cc:09:0f BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
En ip link:
[email protected]:~$ ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:30:05:eb:3b:44 brd ff:ff:ff:ff:ff:ff 3: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:19:5b:cc:09:0f brd ff:ff:ff:ff:ff:ff 4: [email protected]: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN <--La @ indica que és tracta de una VLAN link/ether 00:30:05:eb:3b:44 brd ff:ff:ff:ff:ff:ff
Per realitzar una configuració lògica:
[email protected]:~$ sudo ip addr add 192.168.204.118 brd 192.168.204.255 dev eth2.2 [email protected]:~$ sudo ip link set dev eth2.2 up [email protected]:~$ ifconfig -a eth2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 inet addr:192.168.204.118 Bcast:192.168.204.255 Mask:255.255.255.0 inet6 addr: fe80::230:5ff:feeb:3b44/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:44581 errors:0 dropped:0 overruns:0 frame:0 TX packets:9317 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:58966922 (58.9 MB) TX bytes:1370219 (1.3 MB) Interrupt:23 Base address:0x8000 eth2.2 Link encap:Ethernet HWaddr 00:30:05:eb:3b:44 inet addr:192.168.204.118 Bcast:192.168.204.255 Mask:255.255.255.255 inet6 addr: fe80::230:5ff:feeb:3b44/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:43 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:8231 (8.2 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:221 errors:0 dropped:0 overruns:0 frame:0 TX packets:221 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:19056 (19.0 KB) TX bytes:19056 (19.0 KB) wlan1 Link encap:Ethernet HWaddr 00:19:5b:cc:09:0f BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)