Manual:Metarouter

From MikroTik Wiki
Jump to navigation Jump to search

Overview

MetaRouter is a new feature in RouterOS 4.0 beta 1.

MetaRouter is used for the RB400 series boards to create virtual routers.

Requirements

Each Metarouter instance uses just as much resources as a stand-alone RouterOS installation. This means you need a minimum of 16Mb of RAM for each machine, plus some for the main Router that hosts it. 16Mb is the absolute minimum - it is suggested to have more memory available per each Metarouter. There is no limit to how many Metarouter instances, only main machine system CPU and RAM. In the main machine, you can create up to 8 virtual interfaces that will be connected to the metarouters. Currently the only way to add more, is to use VLAN. Currently it is not possible to use external storage devices (Store) in the metarouter virtual devices.

Uses

The MetaRouter function is useful for allowing clients or lower-privilege users access to their own 'router' and config to configure as they like, without the need for a complete second router, or giving them access to the main router configuration.

For example; a WISP can create a virtual router for the clients ethernet port allowing them to define their own firewall settings, while leaving the WISP's wireless settings untouched.

Commands

The /metarouter menu gives the following:

  • add - allows you to create a new virtual router
  • print - lets you list any virtual routers
  • enable - to enable a virtual router
  • disable - to disable a virtual router
  • console - lets you access the console of a virtual router
  • interface - lets you make network interface mappings

Creating a Metarouter

 [admin@RB_Meta] /metarouter> add name=mr0 memory-size=32 disk-size=32000  disabled=no
 [admin@RB_Meta] /metarouter> print
 Flags: X - disabled 
 #   NAME                 MEMORY-SIZE DISK-SIZE     USED-DISK     STATE        
 0   mr0                  16MiB       0kiB          377kiB        running      
  • name: the name of the virtual router
  • memory-size: amount of RAM allocated to the virtual router
  • disk-size: amount of HDD in kiB allocated to the virtual router (if 0, size is dynamic) *
  • used-disk: currently used disk space
  • state: identifies if the metarouter is running or disabled

Note: * be careful when using dynamic HDD size for metarouters, a proxy could fill up all your hosts storage!

Example with no settings

If you will add a new metarouter without specifying any parameters, it will be added with Dynamic HDD size, and 16MiB of RAM:

[admin@RB_Meta] /metarouter> add name=mr1
[admin@RB_Meta] /metarouter> print
Flags: X - disabled
 #   NAME                 MEMORY-SIZE DISK-SIZE     USED-DISK     STATE
 1   mr1                  16MiB       0kiB          3kiB          running

Interfaces

The interface command has the following options:

 [admin@MikroTik] /metarouter> interface add 
 comment    disabled        dynamic-mac-address  type            virtual-machine
 copy-from  dynamic-bridge  static-interface     vm-mac-address

To add an interface, and reboot the virtual router

 [admin@MikroTik] /metarouter> interface add  virtual-machine=mr0
 [admin@MikroTik] /metarouter> reboot 0

Once connected to its console using /metarouter console 0 you can see the new interface:

 [admin@mr0] > interface print 
 Flags: D - dynamic, X - disabled, R - running, S - slave 
 #     NAME                                              TYPE             MTU  
 0  R  ether1                                            ether            1500 

On the host physical router the interface appears as a virtual interface:

 [admin@MikroTik] > /interface print 
 Flags: D - dynamic, X - disabled, R - running, S - slave 
 #     NAME                                              TYPE             MTU  
 8  R  ether9                                            ether            1500 
 9  R  test                                              bridge           1500 
10 DR  vif1                                              vif              1500 

Creating a bridge between the virtual interface and a physical interface allows traffic to pass.