4

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?
6
  • Ok by definition you cannot really use 2 vlans with 1 IP address space (yes with enough work you can hook it up but why). No one can help with cli if you don't even identify the vendor of the switch much less the model. ASSUMING you have cisco you would enable routeing then set up 2 vlan interfaces, and then set the default gateways of the devices you are attaching to the switch to the respective ip addresses you configured for each vlan in the switch
    – fredpbaker
    Commented Nov 29, 2013 at 19:37
  • It's unclear what you need to do. Why do you need to simulate the switches? What functions are you going to simulate? How will you use the switch? FYI, if you need to simulate spanning tree convergence, then you should use two switches. Commented Nov 29, 2013 at 19:38
  • When you say it didn't work, what do you mean? Do the ports 49 and 50 come up? Are they in the connected state (not err-disabled)? Are your spanning-tree instances for v1 and v2 forwarding on those ports?
    – Ron Trunk
    Commented Nov 29, 2013 at 19:52
  • @Ron Ports 49 and 50 come up normally and appear as connected, as do the other two ports that have computers connected to them. I don't know about the spanning-tree instances state, I'll check that on monday.
    – bsmartins
    Commented Nov 30, 2013 at 0:48
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Commented Aug 10, 2017 at 1:44

6 Answers 6

2

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

1
  • Hi, I edited the question. I thought that the address learning would be limited to the VLANs. The spanning tree would be messed up because I would create a loop?
    – bsmartins
    Commented Nov 30, 2013 at 0:44
2

Yes, this is possible and a common configuration for many "inline" services like load-balancers, security appliances, etc.

You'll be able to do this on Cisco, Juniper and other common switches but, as of this writing, the Arista series switches are not compatible with VLAN bridging WHEN you are also routing on one of those VLANs through the switch.

Essentially, the Arista switch will drop its own MAC address on the second VLAN.

1
  • Welcome to NE, we hope you will both contribute to and learn from this community. This sounds like a perfectly reasonable explanation to me, however could you edit the answer to provide some link or reference that will support this explanation? This would help provide some validity to your answer.
    – YLearn
    Commented Aug 6, 2015 at 18:56
1

As others have commented above, having the vendor of your switch would be useful. In addition, the reasons why you're attempting to simulate two different switches with a single switch is unclear.

If your VLANs are representative of the same subnet, you'd need to use a trunk to interconnect the VLANs. This should be possible (although highly unlikely that it would actually work) with a single cable, and configuring each port that the cable connects to as a VLAN trunk (best practices typically dictate IEEE 802.1Q for this) will be required, in addition to allowing each VLAN across the trunk. Again, best practices would dictate, however, that you should have separate subnets that each VLAN would represent, and then configure Layer 3 interfaces for each VLAN.

1
  • Hi, I edited the question to clarify my intent.
    – bsmartins
    Commented Nov 30, 2013 at 0:49
1

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.

I suppose this is theoretically possible, although what you are trying to accomplish is exactly what VLAN separation sets out to resolve, layer 2 separation.

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

In all reality, you’re probably better off getting another switch. One can be procured for a relatively cheap price. The route you’re trying to take doesn’t really make any sense. In a production environment, a VLAN on one switch that’s connected to another switch is going to look almost identical to what it looks like on the first.

My biggest question would be “what are you trying to prove?”

If you’re just trying to figure out what VLANs will look like on a switch, then setup a switch and put a single VLAN on there.

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?

Again, while this is theoretically possible, you’re trying to sidestep VLAN separation to accomplish a test bed setup that will never reflect a real network.

If no, why? Is the VLAN approach wrong? Is there another way to route the traffic as described?

I think this approach is a little off. VLANs, in their simplest form, are simple to configure and associate with their respective ports. You mentioned that this is a L3 switch, configure some switched virtual interfaces (SVI), put the VLANs on different subnets, and route between the VLANs.

0

Sure you can do this! We use it when we need to renumber a vlan! for example vlan 1 is in use on a location, but we don't want to use vlan 1 for security-reasons! So we configure vlan 10, connect a utp-cable between vlan 10 and vlan 1 (access-ports, no cdp ena (cisco switches)) then reconfigure all clients from vlan 1 to vlan10, and finaly diable the def gateway ( int vlan 1, no ip addre , int vlan 10, ip address x.x.x.x, no shut) and everything works, and can work during I am doing my switchover. Only 5 seconds downtime to replace the default gateway :)

-1

The best and easiest way to make two VLANS communicate is to set up InterVLAN routing.

5
  • You could improve your answer by editing it to add more details to make it more useful both for the original poster and future users. Typically short answers like this could provide reasoning why you believe this is the answer, more explanation about the concepts mentioned, references/links to supporting resources, or applicable examples.
    – YLearn
    Commented Aug 6, 2015 at 17:49
  • = google search
    – Chris Zog
    Commented Aug 6, 2015 at 18:44
  • Stack Exchange communities strive to provide high quality answers that will help users when they find such results when making a web search. The point is that it is frustrating to a user who finds a similar question to their needs via a search engine to be simply told "go use a search engine" especially if they are not sure the answer will be helpful to them. It is far better to give them enough detail so they at least understand a little bit of the concepts to know if the answer actually applies to their situation, even if it then requires them to do some additional searches.
    – YLearn
    Commented Aug 6, 2015 at 18:49
  • I'm not explaining to them how to do InterVLAN routing -.- that's basic Network Engineering 101.
    – Chris Zog
    Commented Aug 6, 2015 at 20:49
  • You need not explain how to do InterVLAN routing. However, you should explain why interVLAN routing is the best and easiest way to make 2 VLANs talk, or the problem InterVLAN solves here or why it is helpful for the OP's scenario. Only saying that INterVLAN routing is the easiest, will at best look like an opinion from you if it is not backed by any logic behind it. Commented Apr 19, 2016 at 0:53

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.