In this stage we prepare the new Mikrotik RB5009 router as the new internet gateway ready for a phased cutover from the existing Draytek Vigor 2862 which will be retained as an internal router until all its connected networks and devices have been migrated.

Current State

We're starting with a brand new Mikrotik RB5009 router, almost fresh out of the box. I did have a few evenings just playing with it and seeing what it can do but then did a full reset ready to start again.

Desired State

The router configured ready to be connected to the internet.

  • ether1 as WAN configured as an IPv4 DHCP client
  • ether2 as a management port without any VLAN or IP so it can be connected to the House subnet without being a router ready for WInBox to connect via MAC
  • ether6 configured with a small transit subnet and DHCP server to the Draytek so it can connect for outbound internet using NAT for the rest of the network
  • ether8 configured as a dedicated management port with DHCP so if all else fails I can plug in a laptop and rescue it using the Webfig tool

Preparation

A little bit of preparation is needed before starting configuration. The Mikrotik WinBox application was downloaded from their website and installed on my PC. As I'm using Mint 22 this was just a case extracting the zip file to a sensible folder and then running the WinBox executable. I also needed to configure a port on my lab VLAN switch as a simple untagged port for the main house network and clear a little bit of space for the router to perch while I worked on it.

Note: When you turn the router on it will be acting as a DHCP server, so you may want to do the initial configuration with your PC connected directly to it otherwise you might cause some disruption to any other device that attempt to get an address while you're working on it.

Initial Connection

Mikrotik uses a broadcast protocol to announce devices onto a network to allow WinBox (or its equivalents) to detect it.

 

Mikrotik use 192.168.88.1 as their built-in default IP address but you can change this. During my initial tour I had upgraded from the factory supplied version to a slightly newer long-term release. The router is connected to my house network on ethernet port 2, which has a default name of ether2.

Unless you really use, or have configured your PC to use, the 192.168.88.0/24 network click onto the MAC address so it shows on the Connect To entry on WinBox, supply the correct credentials (admin and a random password on a sticker on the bottom of the router) and click the Connect button.

Caution: If you connect this to a "live" network you will be introducing a new DHCP server for the 192.168.88.0/24 network which may confuse other hosts if they connect and request a new address. It's safer to do the initial config with a directly connected device until you've completed Create a dedicated console port as that removes the DHCP server from the all ports apart from ether8.

Loading the Default Configuration

 Once you have entered the login details you will be prompted to accept or reject the default configuration.

Unless you're an expert (in which case why are you reading this?) click the OK button to accept their default configuration. You an also copy the config script for safe keeping or further study.

As it states in the description, the script creates a reasonably sane default with the 2.5 GbE port configured as a DHCP client for connection to your upstream device, typically the Optical Network Terminal (ONT) installed by your ISP. The firewall is configure to NAT outbound traffic thought it and deny any inbound traffic and set all the other ports and LAN ports on the 192.168.88.0/24 network with the router providing a gateway, DHCP Server and DNS service on 192.168.88.1.

I'm going to make some significant changes to the LAN configuration to recreate most of the config that's currently in use on the existing Draytek router of course.

You will then be prompted to change the admin password to something else, which should be suitably long and complex to protect the router from interference, and of course something you've not used before.

You can have WinBox remember this for you, but you should still make a secure note of it elsewhere.

Create a dedicated console port

One of the fun things about configuring network devices over their network connection is it can be quite easy to accidentally lock yourself out. Some of the Mikrotik devices have a separate dedicated console port which you can connect a laptop to should something silly happen, but there isn't one on the RB5009 series. It has 9 ports for you to configure as you please, so can make one into a console port and that's the first thing I'm going to do. There is also an optional "safe mode" in WinBox that will revert recent configuration if it loses connection too.

I'm going to use ether8 as my console port and as far as the rest of GeekLab network is concerned that port will cease to exist.

The first step is to remove ether8 from the bridge configuration. Go to Bridge > Ports, click on ether8 then click Remove.

Remove ether8 from default bridge

The default firewall rules block all input that doesn't come from interfaces on the LAN list, which in the default configuration only includes the bridge interface. We need to either add ether8 to the LAN interface list or configure an explicit input accept rule for it. I'm going to take the latter approach as it makes it a bit more explicit.

Go to IP > Firewall > Filter Rules and click New to create a new firewall rule.

Firewall rule to permit any input on ether8

Use settings for the General and Action tabs respectively.

Firewall rule to allow management port
Tab Parameter Value
General Comment Permit management port
Chain Input
In. Interface ether8
Action Action Accept

 Click OK to apply the rule, which will be added to the end of the rules list where it won't do much good. Drag it up to between rules 4 and 5 so it become the new rule 5.

This should be sufficient to allow something running WinBox to connect using the MAC address, but I want to enable the Webfig browser-based GUI too and for that we need to assign an IP address to the port and also create a DHCP service so my laptop will get an IP address when it connects.

The first step is to define an IP address for the ether8 interface. I'm going to reuse the default address assigned to the bridge interface.

Go to IP > Addresses and click on the entry for 192.168.88.1/24

Change the interface for the default address

Reassign the interface for the IP addresses created by the default config.

Reassign default address to management port
Parameter Old Value New Value
Comment defconf Console
Interface bridge ether8

The next step is to configure a DHCP server for our console port. This is not strictly necessary but it's a useful convenience if you ever need to use it and saves messing around with assigning an IP on whichever device you're going to connect. I'm going to repurpose the DHCP server created by the default config for the bridge and use that for the console.

Go to IP > DHCP Server  > DHCP and double-click on the defconf server

Update interface for the default DHCP server

Update the configuration to assign it to ether8 and increase the lease time to one hour

Reassign default DHCP server to management port
Tab Parameter Old Value New Value
General Name defconf Console
Interface bridge ether8
Lease Time 00:30:00 01:00:00
Bootp support dynamic none

 It will complain about interface not running unless you have a device plugged into ether8, so don't worry about that.

Just to keep things tidy, rename default-dhcp address pool to console-dhcp (it will update the DHCP config for you) and reduce the size of the pool.

Rename default pool and reduce the size

Tidy up the Console DHCP Pool
Parameter Old Value New Value
Name default-dhcp console-dhcp
Address 192.168.88.10-192.168.88.254 192.168.88.8/29

 We should now have a dedicated console port to provide a backstop in case something irritating happens during the rest of the configuration.

Test the Console Port

Before we go any further connect a laptop to the ether8 interface and make sure it can connect the router using WinBox or Webfig. I'm using an old Samsung NC10 that cannot run WinBox as it's a 64-bit application, but it's quite happy using Chromium to access Webfig on 192.168.88.1

Configure the WAN interface

The RB5009 doesn't have a dedicated WAN interface either, you can pick any interface you like for this. The default configuration assumes you'll use ether1 and for most configurations that's a reasonable assumption make and since the default configuration works perfectly for me I'm not going to mess with it.

If you have a server with a high-speed port then you might consider using ether1 for that I suppose, or the SFP+ cage, and use one of the others for internet access. As it happens, all the ethernet devices on my network are gigabit only, with the exception of the ONT which will run at 2.5 GbE but since I don't have that level of service (at least not for the moment) there's nothing to be gained by running at that speed.

I made two small changes for housekeeping purposes though. The first was to disable the SFP+ cage since I'm not going to use it. This needs to be done in both the Bridge and in Interfaces and of course it's reversible if you ever need to use it of course.

Just like we did to free up ether8 to be a console port, go to Bridge > Ports and click on the line for sfp-sfpplu1 and click Remove. This will remove it from the bridge configuration.

Then go to Interfaces > Interface and again click on the line for sfp-sfpplus1 and click Disable.

SFP+ port disabled

To finish off I put a small square of insulation tape over the hole just to keep dust out.

The second change was to disable 2.5 GbE on the ether1 interface. I really don't see the point at running an interface at 2.5 Gb/s when it's connecting to an internet service running at less than a tenth of that. Dropping to 1 Gb/s means the electronics are not being driven as hard, drawing less power and generating less heat as a result and being less sensitive to interference.

Just out of interest I put both the the router and the ONT onto a power meter, including the supplied PSUs as a total system power measurement and with the router enabled for 2.5 GbE and not really doing very much the combined power draw was around 19.9 W. Disabling 2.5 GbE on the ether1 port and the power draw dropped to around 17.5 W for the two. The power draw varied by +/- 0.1 W over several minutes, curiously this seemed to be the ONT as separate measurement of the Mikrotik was steady.

Go to Interfaces > Interface and double-click on the line for ether1.

Disable 2.5 GbE on interface ether1

Select the Ethernet tab and then remove the Advertise entry for 2.5G baseT and click Apply.

Create a temporary Draytek port

While I'm migrating from the old Draytek Vigor router I'm going to connect it to the Mikrotik on ether6 and use a small dedicated transit subnet for it. This will allow the Vigor to connect to the Mikrotik as if it was the real ISP connection without needing any changes so that if something interesting happens I can very quickly revert back to the current arrangement by simply unplugging the Mikrotik from the ONT and plugging the Vigor back in.

During my initial play I set up a VLAN for this, but that was unnecessary. I don't intend to do any routing - other then internet access - to the Vigor on it's WAN interface and certainly don't need to allow this connection to appear outside of the Mikrotik router.

The first task is to take ether6 out of the bridge configuration, so like we did for the console port go to Bridge > Ports and click on the entry for ether6 to highlight it

Remove ether6 from the default bridge

Then click Remove to take it out of the bridge.

The first task is to assign an IP address and subnet to the interface. Go to IP > Addresses and click New to add the address.

Assign IP address and subnet to ether6

Define IP address for vigor transit network
Parameter Value
Comment Vigor transit
Address 192.168.69.1/29
Network 192.168.69.0
Interface ether6

 The next task is to define a DHCP server so we can assign an IP address to the WAN interface of the Draytek automatically so we don't have to adjust the Draytek config. We want to assign the same address each time so we can also forward selected ports to it as well. While we could use the wizard, I'm going to define it manually just to get some familiarity with the components.

The first step is to define the pool of addresses for our DHCP server. Go to IP > Pool >Pools and click New

Define a new DHCP address pool for vigor transit subnet

Define IP pool for the vigor transit network
Parameter Value
Name vigor-dhcp
Addresses 192.168.69.69.2-192.168.69.6

This will give us a pool of 5 addresses, of which we really only need 1, but having a couple of spares won't hurt. A /29 gives us 8 IPs, .0 though to .7, the .0 is the network address and cannot be used, .1 is assigned to the router itself, .2 through to .6 are the available addresses and .7 is the broadcast address.

The next step is to define the DHCP server itself. Go to IP > DHCP Server and click New to define the server.

Define the DHCP server for the vigor transit network

DHCP Server configuration for Draytek interface
Tab Parameter Value
General Name vigor
Interface ether6
Address Pool vigor-dhcp
Bootp Support none

 This uses the vigor-dhcp pool defined in the previous step. You can also see the DHCP server for the Console port in the background, flagged as not running since I'd disconnected my laptop from ether8.

Finally we need to make an address reservation so the Draytek gets the same address each time. Go to IP > DHCP Server > Leases and click New.

Reserve a specific DHCP address

Address reservation for the Draytek rotuter
Tab Parameter Value
General Comment Draytek router
Address 192.168.69.2
MAC Address 00:1D:AA:xx:xx:xx
Bootp Support none

This uses the MAC address of the Draytek's WAN2 interface which you can find on the Dashboard in the IPv4 Internet Access section.

The final task is to enable NAT forwarding to the Draytek for all the IP ports it also had configured for forwarding. Go to IP > Firewall : NAT and click New 

 Create a NAT forwarding rule

Creating NAT forwarding rule
Tab Parameter Value
General Comment [Useful description e.g. mail, web, sync]
  Chain dstnat
  Protocol [tcp or udp]
  Dst. Port [Port]
  In. Interface List WAN
Action Action dst-nat
  To Address [IP assigned in reservation above, e.g. 192.168.69.2]
  To Ports [Same as Dst. Port if you want to be explicit, or blank]

You will need to repeat for every rule you have in the Drayteks NAT > Port Redirection and NAT > Open Ports pages, and if you're using the Draytek VPN you'll also need to forward the ports for that too.

While you don't technically have to have the same port number on both the WAN (Dst Port) and target (To Ports) we want to make the Mikrotik router transparent as far as inbound access is concerned so we really do want to keep them the same.

Draytek can support upto 10 port ranges and combine TCP and UDP into a single rule. Mikrotik can only cope with a single protocol in each rule but ports is just described a list so I'm not entirely sure but there are suggestions it may be upto 20 ports or ranges of ports in each rule.

I also have a VoIP phone (see Internet enabling a Gigaset GO Box 100 DECT hub) which uses the Session Initiation Protocol. The base station maintains a connection to A&A's telephony servers so I don't need to configure specific firewall rules, but all outbound IPv4 traffic is also NATted (or masqueraded in Linux-speak) and SIP and NAT have a history of not playing nicely together. The usual first fix is to see if your router has a "NAT helper" for SIP and turn it off. The Mikrotik offers additional support for ten different services, including SIP and we need to turn this off to allow the phone to work though both routers in series.

Go to IP > Firewall > Service Ports and click on the entry for sip and click Disable

Disable the SIP helper to prevent NAT problems with a Gigaset GO box

The X (disabled) and I (invalid) flags will then appear and the whole line will be grayed out.

Summary

In this first stage we've prepared our new Mikrotik RB5009 router to to become our new internet gateway ready for a gradual migration of our internal network in accordance with the strategy decided in Approach for Router Replacement. We have:

  • Created a dedicated management port just in case something goes wrong later on and we lose access over the internal network.
  • Prepared a transit subnet to allow the existing router to connect without impacting the existing GeekLab networks until they can be moved over.
  • Created a list of NAT rules to mirror those already defined on the Draytek so it still receives inbound connections from the internet
  • Disabled the NAT helper for SIP so our VoIP phones will still work.

As a final step, go to Files > Backup and create a dump of the router config, with encryption if you prefer, and download it and put somewhere safe just in case you want to revert back to this later. Using the backup option saves everything but this will only be restorable to the same router, or at least an identical model. You can also dump the config to a script using a terminal command if you prefer.

The next stage is to deploy the router into the GeekLab and test outbound and inbound access.