SwOS/Router-On-A-Stick

From MikroTik Wiki
< SwOS
Revision as of 04:30, 6 November 2010 by Sdischer (talk | contribs)
Jump to: navigation, search

Router-On-A-Stick - 802.1Q Trunking With MikroTik

!!!D R A F T!!!


Router-On-A-Stick is a phrase referring to the connection of a 802.1Q capable switch to a single router interface. By trunking across the Ethernet interface and assigning separate Vlans to each of the switch's ports or groups of ports, it is possible to create a configuration that simulates a router with many separate physical Ethernet interfaces. Consider the following example:

RouterOnAStick.png

In this example, a router with a single Ethernet interface is trunked to a MikroTik switch. In practice, this same configuration can be used between two switches or two routers. The purpose of this article is to show the steps required to setup the MikroTik RB250GS switch as a trunked switch in the router-on-a-stick configuration.

To log into the RB250GS switch, simply web browse to 192.168.88.1 from a device on the same subnet. The default user name is admin with no password.

All settings may be left at the defaults with the exception of a few. Click on the VLAN tab and make the following changes, assuming the trunk port will be Port1 (the port that is connected to the router). In this example we are using Vlan Id's 1, 200, 300 and 400. Note that the switch will respond to http requests to its IP address on all ports. The way the OS is built, there is no need for a default gateway or a subnet mask. Selection of the Vlan ID and the assignment to the ports is your choice. In this example we need two devices on Vlan 300 on Ports 3 & 5 and one device on Vlan 400 on Port 4 and one device on Vlan 200 on port 2. When done, your VLAN page should look similar to this:

VLAN.png

The VLAN page strips the Vlan tags with specific Vlan ID's from the packets as they exit these ports. Setting Port 1 to Vlan Mode "enabled" and VLAN Header to "add if missing" makes Port 1 a trunk port.

Next, click on the VLANs tab. This is where you create the Vlan Id's to be used on the switch and on which ports these tags will be applied. So, for example, in this scenario, if I create a vlan interface on the router with a Vlan I of 200, that traffic will appear on the switch on ports 3 & 5 with port 1 being the trunk port.

Here is the example:

VLANs.png

The last step is to change the IP address, system identity and the password on the System tab and configure the router.

The router configuration is a standard one, create Vlan interfaces attached to the Ethernet interface that is connected to the switch and match the vlan ID's you assigned to the switch. Then bind your IP addresses to the Vlan interfaces and you will be set.