3

If I have a layer 2 switch, is it possible to access two VLANs from one computer?

  • VLAN1: 192.168.1.x with netmask 255.255.255.0
  • VLAN2: 192.168.2.x with netmask 255.255.255.0

If my computer has only one NIC, can it be connected to both VLANs? IF I had two NICs, I know I could do it using two cables, but how to do it with a Layer 2 switch - Cisco 2950?

Edit:

The OS: Windows 7 Professional

The goal: make a computer access the engineering and the production VLANs to use some NAS and to print in a specific printer

3 Answers 3

11

You could access the two VLANs via a 802.1q trunk on the switchport connected to the computer. The NIC would have to be able to tag packets and recognize tagged packets.

The L2 switch by itself will not allow you to communicate between the two VLANs. You would need a router.

1
  • 1
    could potentially setup the computer to route between the networks, essentially killing two birds with one stone
    – emynd
    Commented Jul 30, 2013 at 13:19
6

First you have to use 802.1q trunking on the switchport:

switchport trunk encapsulation dot1q
(switchport trunk native vlan 1)
switchport trunk allowed vlan 2-4094
switchport mode trunk

Then you have to configure your NIC to recognize and send tagged packets. On some Broadcom NICs for example you can do this with a windows utility. With Linux you can configure the kernel to support 802.1q and create virtual NICs for each vlan. Can you give some more details about what you want to achieve and what OS?

Edit: For windows you have to check if your NIC supports vlan tagging. Many Intel and Broadcom NICs do...

Check in the driver settings of you NIC if there is a field like "vlan trunk" or anything similar and/or check the manual of your NIC. Sometime you also need a special driver for this. I maybe can give you some more detailed information if you can tell me what NIC you have exactely...

1

You should be able to connect two VLANs on the same NIC if you are using a server NIC that has more than one interface. I use a 4 port 10/100/1000 Intel NIC on my firewall. Two of those ports are trunked together to one VLAN and the other is going to a different VLAN. But I am not running each pair at the same time all the time. Most of the time it is set up for one trunked pair to take over if the main connection goes down. Unlike a an 802.1q trunk you will not be able to inter communicate between the two VLANs because you need a router to do that, but your computer should be able to talk to each VLAN. Let me know how it goes for you...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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