08-14-2023 07:43 AM
Hello guys, I need to create 5 Router with 1 Switch using VLAN and Access mode , everything should have connected and can be ping.
I've try to searching with no success this is the layout, an example of full config is appreciated,
Solved! Go to Solution.
08-14-2023 03:37 PM
Okay, that makes sense - and is (easily [well with a decade, or more, experience - wink]) doable.
Yes, you would create the VLANs on the switch. Can be done explicitly or implicitly as you define interfaces to use them.
On the switch, you define 4 VLANs, could be 2, 3, 4, 5. (VLAN 1 is there by default, but it has lots of considerations about how it should be used. Likely why you're told to use VLAN 2 or above.)
First you define 4 interfaces, on the switch (ports 2..5?), to be an access port in each of those VLANs. To each, you will connect a router. To make things a bit easier to understand, you might allocate a /24 network, for each of those VLANs, such that the 3rd octet matches the VLAN number. Each router interface would have a IP in the corresponding VLAN network, traditionally you use the first or last IP, my personal preference is to use the first IP. E.g. VLAN 2, network 192.168.2.0/24, router interface IP 192.168.2.1 255.255.255.0.
For the 1st router, you define its switch interface as a trunk. By default a trunk will pass all known VLANs.
On the router, you would define subinterface, much like what you posted. Each subinterface (4 in all) will need a IP in each of the VLAN networks. Assuming you used the .1, you might use .2 or .10 or whatever you wish, except .1.
The last piece, you need to configure is to make routers aware of any NOT connected network they wish to reach.
Doing just above, R1 should be able to ping R2..5, and the converse, but, for example, R2 doesn't know how to reach R5, or the converse.
Notice, R1 knows how to reach all the other routers. So, what we need to do, is configure R2..5 to send unknown network destination packets to R1. This would be most easily accomplished by having a default route on R2..5 pointing to R1, or having R1..5 all run a correctly configured routing protocol.
I intentionally, didn't provide full configuration snippets, as I would like you to understand the concept of what's being done, and that's often achieved by working the problem.
So, try some more, thinking about the above, and if still stuck, post what you're having an issue with.
08-14-2023 09:56 AM
The solution is one of the Router need to act as Router in Stick for this to work.
https://www.routerfreak.com/router-on-a-stick-introduction-configuration/
or switch should act as layer 3 mode.
Let me know what method you like to go to provide some assisted config.
08-14-2023 10:58 AM
At the moment, I cannot view OP's attachment, but router-on-a-stick would offen use a trunk switch port.
Any reason the 5 routers cannot be on same subnet? (Some requirement shown in attachment?)
08-14-2023 12:24 PM
Im not sure it can't be on the same subnet, but it looks like for another use case.
08-14-2023 12:56 PM - edited 08-14-2023 12:57 PM
@51lieal wrote:
Im not sure it can't be on the same subnet, but it looks like for another use case.
Depends on the purpose/usage of these 5 routers. If each is intended to be a gateway router, for various VLANs hosted on that switch, they would normally each be in a different VLAN like your attachment.
However, if they were a gateway for subnets on the "other side" (from the switch) of the router then they might all be on the same subnet.
Other variations are also possible. But what you're diagram shows, would be "unusual".
A router-on-a-stick is used when you have multiple routers on a switch (as your attachment has), but only one router. If I had to have each router have a foot in a specific VLAN, per router, AND, needed for the routers to directly inter-communicate, I might have 4 (or all 5) also have a foot in common VLAN. (For the latter, we could even use access ports that support a voice VLAN.)
If L3 was available on the switch, it would be unusual to have the switch or routers need to use other than p2p connections, although, there are variants that could. The latter, though, would be why?
08-14-2023 12:21 PM
i may want to go for one router act as router in stick
this is the chatgpt asnwer
Router1 (Central Router - VLAN 2 as Main VLAN):
enable
configure terminal
interface FastEthernet0/0
no ip address
shutdown
exit
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip address 192.168.2.1 255.255.255.0
exit
interface FastEthernet0/0.3
encapsulation dot1Q 3
ip address 192.168.3.1 255.255.255.0
exit
interface FastEthernet0/0.4
encapsulation dot1Q 4
ip address 192.168.4.1 255.255.255.0
exit
interface FastEthernet0/0.5
encapsulation dot1Q 5
ip address 192.168.5.1 255.255.255.0
exit
exit
Router2 (VLAN 3):
enable
configure terminal
interface FastEthernet0/0
no ip address
shutdown
exit
interface FastEthernet0/0.3
encapsulation dot1Q 3
ip address 192.168.3.2 255.255.255.0
exit
exit
Router3 (VLAN 4):
enable
configure terminal
interface FastEthernet0/0
no ip address
shutdown
exit
interface FastEthernet0/0.4
encapsulation dot1Q 4
ip address 192.168.4.2 255.255.255.0
exit
exit
Router4 (VLAN 5):
enable
configure terminal
interface FastEthernet0/0
no ip address
shutdown
exit
interface FastEthernet0/0.5
encapsulation dot1Q 5
ip address 192.168.5.2 255.255.255.0
exit
exit
Router5 (VLAN 2 - Main VLAN):
enable
configure terminal
interface FastEthernet0/0
no ip address
shutdown
exit
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip address 192.168.2.2 255.255.255.0
exit
exit
Switch:
enable
configure terminal
vlan 2
name Main_VLAN
exit
vlan 3
name VLAN_3
exit
vlan 4
name VLAN_4
exit
vlan 5
name VLAN_5
exit
interface range FastEthernet0/1 - 24
switchport mode access
exit
interface FastEthernet0/1
switchport access vlan 2
exit
interface FastEthernet0/2
switchport access vlan 3
exit
interface FastEthernet0/3
switchport access vlan 4
exit
interface FastEthernet0/4
switchport access vlan 5
exit
exit
it doesn't work, i also doing some troubleshoot by asking and checking again, still it wont work.
thank you very much for the response.
08-14-2023 12:41 PM
I'm at my PC, now, and can view your attachment.
Routers 2 through 5 all shown to be on different VLAN access (?) ports.
Unclear what's router 1's connection. VLAN 1, also on an access (?) port.
Basically, if all the routers connection to the switch are each in a different VLAN on an access port, the only way they can intercommunicate is for the switch to support routing. I recall some models of the 2960 series support very basic routing, don't know whether that PT simulation does.
As to the ChatGPT solution, yea, no surprise when you write "it doesn't work", considering the mistakes in the configs.
First, switch data access ports would not expect VLAN tagged frames, except if possibly those tagged as VLAN zero, for just L2 CoS purposes.
Second, for the "router-on-the-stick" switch port, it cannot be an access port, it needs to be a trunk port.
Third, I believe (?) shutting down the main interface, physically shuts down the interface. I.e. it just doesn't exclude untagged or zero VLAN tagged frames.
08-14-2023 12:47 PM
im following this guide https://www.routerfreak.com/router-on-a-stick-introduction-configuration/
except the trunk, now every router can ping, this chatgpt make me want to leave learn about networking, really wasting my 6h. Thanks you very much to both of you. I really appreciate it.
08-14-2023 12:54 PM
hmm sorry, it still can't ping other router, it's same as before, all router 1-4 can ping to 0, but 1 to 2 or 1 to 4 cant, is it possible to make it work ? or perhaps i need ask more clue to my senior? maybe the question is not correct.
08-14-2023 01:07 PM
Ah, looks like our replies overlapped when being written, and you didn't see mine, yet, about how router-on-a-stick is normally done, which wouldn't apply to what your attachment shows.
If you a) post what your device configs are, and b) clarify exactly what you're trying to accomplish, I, or others, could guide you to a working solution.
"b", in prior, is important, because again, what your attachment shows is "unusual".
Again, if all 5 routers only have an interface, in one subnet/VLAN, and each is different, no way, no how. To jump between subnets you need L3 with connections (somehow) that span the subnets/VLANs.
08-14-2023 01:22 PM
this was the up to date image with the ping log based on the guide on the link.
the original question is :
Please create a setup with 1 switch and 5 routers. One router should be the main router and have 4 VLANs with VLAN IDs 2 and higher. The rest of the routers should be in access mode. All routers should be connected to a Cisco switch. Each VLAN should have an IP address of 192.168.x.1/24, where x corresponds to the VLAN ID. After that, the other 4 routers should each use one VLAN ID, but as native/access. Set their IP addresses according to their VLANs. if ping works then its done.
and i just asked the VLAN is created in the switch?
her answer is : yes
This was actually my first time using Cisco PT and all of the config, so treat me as novice.
How's your thought ?
08-14-2023 03:37 PM
Okay, that makes sense - and is (easily [well with a decade, or more, experience - wink]) doable.
Yes, you would create the VLANs on the switch. Can be done explicitly or implicitly as you define interfaces to use them.
On the switch, you define 4 VLANs, could be 2, 3, 4, 5. (VLAN 1 is there by default, but it has lots of considerations about how it should be used. Likely why you're told to use VLAN 2 or above.)
First you define 4 interfaces, on the switch (ports 2..5?), to be an access port in each of those VLANs. To each, you will connect a router. To make things a bit easier to understand, you might allocate a /24 network, for each of those VLANs, such that the 3rd octet matches the VLAN number. Each router interface would have a IP in the corresponding VLAN network, traditionally you use the first or last IP, my personal preference is to use the first IP. E.g. VLAN 2, network 192.168.2.0/24, router interface IP 192.168.2.1 255.255.255.0.
For the 1st router, you define its switch interface as a trunk. By default a trunk will pass all known VLANs.
On the router, you would define subinterface, much like what you posted. Each subinterface (4 in all) will need a IP in each of the VLAN networks. Assuming you used the .1, you might use .2 or .10 or whatever you wish, except .1.
The last piece, you need to configure is to make routers aware of any NOT connected network they wish to reach.
Doing just above, R1 should be able to ping R2..5, and the converse, but, for example, R2 doesn't know how to reach R5, or the converse.
Notice, R1 knows how to reach all the other routers. So, what we need to do, is configure R2..5 to send unknown network destination packets to R1. This would be most easily accomplished by having a default route on R2..5 pointing to R1, or having R1..5 all run a correctly configured routing protocol.
I intentionally, didn't provide full configuration snippets, as I would like you to understand the concept of what's being done, and that's often achieved by working the problem.
So, try some more, thinking about the above, and if still stuck, post what you're having an issue with.
08-15-2023 09:15 AM
You should post the config to help here what conigured on the switch and routers to help
it should be straight forward config in sigle network of your setup.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide