Vlan – Connecting two VLANs together on a single switch

vlan

I'm doing some experiments and I want to know if it is possible to connect two VLANs on a single switch by using just a cable between one group of ports and the other.

My goal is to simulate (using only one physical switch) two independent switches connected together by a fiber cable.

I'm using per-port based VLANs and my current setup is:

  • VLAN 1: ports 1-24,49
  • VLAN 2: ports 25-48,50

I want to connect these VLANs using a cable from port 49 to port 50. Both of these VLANs are supposed to be in the subnet 10.128.0.0/24.

Connecting the cable didn't work. Googling for it I found some articles that told me I needed a router between the VLANs, but the examples showed VLANs on different subnets. If I really need a router, can I use the routing capabilities of my switch (it's an L3 switch)? If yes, how? I have no background on CLI programming, but have a basic understanding of networks.

[update]

I'm sorry if I have not made myself clear. Some clarifications:

The switch is an Arista 7048T-A.

When I say it didn't work, I mean that a computer on VLAN 1 can't ping a computer on VLAN 2, even though those VLANs are connected to each other through a cable.

My understanding was that creating VLANs would effectively separate the address learning of the ports, but according to mellowd's answer, I was wrong.

I mentioned CLI because maybe there would be some obvious recipe to follow or some misconfiguration to fix, as obviously I'm not experienced with network equipment. Also, I was naive enough to think that CLI was kind of standardized between equipment, but again I was wrong.

I want to do it because I want to make computer A send traffic to the switch (via 1G copper cable) and have this traffic pass through the fiber (10G) before being delivered to computer B (also 1G copper). Neither computer has an optical interface (yet). If I had two switches I could just connect them with a fiber and have a computer on each one. As I don't, I was looking for a way to do it with the switch that I have. I want to test the latency of the traffic going through the fiber.

So, I may get the terminology wrong, but the main question is:

Is it possible to have two separate VLANs on the same switch with the same address space and make them comunicate with one cable between them, as if they were two distinct switches?

Following the question:

  1. If yes, how?
  2. If no, why? Is the VLAN approach wrong? Is there another way to route the traffic as described?

Best Answer

You could do this, but you run into all kinds of problems with spanning-tree. Your ports could go into err-disabled.

You won't have two separate switches though. The single switch still learns MAC addresses on a port and vlan and that is switch-wide