Mikrotik has recently added MPLS to their already amazing RouterOS product.Â MPLS offers some really nice options for bridging networks that exist within a single administrative domain.Â But, what can you do if you need to bridge 2 networks that do NOT exist within the same administrative domain?Â This article discusses how to create a bridge using another fairly recent upgrade in RouterOS.Â Read on…
Consider the following network:
What this article will attempt to explain is the process needed to bridge LAN1 and LAN2.Â We will accomplish this task by building a tunnel (PPtP in this example) over the internet and then creating a bridge on each router (Router1 and Router2) that includes the tunnel endpoints as well as an ethernet port on each end.Â There are numerous ways to accomplish this task (I have another example in this blog post), however this method is among the easiest AND offers a couple of real advantages over the method mentioned in the earler blog post.Â The primary advantage to this method is that it gives us the ability to carry packets that are MUCH larger than what is available using EoIP.Â EoIP is limited to an MTU of 1500 bytes.Â With the PPtP bridge, we can have an MTU of over 65000!
First, we just need to configure the 2 routers for basic internet service.Â I won’t detail that configuration here, but you should be able to log into either router and ping the other public IP (220.127.116.11 and 18.104.22.168 in this example).Â The next step is to configure the tunnel itself.Â On the server side, we need to configure the pptp service.Â This is done with the following command (on router1 only):
/interface pptp-server server
set default-profile=default-encryption enabled=yes mrru=65535
Note that I set the mrru value.Â Because of the way this works, all clients will need to have this MRRU set the same.Â Another thing to note is that 10/100M ethernet only has an MTU of 1500 bytes, so setting this value to 65535 does nothing for 10/100 networks. Â Also note that the default MTU for the tunnel can be set to whatever the actual transport will carry.Â What this MRRU value does is configure the ppp protocol to transport packets of any size (up to the mrru value) even if the underlying transport (where the tunnel will traverse) uses a smaller MTU.Â Of course, it will be fragmenting and reassembling the packets on both ends.
Our next task is to create the bridge.Â Since we want to bridge ether2 with the tunnel, we will be adding ether2 into the bridge in this step.Â THIS WILL NEED TO BE DONE ON BOTH ROUTERS. Do this as follows:
/interface bridge add name=lanbridge
/interface bridge port
add bridge=lanbridge interface=ether2
NOTE: In order to be proper about how we configure the network, you should also move the IP addresses that are assigned to ether2 over to the bridge.Â If you have firewall rules that manage traffic on ether2, you need to configure the bridge to use the IP firewall (/interface bridge settings set use-ip-firewall=yes) and change those rules to look for the interface “lanbridge” OR “in-bridge-port=ether2″.Â Other configuration changes that MAY be necessary includes DHCP server interfaces and queues.Â You get the idea.
You probably noticed that we did not add anything referencing the tunnel when we added ports to the bridge. If you did NOT notice, go back and look, because we didn’t.Â Â The reason for this is due to the fact that we will be DYNAMICALLY adding interfaces to the bridge.Â On router1 (the server side) we configure the profile and secret as follows:
set default-encryption bridge=lanbridge change-tcp-mss=yes local-address=192.168.25.1 \
use-compression=yes use-encryption=yes use-vj-compression=no
add disabled=no name=router2 password=router2pass profile=default-encryption \
Some things to note about the above configuration.Â I chose to set the local IP in the profile and the remote IP in the secret.Â It is not important WHERE you set these values, however they must be set somewhere.Â That tutorial is the subject matter for another day.Â The bridge selection is important.Â With that setting enabled, the RouterOS will automatically (dynamically) add any new ppp (pptp, pppoe, ppp, l2tp, etc.) interface that uses the profile to the selected bridge.Â I configured a username/password (router2/router2pass) for the remote router and instructed the pptp server to use the profile called “default-encryption” (which includes the bridge configuration) for this user’s connection. With the above configuration set in router1, we are finished with that side.
All that’s left is the set up the router2 side.Â Remember, the bridge and ports were already done on that router, so all that remains is the tunnel and profile.Â That is done as follows:
set default-encryption bridge=bridge1 change-tcp-mss=yes use-compression=yes use-encryption=yes use-vj-compression=no
add connect-to=22.214.171.124 disabled=no mrru=65535 name=tunnel1 \
password=router2pass profile=default-encryption user=router2
Here we set the profile again to use the bridge1.Â NOTE that we do NOT set IP addresses in the profile on the client side.Â This is controlled at the server side.Â We set the client to connect to the server at it’s public IP of 126.96.36.199, configure the mrru to be the same as we set the server and name the tunnel (not needed, but I really dislike the default name of “pptp-out1″).
Once this configuration is complete, you will notice that the ports have been automatically added to the bridge (winbox: Bridge->Ports).Â You should be aware that if you run a DHCP server on either side, it will be visible by devices at BOTH sides.Â Configuring devices manually, or using static lease entries is recommended.Â If you want ALL traffic from LAN2 to use the LAN1 router as a default gateway (or the other way around), it is easy to set up.Â Also note, that this configuration will behave just like you have 2 switches bridged (connected with an ethernet cable).Â IP space MUST be managed accordingly.Â This configuration will pass DHCP, vlan tags, broadcast and any other type of packet.
Please “Digg” this article if you find it useful.Â Feel free to leave comments on other uses you find for this configuration.