In this stage we move the Guest WiFi users so they also connect via the Mikrotik router. As guests also get access to the public and some additional internal resources this needs an adjustment to the firewall rules too. Ideally I'd like to make this a gentle changeover without any interruption or impact on users.
That didn't go quite as expected...
Current State
The Mikrotik router has been active and stable with 28 days uptime and no complaints caused by the configuration or dual running. The backbone Hall VLAN has been extended to the Mikrotik and the internal routers given a static route to use it as the preferred default gateway. Network performance is way better than ever achieved with the old Draytek Vigor 2862.
The Vigor is still providing internet access for Guest and Public VLANs and a VPN service.
Desired State
Move the Guest WiFi VLAN over to the Mikrotik router with the firewall configured to allow outbound internet access and limited access to internal resources. Public VLANs to remain connected just to the old Draytek router.
Guests should be able to access the same publicly visible resources as internet users so we need to allow them to reach the proxy server. They should also be able to reach a network printer. There may be other resources added in future.
Extend Guest VLAN to the Mikrotik
This is a very similar configuration to how my Work VLAN was configured in Move and isolate a dedicated work VLAN with the definition of a VLAN at bridge and interface levels with the same ID and IP subnet details as the existing guest network and the configuration of a DHCP service.
At the moment all VLANs are routed through a Core VLAN switch. This is going to create an issue for testing as currently the Guest VLAN is on Core ports 2, 3 and 4 and I really want to connect ports 2 and 3 together for the existing Guest VLAN and then connect ports 4 and 5 for the new Guest VLAN extension before connecting all 4 together at the end. This is not possible on this switch, so I'll have to swap some cables around and temporarily modify the config for testing purposes, but we'll look at that in the testing section.
Define a Bridge VLAN for Guests
The Guest VLAN will use the trunk VLAN on ether5 that we defined in Extend Hall VLAN to Mikrotik Router for Outbound Access as a tagged port with the same ID.
Go to Bridge > VLANs and click on New to add the new VLAN.
| Parameter | Value |
| Comment | Guest |
| VLAN IDs | 150 |
| Tagged |
|
This will be the only connection out of the Mikrotik for the Guest VLAN for now. I may extend directly to the WiFi bridge later rather than using Core to forwared the subnets to the the SSIDs.
Define an Interface VLAN for Guest
We want to use the Guest VLAN for IP routing to the internet and selected internal hosts, DHCP and DNS so we need to define it as an interface VLAN too.
Go to Interfaces > VLAN and click New
| Tab | Parameter | Value |
| General | Name | V150-Guest |
| VLAN ID | 150 | |
| Interface | bridge |
Add to BasicServices Interface List
We don't want anything talking to the new guest connection just yet, so add to the list before we configure anything more. Go to Interfaces > Interface List and click New
| Parameter | Value |
| List | BasicServices |
| Interface | V150-Guest |
Define an IP Address
We also need to assign an IP address and subnet for the Guest VLAN. Since we will be connecting the Guest VLAN on the Mikrotik and Draytek together I need to make sure there's no overlapping IP addresses otherwise there will be issues. Unlike the Work VLAN I'm going to keep this as a full /24 (or Class C in old-speak) as it's possible we'll have a lot of users on occasion.
The Draytek isn't announcing the Guest subnet via RIP from its side and I won't be doing the same on the Mikrotik either so in that respect we're not going to have routing issues. Although outbound traffic from the Draytek is routed via the Mikrotik, it's been passed though a NAT so the Mikrotik won't know it originated from a Guest device. Until two segments of the VLAN are joined at the switch we shouldn't have any interference.
Just to be sure I double-checked the Core VLAN switch to make sure it wasn't forwarding VLAN 150 to the Mikrotik just yet.
Go to IP > Addresses and click New
| Parameter | Value |
| Comment | Guest |
| Address | 192.168.nnn.1/24 |
| Interface | V150-Guest |
Define DHCP Server
I will reserve the first first 16 address for future use and of course the last address is used for subnet broadcast. The rest are given over to the DHCP pool. For the initial configuration I skipped the first 128 address to avoid any collision with the address pool on the Draytek. I will amend pool after cutover is complete.
Go to IP > Pool > Pools and click New
| Parameter | Value |
| Name | guest-dhcp |
| Addresses | 192.168.nnn.16-192.168.nnn.254 |
The next step is to define the DHCP server itself. Go to IP > DHCP Server and click New to define the server.
| Tab | Parameter | Value |
| General | Name | guest |
| Interface | V150-Guest | |
| Lease Time | 4:00:00 | |
| Address Pool | guest-dhcp |
This uses the guest-dhcp pool defined in the previous step. The default lease time is 30 minutes so I've increased this to 4 hours since guests are likely to stay for a while.
The last step is to define the network configuration that will be passed to client systems. Go to IP > DHCP Server > Networks and click New.
| Parameter | Value |
| Comment | Guest |
| Address | 192.168.nnn.0/24 |
| Gateway | 192.168.nnn.2 |
| No DNS | Unticked |
| DNS Servers | 192.168.nnn.2 |
| No NTP | Unticked |
| NTP Servers | 192.168.nnn.2 |
For now I'm not worried about address reservations since nothing internal is going to connect to Guest devices. Rules to allow access to other services will be based on the entire Guest subnet and not individual machines.
Firewall Rules
Guests will get full outbound internet access but unlike my Work VLAN they will also be allowed access to selected internal resources too, so the firewall rules will be a little more complicated. I have two options here:
- Add specific accept rules for traffic coming from the Guest subnet destined for internal services above the block rule we created previously for the BasicServices interfaces
- Create a specific chain for all traffic coming from BasicService and accept what should be allowed through and drop the rest
The advantage of having a specific chain is we can have a simple selection of "did you come from interface on the BasicServices list?" and then only check the detailed criteria against those that did. Any other IP packets skip the detailed checks and carry on with whatever is next in the forward chain. If you've got more than two rules you're probably going to be more efficient with this approach, so I'm going with option 2.
Unlike the Draytek firewall, in Mikrotik RouterOS when a packet reaches the end of a chain it will be passed back the the next rule after the one that moved it to the chain. If you want a default accept or drop you need to add that to the end of the chain.
All rules are created under IP > Firewall >
Create a basicservices chain
We need to add a rule above the "Block internal routing for basic VLANs" we created previously to jump to a new basicservices chain.
| Tab | Parameter | Value |
| General | Comment | For basicservices-int |
| Chain | forward | |
| In. Interface List | BasicServices | |
| Action | Action | jump |
| Jump Target | basicservices-int |
We use a Jump rule for this. The rule is added to the forward chain and selects all remaining packets coming from any interfaces on BasicServices list, which given we've previously dealt with all packets destined for the WAN interfaces these must be destined for something internal.
Our previous "Block internal routing for basic VLANs" rule now needs to be modified so it's applied on the basicservices-int chain as the last rule. We can also remove the selection criterial as any packets in this chain will already have been selected on the basis of the In. Interface List setting on the jump rule itself. Instead of a simple drop I'm also going to make it a reject rule so any applications that send packets to an internal interface that gets blocked by this rule will be immediately informed the packet was not permitted rather than waiting for whatever timeout it uses for IP communications to expire. For internal usage this is much better, not only does it speed up applications it also helps with debugging.
| Tab | Parameter | Old Value | New Value |
| General | Chain | forward | basicservices |
| In. Interface List | BasicServices | [Remove] | |
| Action | Action | jump | reject |
| Reject With | N/A | icmp admin prohibited |
Allow guest access to the reverse proxy
I allow external internet-based access to some applications in the GeekLab via a reverse proxy, so I also need to allow users on the Guest VLAN the same access. This is achieved by adding a new rule to the basicservices-int chain to permit access to the appropriate ports on the proxy, and of course ensuring that the Mikrotik DNS also resolves the same hostnames to the proxy as well - I completed this in Configure internal DNS.
| Tab | Parameter | Value |
| General | Comment | Allow Revproxy |
| Chain | basicservices-int | |
| Dst Address | 192.168.xxx.yyy | |
| Protocol | tcp | |
| Dst. Port | 443 | |
| Action | Action | accept |
Allow guest access to the network printer
We've also had visitors who've wanted to print out work so it makes sense to also allow access to the printer since it's connected to the network and guest needs a login for our guest WiFi network so it's secure enough. There's certainly no internet access to it. We can enable this with a further rule in the basicservices-int chain
| Tab | Parameter | Value |
| General | Comment | Allow printer |
| Chain | basicservices-int | |
| Dst Address | 192.168.xxx.yyy | |
| Protocol | tcp | |
| Dst. Port | 641 | |
| Action | Action | accept |
The printer hostname is already resolvable via the DNS forwarding configuration and with the firewall rule in place the Mikrotik can handle the routing too.
VLAN Connection and Test
The first problem was getting a connection to the new segment of Guest VLAN without going through my existing Core VLAN switch since that's already carrying the Guest VLAN. The answer was a temporary reconfiguration of the network using the VLAN switch in my office. This has the House and Guest VLANs configured so it was just a case of moving the patch cable from the Core VLAN switch to the unused ether4 port on the Mikrotik and configuring that also forward tagged frames to to the House and Guest VLANs. Plugging my old Samsung NC10 into the appropriate port on my Office switch connected it directly into the new Guest VLAN ready for testing, and using the House VLAN I could still access everything from my desktop machine. Easy.
Internet access worked perfectly, which was a good first sign. Attempts to access other non-permitted resources failed which was also good. The first attempt to access the Proxy (actually a test proxy that I've not documeted above) failed at first as it was using the Draytek as its default gateway - I'd forgotten to update it when I connected the Mikrotik to the Hall VLAN. This meant replies back to the new Guest network were going to the old one and of course not finding my test host there.
With that fixed it was then time to link the Guest VLAN segments between the old Draytek and the new Mikrotik routers with the intention of doing a gradual cutover. And this is when things went a little bit wonky.
The plan was to enable DHCP on the Mikrotik with the Draytek set as the default gateway. No problem, that just worked. Then I planned to stop DHCP on the Draytek at which point I rediscovered that unlike the Mikrotik router, the Draytek needs a reboot for any changes to it's LAN configuration, including the DHCP parameters. Annoying but neither the guest nor public networks were busy so it wasn't a major issue.
The idea was that with DHCP now being run by the Mikrotik, I could then make the Mikrotik the default gateway for the Guest VLAN and guest users would slowly swap over to it as they renewed leases and it would all just quietly work.
The real problem was that Linux really doesn't like triangular routing, and my NC10 is running Debian (Pi-OS if you must know since it needs a 32-bit OS). Triangular routing happens when you send a packet out towards one interface and it comes back from another. For example, the Guest device sends to its default gateway on the Draytek router (shown as .1), which dutifully routes it to the target, in this case the test proxy. The test proxy then replies, with its default route set to the Mikrotik (shown as .2 on the Hall subnet) which forwards the reply back onto the guest subnet through its own gateway (.2). Linux rejects the reply as it's not from from .1 as was expecting. While this can be disabled, that's not something I can enforce on guest users. I don't believe Windows is this fussy and it's not something I've even looked at with Android - a quick search on the topic was inconclusive so it may be something to rig up as a proper test in future. But I digress.
The practical upshot is moving the Guest VLAN is now an explicit cutover and I need to look at the network configuration on the proxies as they're using DHCP and this is not ideal for what have become stable permanent fixture. That's outside the scope of this, but needless to say it was a quite a few unplanned hours but at least I had no external users connecting to anything so nobody was affected.
Cutover
With the reverse proxies reconfigured to use static IPs I was then ready for cutover. Since external users reach the reverse proxy via a different interface on a public subnet this meant I could take a short outage just for internal users and reconfigure everything in one go:
- The DHCP service on the Mikrotik was reconfigured to use the Mikrotik as the default gateway by changing the Gateway parameter under IP > DHCP Server > Networks
- The live proxy was reconfigured to also use the Mikrotik as the default gateway
- The Guest VLAN was disconnected from Draytek on the Core VLAN switch
- Validate internal guest users can still reach the Nextcloud server
- Validate external users can still reach the Nextcloud server
Summary
So this didn't go as smoothly as I expected, and annoyingly this isn't the first time I've run into the triangulation issues, but in my defence it was a very long time ago. Even if this was a large organisation rather than a few home users I don't see any reasonable way around this so an outage was probably unavoidable.
For public users I've always planned on there being an outage so this doesn't really change anything apart from refreshing my memory.
Notes
This was article was written with reference to a Mikrotik RB5009 running RouterOS 7.21.5 using WinBox 4.3 and a Draytek Vigor 2862. I expect this to be broadly similar for equivalent products and later versions but that cannot be guaranteed.