FEATURE REQUEST: full cone NAT

I tested using this:
https://github.com/HMBSbige/NatTypeTester

The software bugs have been fixed (I spoke to the developer of this software directly).

MikroTik still fails the test. When I test on Juniper or Cisco, test passes just fine.

I think MikroTik is failing to test this correctly.

TCP/UDP BOTH work in Juniper and Cisco as per the RFCs for this technology.

Darknate you have investigated this functionality for some time to great lengths and depths and its STUNning to me that MT doesnt pay more attention to your writing on this subject!!
Its it just me or is they don’t write full requirements for their software… Mind you I dont know how you right half requirements, its seems a foreign concept. :wink:

Did you test on the same external network with each setup ? there could be a different external filtering on the public IP addresses you did use that could explain those differences. Do you own those public IPs ?

Regardless what i do i cannot get independant endpoint filtering. Even NAT 1:1 does not give it. This is why i think that my public IP could be filtered externally to forbid full cone nat.

I think that we need to test with a local stun server on a private natted subnetwork to be sure. Or manual testing from such a network. Did you do that with the Mikrotik setup ?

I own the whole god-damn Autonomous System and have operated commercial networks at scale. Trust me, dude, MikroTik’s EIM-NAT is broken.

Why/How? Not my job to decode their source code, ask MikroTik.

Like I said, no problems on Cisco and Juniper EIM-NAT implementation.

They don’t listen to me or anybody, see this:
http://forum.mikrotik.com/t/discussion-mikrotik-configuration-abstraction-complexity/173293/1

Ok, i’m going to try a new test with a local Stun server on a natted private subnetwork. If it’s broken this will make another serious report and they will probably fix it.

I will need some time nevertheless to setup a Stun server. If someone can do it faster than me it would be fine.

I need it because i do not own the public IP i’m using to access one of the public Stun server proposed in the NatTypeTester utility. This IP could be filtered externally, i get it through a MAP-E tunnel.

Ok i tried it.

Setup : two local sub-networks, on two different VLANs, routed through an RB5009, Ros 7.14RC1.

Source NAT between the two sub-networks using endpoint independent NAT actions in src-nat and dst-nat chains.
NAT Test rules.png
On the "WAN" network, i started a STUNMAN version 1.2.16 STUN server in full mode : two IP addresses and four listening ports. Here is the STUN server setup :

Starting server 1

strMode = full
strPrimaryInterface = 10.50.50.10
strAltInterface = 10.50.50.11

PP = 10.50.50.10:3478
PA = 10.50.50.10:3479
AP = 10.50.50.11:3478
AA = 10.50.50.11:3479
Protocol = UDP
Configuring single threaded mode

Successfully started server.Starting listener thread (4 recv sockets, 4 send sockets)

On the "LAN" side, i used NatType Tester version 8.02 in UDP mode.

Here is the result :


This shows that Netpoint independent mapping and filtering works correctly. We have full cone !!

I think that people here saying that it doesn't work made an error : they do not have a firewall rule to permit those connections for UDP traffic from WAN to LAN from foreign IP addresses.

If you do not have such a firewall rule in forward, then endpoint independent filtering will not work anymore, you will get this result :


As you can see, the filtering is now address and port dependent. Full cone is not possible anymore.

Conclusions :

  1. Endpoint independent mapping and filtering works correctly. The default firewall established traffic catch forward rule just needs to be modified or another rule added to permit endpoint independent traffic (foreign IPs) to travel in forward from WAN to LAN.

There is a new matcher that seems to be designed for this use in the "Connection NAT State" matchers :
We have now ein-snat and ein-dnat :
.
connection state.png
I tried it but it does not seem to have an effect. Are they designed to permit foreign IP addresses to enter through ports opened by Independent NAT mapping actions ?

  1. Mikrotik should add an explanation in the help (NAT - RouterOS - MikroTik Documentation), indicating that to get independent filtering working, a firewall rule in forward needs to be added to allow UDP traffic from WAN to LAN for all IP addresses that should be authorized to contact the opened ports.

  2. Years of experience in networking is not a serious indicator of a network technician, engineer or manufacturer efficiency or smartness. :laughing: :laughing: :laughing:

  3. Gamers can now enjoy full cone NAT with Mikrotik routers :smiley:

Chances are high, your testing methodology may be flawed, I don’t see network diagrams and full config.

As for firewall, firewall is null in my testing and many others in this thread, so firewall is ruled out from day one. In addition, firewall on Windows laptop was also disabled.

If you believe that MikroTik’s EIM-NAT backend implementation is complying with the RFC, to the same level as Cisco and Juniper — Then good luck and have fun, buddy.

My conclusion:
It doesn’t work per the RFC fully. OR MikroTik silently fixed it in newer versions without posting in changelog, my last version test was: 7.11

Ain’t wasting more time on this than I already have. IPv6 is the future and works fine for my customers, nobody’s complaining about NAT problems on native IPv6.

My setup cannot be simpler. I will not spend time for a drawing.

two local sub-networks, on two different VLANs, routed through an RB5009, Ros 7.14RC1.

Just that and default firewall rules to forbid WAN to LAN traffic and allow established traffic.

Then another firewall forward rule to permit WAN to LAN UDP traffic. Without this rule, full cone is not available, and this is normal because foreign IP by definition are foreign. They are not in the connections table and because of that cannot use the established traffic forward rule.

IPv6 for sure is the futur, but still not available everywhere, and will never be for some old games.

For me it’s working. As you said, NatType Tester is not buggy, and my tests show that he gives repeatable results.

Then we can probably trust it even if the RFC5780 is not fully implemented. Manual testing at Mikrotik seems to show the same positive results.

There are a lot of things that do not fully follow RFCs. But when it works, it works… And full cone is mainly for gamers or individual use, it will never be implemented inside a provider network anyway. If it works, it works…

Which part of this is unclear? THERE’S NO FIREWALL!

As for firewall, firewall is null in my testing and many others in this thread, so firewall is ruled out from day one. In addition, firewall on Windows laptop was also disabled.

EIM-NAT (not full cone) is used in SP network CGNAT boxes, at least on SP networks that are well-informed on the pros/cons of CGNAT/NAT etc. I operate SP networks and we deploy EIM-NAT on the CGNAT boxes. Customers are happy, we’re happy.

MikroTik’s UDP-only EIM-NAT seems to work partially, at least for SIP and similar. However, gamer customers still report they see “moderate NAT” on Xbox and not open. If we use Juniper or Cisco for CGNAT boxes, customers report “open NAT”.

If they have a forward accept rule for UDP traffic from WAN to LAN, or no firewall rules at all, and the two needed EIM / EIF rules in NAT then they should get open NAT.

I did test on 7.14RC1. Some enhancements have been done around 7.11 if i’m right.

Are you using pure Ethernet or a L2 or L3 tunnel for connection to the clients ?

When i test NAT on my public IPv4 IP delivered through an IPIPv6 MAP-E tunnel on my RB5009, i cannot get full cone to work. I can’t say for sure actually if it’s a provider filtering, or a Mikrotik IPIPv6 tunnel problem.

There is another tool that seems quite complete : punch-check.

https://github.com/delthas/punch-check

RFC 4787 defines several NAT properties and which are needed for hole-punching support. Those properties which are checked by this tool are:

port mapping: either endpoint-independent, address-dependent, or address and port-dependent
filtering: either endpoint-independent, address-dependent, or address and port-dependent
hairpinning: supported or unsupported
port assignment: may be contiguous, preserving, and parity-preserving

It gives hairpinning support and port assignment informations, something that NatType tester do not gives.


The RFC 4787 reading probably gives a clear view of the quite complex UDP NAT subject.

https://datatracker.ietf.org/doc/html/rfc4787

Definitely those older terms are not precise enough :

STUN [RFC3489] used the terms “Full Cone”, “Restricted Cone”, “Port
Restricted Cone”, and “Symmetric” to refer to different variations of
NATs applicable to UDP only. Unfortunately, this terminology has
been the source of much confusion, as it has proven inadequate at
describing real-life NAT behavior. This specification therefore
refers to specific individual NAT behaviors instead of using the
Cone/Symmetric terminology.

And some other interesting readings about the subject :

https://bford.info/pub/net/p2pnat/
https://datatracker.ietf.org/doc/html/draft-jennings-behave-test-results-01

I think full cone works.
I tried with stunclient from https://github.com/jselbie/stunserver
And got Endpoint Independent NAT + Endpoint Independent Filtering
One thing I didn’t see people mention, in addition to adding a filter-table forward-chain accept from WAN to LAN of protocol udp,
Make sure in NAT-table, the two “EIN rules” comes before/above the “scrnat masquerade rule”
.

Explanation:
If “scrnat masquerade rule” takes precedence over “scrnat endpoint-independent-nat rule”, all the packets that supposed to be processed by “scrnat EIN” are actually processed by “masquerade”, leaving “scrnat EIN” processing nothing in reality. Interestingly, in my test, “Endpoint Independent NAT” can be achieved with only “scrnat masquerade rule”. Now I don’t know whether that should be the correct behavior, but that’s breaking “dstnat endpoint-independent-nat rule”. As it turns out (and it should be), “dstnat endpoint-independent-nat rule” depends on “scrnat endpoint-independent-nat rule” to maintain mappings between LAN-WAN. Only when “scrnat endpoint-independent-nat rule” processes packets and records mappings, will “dstnat endpoint-independent-nat rule” be able to find and use those mappings.

I haven’t had the opportunity or the courage to test this in a minimally significant environment, with more than 2-3Gbps, and a thousand subscribers behind a box with endpoint-independent-nat configured.

But I tend to believe that things might be working now.

I really believe that MikroTik made adjustments and corrections to endpoint-independent-nat without reporting it in the release notes.
And it wouldn’t be the first time they’ve done this.

I know it’s not ideal.

But a combination of:

  • ALGs (/ip/firewall/service-port/) enabled.
  • NAT-PMP configured
  • endpoint-independent-nat for UDP, with to-address and to-ports
  • NAT with the action “same” for TCP, with to-address and to-ports
  • A good jumping strategy

It ends up bringing a very interesting result.
Especially if you face the problems of:

  • Court orders user identification based on IPv4 and source port.
  • Gamers complaining about the NAT type.

I was able to achieve full cone NAT on RouterOS 7.13.5 using the following NAT rules:

add action=endpoint-independent-nat chain=srcnat out-interface-list=WAN protocol=udp randomise-ports=no
add action=endpoint-independent-nat chain=dstnat in-interface-list=WAN protocol=udp randomise-ports=no
add action=masquerade chain=srcnat out-interface-list=WAN

The first two rules implement the endpoint-independent mapping or “full cone” NAT. The last one handles other internet traffic.

Unlike what some others have reported, I did not need any firewall rule in the forwarding chain.

I used https://www.checkmynat.com/ for testing.

I think probably Mikrotik tweaked the behavior at some point without mentioning their changes in the release notes.

This doesn’t work for some reason are you sure full cone nat is working properly as advertise? will dig more

I have tested EIN at scale

Scenario:
CCR2116, with ROS 7.13.3 and 7.15.3
2000 customer ports
4-5Gbps peak troughput
Typical 60-80K connections at peak (without EIN)
48 NAT chains ,for 48 public addresses

When EIN is enabled, the number of active connections balloons quickly to 500~600k
at this point, the router becomes unresponsive, a “reboot” command lags 30 minutes to take effect

This was described in SUP-147512

As of now, EIN “works” for a home scenario, but does not scale

Probably you need to make sure that it is not activated for traffic that is high volume and does not require the feature, like DNS requests.

we have a NAT bypass for our local recursors, so the vast majority of DNS traffic would never hit the EIN rule

That said, UDP:53 to external recursors (such as 8.8.8.8 ) is not something i specifically considered when running diagnostics

In my setup, the first two rules are enough to achieve endpoint-independent mapping (essentially a full-cone NAT). The third rule just takes care of the rest of the traffic.

Contrary to what some users mentioned, I didn’t have to add anything special to the forwarding chain.

For verification, I relied on https://natchecker.com/.

It seems Mikrotik might have adjusted the implementation at some point, though I couldn’t find any clear note about it in their changelogs.