Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just wanted to learn how VLANs work.That's why thought of setting up on couple of ubuntu machines, which was not working.I think so i have some wrong understandings about VLAN.Please correct me wherever i am wrong.

These are the steps which i followed:

On ubuntu machine 1:

 $ sudo modprobe 8021q
 $ ifconfig eth0 0.0.0.0 up
 $ sudo vconfig add eth0 6
 $ sudo ifconfig eth0.6 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 
 $ sudo ifconfig eth0 up

On ubuntu machine 2 :

 $ sudo modprobe 8021q
 $ ifconfig eth0 0.0.0.0 up
 $ sudo vconfig add eth0 6
 $ sudo ifconfig eth0.6 192.168.0.200 broadcast 192.168.0.255 netmask 255.255.255.0 
 $ sudo ifconfig eth0 up

Both these machines are connected to my organization's network.I heard that it is not mandatory to configure the switch/router about the ports and VLAN map(information which contains the map of specific ports to specific VLANs).They themselves will learn on the fly.Is that true? I think so my NIC also supports VLAN

After the above set up,I was able to see the interfaces with the corresponding IPs.

The entries in /proc/net/vlan/config is as below:

 VLAN Dev name    | VLAN ID
 Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
 eth0.6         | 6  | eth0

The entries in /proc/net/vlan/eth0.6

 eth0.6  VID: 6   REORDER_HDR: 1  dev->priv_flags: 1
     total frames received            0
      total bytes received            0
  Broadcast/Multicast Rcvd            0

  total frames transmitted          232
   total bytes transmitted        19220

  Device: eth0
  INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
  EGRESS priority mappings:

from machine 1:

 $ ping 192.168.0.200 

It was not working.When i tried with wireshark, i was able to see the ARP packet flow,which failed to find the corresponding MAC address.

share|improve this question
    
Your VLAN setup seems fine at first glance. I think it lies in the "these machines are connected to my org's net" - do they share one Ethernet Segment? Connected to what kind of switch? Is your company running VLANs? Only a "dumb" switch or an explicitly for VLANs configured company setup lets you do this. –  Michuelnik Jul 27 '12 at 10:48
    
Thanks for the quick reply.I understand what you mean by ethernet segment is subnetwork? Am i right ? If so my organization's ip is in the domain 172.16.XX.XX.I don't know what switch is that.But i heard that it supports VLANs.I don't think my organisation runs VLANs. All the machines have ip in the same subnet of 172.16.xx.xx.I think so i have understood your queries right.If not please correct me where i am wrong. –  user1186683 Jul 27 '12 at 11:15
add comment

2 Answers

You'll need to find out if your switches are capable of supporting VLANs and in what propensity. As has been said it's not a necessity but if your servers are connected to different switches, for instance, and one is aware of a vlan the other isn't, this could cause problems. Ideally, for each server, you would configure the switch port as a "tagged VLAN" interface, and then configure VLAN 6 on each of the switches that the servers are connected to. You then need to figure out if:

a) both servers are on the same switch, if so then the above is enough.

b) the servers are on two seperate switches with a direct connection between the two. In this instance you will have to configure the ports between the switches in the same way that you have configured the server ports.

c) There is at least one switch between the 1st server's switch and the second server's switch. In this situation you will need to make each switch between the servers with a matching VLAN and make sure that the connection between the switches is configured for tagged VLAN 6.

share|improve this answer
add comment

Try connecting the machines directly using a crossover cable. If the pings works (it should), you have a switch problem.

For vlans you need access to a trunk port (usually all ports on the switch are normal 'access' ports, which carry only untagged* traffic - trunk ports carry tagged traffic). Depending on the switch, if it recieves tagged traffic to an access port, some of them drop the packet, some of them remove (strip) the tag, (or do pretty much anything 'strange' if it's a noname switch).

*tagged = packets with vlan headers, untagged = "normal" packets without vlan headers

share|improve this answer
    
Hi mulaz,I was able to do the obvious ping using a crossover cable.I shall look into the switch.But i have couple of questions based on my understanding.Correct me if wrong. 1) Trunks are required only when the packets need to travel to a destination connected to another switch. If i am going to send packets between ports of same VLAN, how the packets will reach the destination properly. 2)I am aware that in wireshark,the tagged packets displays the VLAN id.Is that the VLAN id of the source or destination? –  user1186683 Jul 27 '12 at 11:50
    
1) access ports (normal ones for pc's) usually accept only untagged packets. Trunk ports accept tagged packets. Doesn't matter how many switches you have. If you have ports 1-10 in vlan1 and 11-20 in vlan2, and you wish the same on the other switch, you need to have a trunk connection between them. A pc sends an untagged packet to port 1, the switch tags it, and sends it around, and on the way out of the port, the tag is removed. So one port - one vlan. If you have a router, you want all the vlans on one port, so all the packets from all vlans come there with tags still on. –  mulaz Jul 27 '12 at 12:24
    
2) wireshark shows the vlan id from the packet. If the packet comes out the trunk port it has a vlan tag (which was added on the ingress access port, or by the computer/router connected to another trunk port). Outgoing packets you send should be untagged if you're connected to an acceess port, or can be tagged if you send them out to a trunk port (your pc adds the vlan id) –  mulaz Jul 27 '12 at 12:27
    
Basically using vlans you can split the switch to two (or more) virtual switches for users (lets say developers and management). Devs use vlan10, and mngmt vlan20. You put another switch, when the company grows larger, and you need more ports, and again you have vlan10 and vlan20. If you wanted to connect them together, you'd need to connect both vlans separatly (dev part of switch1 to dev part of switch2, and mngmt part of sw1 to sw2). To simplifly things, you can use one trunk ports, which mark the packets (with vlan-ids) so you only need one connection between switches. –  mulaz Jul 27 '12 at 12:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.