This problem has been persisting for me for some time. I first attempted to connect to someone in Canada with no luck, then to a friend inside the US while that friend is there, but it didn't work. However, when my Canadian friend was not present, I was able to connect to the one inside the US.
I have recently tried to connect to my friend in Qatar, and it is giving me the same error code: 018-0512.
I have indeed followed support.nintendo.com's advice, changing the IP address and DNS as well as placing my 3DS into my router's DMZ zone, but to no avail.
I would really assistance with this as soon as possible... Thank you in advance...