Manual:MME wireless routing protocol
See also MME command reference
Note that MME is not a replacement for OSPF or RIP. It is meant to be used in mesh networks, and is best suited for wireless nodes with one logical interface. When used in traditional networks, the protocol overhead will be greater than even that of RIP.
Overview
MME (Mesh Made Easy) is a MikroTik routing protocol suited for IP level routing in wireless mesh networks. It is based on ideas from B.A.T.M.A.N. (Better Approach To Mobile Ad-hoc Networking) routing protocol. See https://www.open-mesh.net for more information about B.A.T.M.A.N.
MME works by periodically broadcasting so called originator messages. Routing information contained in a message consists of IP address of it's originator and optional list of IP prefixes - network announcements. If a node receives an originator message it hasn't seen before, it rebroadcasts that message. (There also are some other cases when the message can be rebroadcasted - see below.)
Unlike OLSR or other "traditional" proactive routing protocols, MME does not maintain network topology information. Consequently, MME is not able to calculate routing table, and does not need to. Instead, it keeps tracks of packets received and their sequence numbers - to tell how many packets were lost. This way, from message loss statistics for all combinations of originators and single-hop neighbors, MME is able to find the best gateway to a particular destination.
The main ideas behind MME are based on these observations made in mobile mesh networks:
- it can be impossible to know the exact topology of all network, because it is rapidly changing;
- if topology changes trigger routing table recalulation for all nodes in the network; and for embedded systems, the routing table calculation CPU overhead can be significant.
To avoid these problems, a MME node:
- cares only about the best single-hop neighbor in path to a particular destination;
- avoids routing table calculations.
Secondary functions of the MME protocol are: to carry information about gateways to the Internet, and to dynamically setup default routes. The part of MME responsible for that is dubbed "the gateway protocol".
MME protocol is using UDP port 1966 for originator message traffic. The gateway protocol is using TCP port 1968.
It is assumed in a normal operation of the protocol, a large number of these messages will get lost due to bad link quality. This assumption is important if we are talking about protocol overhead. Theoretically protocol's own traffic consumption is at least as big as for RIP, and obvioulsy worse than that of link state routing protocols (OSPF, OLSR) unless the topology is constantly changing.
Technical side
Basic principles of the main protocol
The main functions of the MME protocol are:
- automatic neighbor MME router (so called "originator") discovery (including multihop neighbors);
- originator message origination and flooding on each interface in every origination-interval seconds;
- originator message rebroadcasting based on a few simple rules;
- best gateway selection for each originator and the routes it has advertised.
Originator message rebroadcasting rules:
- do not rebroadcast self originated messages;
- do not rebroadcast messages that has unidirectional flag set;
- rebroadcast messages from single-hop neighbors; rebroadcast with unidirectional flag set if and only if:
- the neighbor relation is not bidirectional;
- OR the neighbor is not the best gateway to himself (i.e. there exists a better multihop path towards this node).
- rebroadcast messages that are not duplicate; a message is considered duplicate if message with this sequence number already was received before;
- rebroadcast duplicate messages if and only if:
- they came from a neighbor that is the gateway for the originator;
- the TTL in the packet is equal to last TTL for this neighbor and originator combination.
MME makes routing decisions based no more than last 64 messages received, but this number can be significantly less in case of packet loss. The node can tell that some packets were lost based on their sequence numbers. The more originator messages are received from a node, the better the statistics of that node is.
The MME protocol does not incorporate best route selection logic. If the same network information is configured in two different nodes, there currently is no way how to tell which one to prefer. Both routes will be installed in routing table and one of the selected in a random fashion. Obviously, such configuration is not recommended.
Basic principles of the gateway protocol
Second part of the MME is a default gateway selection protocol. Here two roles for a router are possible. A gateway server is node that is willing to serve as internet gateway for other routers. Usually it means it has an ethernet connection or some other way "out of the mesh".
A gateway client is a node that is willing to use this dynamic information to about gateways out of the mesh cloud. If there are multiple gateways reachable, client selects the best one based on packet statistics, advertised gateway class, and gateway-selection and preferred-gateway configuration values. After selecting the best gateway server the client makes a TCP connection to the server. This connection is used for periodic keep-alive message sending. After the connection is established, both the client and the server add dynamic IPIP tunnel interface. The client also adds default route through this interface.
If the server stops announcing it's gateway capability, or becomes unreachable, the TCP connection and all tunnel state is teared down on both sides. Client also removes the default route.
Note that it's not recommended to have a default route (i.e. prefix 0.0.0.0/0) in MME network announcement configuration.
Packet format
The one and only packet type used in MME is originator message. The message contains:
- originator IP;
- current ttl value;
- sequence number;
- gateway class;
- protocol version;
- host and network announcements (0..n IP prefixes).
Gateway protocol clients and servers also exchange keep-alive messages, but they contain no information and have undefined format. At the moment, however, a keep-alive message is considered invalid, it if contains fewer than 1 or more than 6 octets.
Configuration examples
Starting the protocol on a single interface:
[admin@I] > /routing mme interface add interface=wlan1
To change some attributes for routes learned via MME you can use the mme-in routing filter. Example:
[admin@MikroTik] > routing filter add chain=mme-in set-routing-mark=mark1
If you want to redistribute some routes via MME, add them to MME networks. Example:
[admin@MikroTik] /routing mme> network add network=1.2.3.0/24 [admin@MikroTik] /routing mme> network p Flags: X - disabled # NETWORK 0 1.2.3.0/24
Using the gateway protocol
Setup gateway server:
[admin@I] /routing mme> set gateway-class=11
Setup gateway client:
[admin@MikroTik] /routing mme> set gateway-selection=best-statistic
Observe the results (on client). Dynamic IPIP interface should be added automatically:
[admin@MikroTik] > /interface print Flags: X - disabled, D - dynamic, R - running # NAME TYPE MTU 0 R ether1 ether 1500 1 R ether2 ether 1500 2 DR ipip1 ipip 1480
Default route that goes through this tunnel should be added added automatically:
[admin@MikroTik] > /ip route print Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, B - blackhole, U - unreachable, P - prohibit # DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTERFACE 0 ADm 0.0.0.0/0 r ipip1 130 ipip1